From 5594aba96b93191c2866820a07a93c1c2e85c193 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Tue, 21 Jan 2020 09:16:42 +0100 Subject: [PATCH] Minor adds --- kaleid/kernel/mm/paging.c | 25 +++++++++++++++---------- kaleid/kernel/mm/palloc.c | 8 ++++++++ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/kaleid/kernel/mm/paging.c b/kaleid/kernel/mm/paging.c index f7ca459..bcbd8b6 100644 --- a/kaleid/kernel/mm/paging.c +++ b/kaleid/kernel/mm/paging.c @@ -331,7 +331,7 @@ void MmSetPage(void* virtualAddr, ulong flags) *page |= flags; - KeFlushTlbSingle(virtualAddr); + KeFlushTlbSingle((ulong)virtualAddr); } // @@ -343,7 +343,7 @@ void MmUnsetPage(void* virtualAddr, ulong flags) *page |= flags; - KeFlushTlbSingle(virtualAddr); + KeFlushTlbSingle((ulong)virtualAddr); } // @@ -361,7 +361,7 @@ void MmMapPage(void* virtualAddr, void* physicalAddr, ulong flags) / ((ulong)KPAGESIZE) ] = (ulong)virtualAddr; - KeFlushTlbSingle(virtualAddr); + KeFlushTlbSingle((ulong)virtualAddr); //DebugLog("Done %p at page %p\n", *page, page); @@ -376,15 +376,20 @@ void MmUnmapPage(void* virtualAddr) { ulong *page = MmGetPageDescriptorFromVirtual(virtualAddr); - /* MmPhysicalPageTable[(ulong)(MmTransVirtToPhyAddr(virtualAddr)) */ - /* / ((ulong)KPAGESIZE) */ - /* ] = 0; */ + //DebugLog("Request %p:%p with %lu\n", virtualAddr, physicalAddr, flags); - /* pt[ */ - /* (virtualAddr / (ulong)KPAGESIZE) % 512 */ - /* ] = 0; */ + MmPhysicalPageTable[(ulong)MmTransVirtToPhyAddr (virtualAddr) + / ((ulong)KPAGESIZE) + ] = (ulong)0; - KeFlushTlbSingle(virtualAddr); + *page = (ulong)0; + + //DebugLog("Done %p at page %p\n", *page, page); + + if ((ulong)virtualAddr == MmVirtLastAddress) + MmVirtLastAddress = (ulong)virtualAddr - KPAGESIZE; + + KeFlushTlbSingle((ulong)virtualAddr); } //----------- diff --git a/kaleid/kernel/mm/palloc.c b/kaleid/kernel/mm/palloc.c index 6a8e229..9b98233 100644 --- a/kaleid/kernel/mm/palloc.c +++ b/kaleid/kernel/mm/palloc.c @@ -310,6 +310,14 @@ error_t MmTestBusyPage(ulong size, ulong flags) DebugLog("End map : %lu ms\n", b); DebugLog("Map time : %lu ms\n", (b-a)); + a = KeGetTicks(); + DebugLog("Start unmap at %p wit %p: %lu ms\n", USERSPACE, flags, a); + MmUnmapPageFrame(tab[0]); + b = KeGetTicks(); + DebugLog("End map : %lu ms\n", b); + DebugLog("Map time : %lu ms\n", (b-a)); + + DebugLog("Finished !\n"); return EOK;