diff --git a/kaleid/kernel/mm/paging.c b/kaleid/kernel/mm/paging.c index 116e220..fa55202 100644 --- a/kaleid/kernel/mm/paging.c +++ b/kaleid/kernel/mm/paging.c @@ -173,7 +173,7 @@ void MmInitPaging(void) else if ((ulong)curAddrPT >= USERSPACE) { MmPT[index] = ((ulong)curAddrPT - diffKernUsr) | PRESENT; // Not present for instance xedni = (((ulong)curAddrPT - diffKernUsr) / ((ulong)KPAGESIZE)); - MmPhysicalPageTable[xedni] = (ulong)curAddrPT; + //MmPhysicalPageTable[xedni] = (ulong)curAddrPT; if ((ulong)curAddrPT == USERSPACE) { DebugLog("\tUserspace at %p:%p\n", curAddrPT, curAddrPT - diffKernUsr); @@ -295,44 +295,48 @@ void MmUnmapPage(void* virtualAddr) // // Find a free block of pages // -void *MmGetPhyPageBlock(size_t size, bool usermode) { - void *startPhyPage = 0; - void *endPhyPage = 0; - size_t curSize = 0; +/* void *MmGetPhyPageBlock(size_t size, bool usermode) { */ +/* void *startPhyPage = 0; */ +/* void *endPhyPage = 0; */ +/* ulong offset = 0; */ +/* size_t curSize = 0; */ - // Maximum PHYSICAL address in memory - ulong phRamSize = memoryMap.freeRamSize + memoryMap.nonfreeRamSize; +/* // Maximum PHYSICAL address in memory */ +/* ulong phRamSize = memoryMap.freeRamSize + memoryMap.nonfreeRamSize; */ - ulong curVirtAddr = 0; +/* ulong curVirtAddr = 0; */ - if (!usermode) { - startPhyPage = MmTransVirtToPhyAddr((void*)KPAGESIZE + 1); - endPhyPage = (void*)MmPhysLastKernAddress; - } else { - startPhyPage = MmTransVirtToPhyAddr((void*)USERSPACE); - endPhyPage = (void*)(phRamSize & ~(KPAGESIZE - 1)); - } +/* if (!usermode) { */ +/* startPhyPage = MmTransVirtToPhyAddr((void*)KPAGESIZE); */ +/* endPhyPage = (void*)MmPhysLastKernAddress; */ +/* offset = 0; */ +/* } else { */ +/* startPhyPage = MmTransVirtToPhyAddr((void*)USERSPACE); */ +/* endPhyPage = (void*)(phRamSize & ~(KPAGESIZE - 1)); */ +/* offset = (ulong)USERSPACE - MmPhysLastKernAddress - KPAGESIZE; */ +/* } */ - DebugLog("Start phy at %p\n", startPhyPage); - DebugLog("End phy at %p\n", endPhyPage); +/* DebugLog("Start phy at %p\n", startPhyPage); */ +/* DebugLog("End phy at %p\n", endPhyPage); */ - for (ulong curPhyAddr = (ulong)startPhyPage; - curPhyAddr <= (ulong)endPhyPage; - curPhyAddr += KPAGESIZE) { - curVirtAddr = (ulong)MmTransPhyToVirtAddr((void*)curPhyAddr); +/* for (ulong curPhyAddr = (ulong)startPhyPage; */ +/* curPhyAddr <= (ulong)endPhyPage; */ +/* curPhyAddr += KPAGESIZE) { */ +/* curVirtAddr = (ulong)MmTransPhyToVirtAddr((void*)curPhyAddr); */ - if (curVirtAddr == 0) { - DebugLog("CurrentAddr %p\n", curVirtAddr); - DebugLog("\t Free !\n"); - curSize += KPAGESIZE; - } - if (curSize >= size) - break; - } +/* if (curVirtAddr == 0) { */ +/* DebugLog("CurrentAddr %p\n", curPhyAddr); */ +/* DebugLog("\t Free !\n"); */ +/* curSize += KPAGESIZE; */ +/* } */ - return NULL; -} +/* if (curSize >= size) */ +/* break; */ +/* } */ + +/* return NULL; */ +/* } */ //-----------