1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00

Get paging ready for userspace

This commit is contained in:
Adrien Bourmault 2021-03-01 17:18:10 +01:00
parent 2a1990e043
commit 5978e70303
Signed by: neox
GPG Key ID: 6EB408FE0ACEC664

View File

@ -226,9 +226,9 @@ void MmInitPaging(void)
}
//
// Get a page from an address
// Create a page and its parent directories from a virtual (effective) address
//
ulong *MmGetPageDescriptorFromVirtual(void *virtualAddr)
static ulong *MmGetPageDescriptorFromVirtual(void *virtualAddr)
{
// Select bit from 39 to 47
register ulong pml4Index = ((ulong)virtualAddr & 0xFF8000000000) >> 39;
@ -257,7 +257,7 @@ ulong *MmGetPageDescriptorFromVirtual(void *virtualAddr)
(pml4_t)((ulong)MmPageMapLevel4[pml4Index]
| PRESENT
| READWRITE
| USERMODE * (virtualAddr >= USERSPACE) );
| USERMODE * (virtualAddr >= (void*)USERSPACE) );
pdp = (pdpe_t *)((ulong)MmPageMapLevel4[pml4Index] & 0xFFFFFFFFFF000);
//DebugLog("\tCreate PDP at %p\n", MmPageMapLevel4[pml4Index]);
@ -276,7 +276,7 @@ ulong *MmGetPageDescriptorFromVirtual(void *virtualAddr)
pdp[pdpIndex] = (pdpe_t)((ulong)pdp[pdpIndex]
| PRESENT
| READWRITE
| USERMODE * (virtualAddr >= USERSPACE) );
| USERMODE * (virtualAddr >= (void*)USERSPACE) );
pd = (pde_t *)((ulong)pdp[pdpIndex] & 0xFFFFFFFFFF000);
//DebugLog("\tCreate PD at %p\n", (ulong)pdp[pdpIndex]);
@ -295,7 +295,7 @@ ulong *MmGetPageDescriptorFromVirtual(void *virtualAddr)
pd[pdIndex] = (pde_t)((ulong)pd[pdIndex]
| PRESENT
| READWRITE
| USERMODE * (virtualAddr >= USERSPACE) );
| USERMODE * (virtualAddr >= (void*)USERSPACE) );
pt = (pte_t *)((ulong)pd[pdIndex] & 0xFFFFFFFFFF000);
//DebugLog("\tCreate PT at %p\n", (ulong)pd[pdIndex]);