mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
paging and allocator functional, heap bug resolved #67
This commit is contained in:
parent
5b69c0a1e9
commit
deb2c0ed3b
@ -87,7 +87,7 @@ void MmInitPaging(void)
|
||||
|
||||
// Alloc structures
|
||||
memzero((void *)&MmPageMapLevel4[0], 512*sizeof(ulong));
|
||||
KalAllocMemoryEx((void**)&MmPhysicalPageTable, phDirSize, M_ZEROED, KPAGESIZE);
|
||||
MmPhysicalPageTable = memalign(phDirSize, KPAGESIZE);
|
||||
|
||||
//DebugLog("\t\t\t\tPhysical map addr : %p\n", MmPhysicalPageTable);
|
||||
|
||||
@ -105,7 +105,7 @@ void MmInitPaging(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
KalAllocMemoryEx((void**)&MmPDP, 512*sizeof(pde_t), M_ZEROED, KPAGESIZE);
|
||||
MmPDP = memalign(512*sizeof(pde_t), KPAGESIZE);
|
||||
|
||||
if (!firstDirectoryAddr) {
|
||||
firstDirectoryAddr = (ulong)MmPDP;
|
||||
@ -128,7 +128,7 @@ void MmInitPaging(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
KalAllocMemoryEx((void**)&MmPD, 512*sizeof(pde_t), M_ZEROED, KPAGESIZE);
|
||||
MmPD = memalign(512*sizeof(pde_t), KPAGESIZE);
|
||||
|
||||
index = (curAddrPDP / ((ulong)KPAGESIZE * 0x40000)) % 512;
|
||||
|
||||
@ -149,7 +149,7 @@ void MmInitPaging(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
KalAllocMemoryEx((void**)&MmPT, 512*sizeof(pte_t), M_ZEROED, KPAGESIZE);
|
||||
MmPT = memalign(512*sizeof(pte_t), KPAGESIZE);
|
||||
|
||||
//DebugLog("\t\t\t\tPT %d : %p\n", index, MmPT);
|
||||
MmPD[index] = (pte_t *)((ulong)MmPT | PRESENT | READWRITE);
|
||||
@ -232,7 +232,7 @@ ulong *MmGetPageDescriptorFromVirtual(void *virtualAddr)
|
||||
if (!((ulong)MmPageMapLevel4[pml4Index] & 0xFFFFFFFFFF000)) { // Select bit from 12 to 51
|
||||
|
||||
// Alloc space
|
||||
KalAllocMemoryEx((void**)&MmPageMapLevel4[pml4Index], 512*sizeof(pdpe_t), M_ZEROED, KPAGESIZE);
|
||||
MmPageMapLevel4[pml4Index] = memalign(512*sizeof(pdpe_t), KPAGESIZE);
|
||||
|
||||
// Set present
|
||||
MmPageMapLevel4[pml4Index] = (pml4_t)((ulong)MmPageMapLevel4[pml4Index] | PRESENT | READWRITE);
|
||||
@ -248,7 +248,7 @@ ulong *MmGetPageDescriptorFromVirtual(void *virtualAddr)
|
||||
|
||||
if (!((ulong)pdp[pdpIndex] & 0xFFFFFFFFFF000)) { // Select bit from 12 to 51
|
||||
|
||||
KalAllocMemoryEx((void**)&pdp[pdpIndex], 512*sizeof(pde_t), M_ZEROED, KPAGESIZE);
|
||||
pdp[pdpIndex] = memalign(512*sizeof(pde_t), KPAGESIZE);
|
||||
|
||||
pdp[pdpIndex] = (pdpe_t)((ulong)pdp[pdpIndex] | PRESENT | READWRITE);
|
||||
|
||||
@ -262,8 +262,8 @@ ulong *MmGetPageDescriptorFromVirtual(void *virtualAddr)
|
||||
DebugLog("\tPD[%d] = %p\n", pdIndex, pd[pdIndex]);
|
||||
|
||||
if (!((ulong)pd[pdIndex] & 0xFFFFFFFFFF000)) { // Select bit from 12 to 51
|
||||
//
|
||||
KalAllocMemoryEx((void**)&pd[pdIndex], 512*sizeof(pte_t), M_ZEROED, KPAGESIZE);
|
||||
|
||||
pd[pdIndex] = memalign(512*sizeof(pte_t), KPAGESIZE);
|
||||
|
||||
pd[pdIndex] = (pde_t)((ulong)pd[pdIndex] | PRESENT | READWRITE);
|
||||
|
||||
|
@ -297,7 +297,7 @@ error_t MmTestBusyPage(void)
|
||||
ulong a = KeGetTicks();
|
||||
DebugLog("Start alloc 30 MB: %lu s\n", a/1000);
|
||||
tab[j++] = MmAllocPageFrame(5*MB, NORMAL);
|
||||
tab[j++] = MmAllocPageFrame(513*4*KB, NORMAL);
|
||||
tab[j++] = MmAllocPageFrame(5*MB, NORMAL);
|
||||
ulong b = KeGetTicks();
|
||||
DebugLog("End alloc : %lu s\n", b/1000);
|
||||
DebugLog("Alloc time : %lu s\n", (b-a)/1000);
|
||||
|
Loading…
Reference in New Issue
Block a user