X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/0eabc11fcf240415e39f3873dfce7cd9384b3042..7c7b5f05d39b7739d990f71256a2267ec67a6913:/lunaix-os/kernel/mm/mmio.c diff --git a/lunaix-os/kernel/mm/mmio.c b/lunaix-os/kernel/mm/mmio.c index e9843d6..43cc9e1 100644 --- a/lunaix-os/kernel/mm/mmio.c +++ b/lunaix-os/kernel/mm/mmio.c @@ -4,23 +4,25 @@ #include void* -ioremap(uintptr_t paddr, u32_t size) +ioremap(ptr_t paddr, u32_t size) { - void* ptr = vmm_vmap(paddr, size, PG_PREM_RW | PG_DISABLE_CACHE); + void* ptr = vmap(paddr, size, PG_PREM_RW | PG_DISABLE_CACHE, 0); + if (ptr) { pmm_mark_chunk_occupied(KERNEL_PID, paddr >> PG_SIZE_BITS, CEIL(size, PG_SIZE_BITS), PP_FGLOCKED); } + return ptr; } -void* -iounmap(uintptr_t vaddr, u32_t size) +void +iounmap(ptr_t vaddr, u32_t size) { for (size_t i = 0; i < size; i += PG_SIZE) { - uintptr_t paddr = vmm_del_mapping(VMS_SELF, vaddr + i); + ptr_t paddr = vmm_del_mapping(VMS_SELF, vaddr + i); pmm_free_page(KERNEL_PID, paddr); } } \ No newline at end of file