diff --git a/kaleid/kernel/mm/paging.c b/kaleid/kernel/mm/paging.c index 653ffb9..4ba948e 100644 --- a/kaleid/kernel/mm/paging.c +++ b/kaleid/kernel/mm/paging.c @@ -182,7 +182,7 @@ void MmInitPaging(void) // // Get a page from an address // -static pte_t MmGetPageDescriptor(void *virtualAddr) +static pte_t MmGetPageDescriptorFromVirtual(void *virtualAddr) { ulong virtAddrPage = (ulong)virtualAddr & ( ~(KPAGESIZE - 1)); @@ -210,7 +210,7 @@ static pte_t MmGetPageDescriptor(void *virtualAddr) void *MmTransVirtToPhyAddr(void* virtualAddr) { ulong virtAddrPage = (ulong)virtualAddr & ( ~(KPAGESIZE - 1)); - pte_t page = MmGetPageDescriptor(virtualAddr); + pte_t page = MmGetPageDescriptorFromVirtual(virtualAddr); if (page == (page & ~(KPAGESIZE - 1))) { return NULL; @@ -229,7 +229,7 @@ void *MmTransPhyToVirtAddr(void* physicalAddr) // void MmSetPage(void* virtualAddr, ulong flags) { - pte_t page = MmGetPageDescriptor(virtualAddr); + pte_t page = MmGetPageDescriptorFromVirtual(virtualAddr); page |= flags; @@ -241,7 +241,7 @@ void MmSetPage(void* virtualAddr, ulong flags) // void MmUnsetPage(void* virtualAddr, ulong flags) { - pte_t page = MmGetPageDescriptor(virtualAddr); + pte_t page = MmGetPageDescriptorFromVirtual(virtualAddr); page &= (~flags); @@ -253,7 +253,11 @@ void MmUnsetPage(void* virtualAddr, ulong flags) // void MmMapPage(void* virtualAddr, void* physicalAddr, ulong flags) { + pte_t page = MmGetPageDescriptorFromVirtual(virtualAddr); + page = ((ulong)physicalAddr & ~(KPAGESIZE - 1)) | flags; + + KeFlushTlbSingle(page); } // @@ -261,7 +265,11 @@ void MmMapPage(void* virtualAddr, void* physicalAddr, ulong flags) // void MmUnmapPage(void* virtualAddr) { + pte_t page = MmGetPageDescriptorFromVirtual(virtualAddr); + page = 0; + + KeFlushTlbSingle(page); } //----------- diff --git a/kaleid/kernel/sh/testcmds.c b/kaleid/kernel/sh/testcmds.c index 025bdcc..d0421dd 100644 Binary files a/kaleid/kernel/sh/testcmds.c and b/kaleid/kernel/sh/testcmds.c differ