diff --git a/sortix/include/sortix/kernel/memorymanagement.h b/sortix/include/sortix/kernel/memorymanagement.h index 0c7ca357..9a360c24 100644 --- a/sortix/include/sortix/kernel/memorymanagement.h +++ b/sortix/include/sortix/kernel/memorymanagement.h @@ -83,6 +83,7 @@ namespace Sortix addr_t GetKernelStack(); size_t GetKernelStackSize(); void GetKernelVirtualArea(addr_t* from, size_t* size); + void GetUserVirtualArea(uintptr_t* from, size_t* size); } } diff --git a/sortix/x64/memorymanagement.cpp b/sortix/x64/memorymanagement.cpp index ce6f3b65..4b4e2ef2 100644 --- a/sortix/x64/memorymanagement.cpp +++ b/sortix/x64/memorymanagement.cpp @@ -192,6 +192,12 @@ namespace Sortix *size = VIRTUAL_AREA_UPPER - VIRTUAL_AREA_LOWER; } + void GetUserVirtualArea(uintptr_t* from, size_t* size) + { + *from = 0x400000; // 4 MiB. + *size = 0x800000000000 - *from; // 128 TiB - 4 MiB. + } + addr_t GetKernelStack() { return KERNEL_STACK_START; diff --git a/sortix/x86/memorymanagement.cpp b/sortix/x86/memorymanagement.cpp index e8b0f952..a5cf7612 100644 --- a/sortix/x86/memorymanagement.cpp +++ b/sortix/x86/memorymanagement.cpp @@ -176,6 +176,12 @@ namespace Sortix *size = VIRTUAL_AREA_UPPER - VIRTUAL_AREA_LOWER; } + void GetUserVirtualArea(uintptr_t* from, size_t* size) + { + *from = 0x400000; // 4 MiB. + *size = 0x80000000 - *from; // 2 GiB - 4 MiB. + } + addr_t GetKernelStack() { return KERNEL_STACK_START;