From 5978e70303ff87e7462d912f21eff0ab905533a6 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 1 Mar 2021 17:18:10 +0100 Subject: [PATCH] Get paging ready for userspace --- kaleid/kernel/mm/paging.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kaleid/kernel/mm/paging.c b/kaleid/kernel/mm/paging.c index e34575a..653039d 100644 --- a/kaleid/kernel/mm/paging.c +++ b/kaleid/kernel/mm/paging.c @@ -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]);