Kernel: Define constant USERSPACE_END
This should be used for userspace generic allocations. Currently I used KERNEL_OFFSET, but I want to limit userspace to the actual lower half of the address space
This commit is contained in:
parent
36baf7b0af
commit
a933fabb86
|
@ -4,8 +4,10 @@
|
|||
|
||||
#if ARCH(x86_64)
|
||||
#define KERNEL_OFFSET 0xFFFFFFFF80000000
|
||||
#define USERSPACE_END 0xFFFF800000000000
|
||||
#elif ARCH(i686)
|
||||
#define KERNEL_OFFSET 0xC0000000
|
||||
#define USERSPACE_END 0xC0000000
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
|
|
|
@ -1622,7 +1622,7 @@ namespace Kernel
|
|||
else
|
||||
page_flags |= PageTable::Flags::UserSupervisor;
|
||||
|
||||
AddressRange address_range { .start = 0x400000, .end = KERNEL_OFFSET };
|
||||
AddressRange address_range { .start = 0x400000, .end = USERSPACE_END };
|
||||
if (args->flags & MAP_FIXED)
|
||||
{
|
||||
vaddr_t base_addr = reinterpret_cast<vaddr_t>(args->addr);
|
||||
|
@ -1767,7 +1767,7 @@ namespace Kernel
|
|||
|
||||
BAN::ErrorOr<long> Process::sys_smo_map(SharedMemoryObjectManager::Key key)
|
||||
{
|
||||
auto region = TRY(SharedMemoryObjectManager::get().map_object(key, page_table(), { .start = 0x400000, .end = KERNEL_OFFSET }));
|
||||
auto region = TRY(SharedMemoryObjectManager::get().map_object(key, page_table(), { .start = 0x400000, .end = USERSPACE_END }));
|
||||
|
||||
LockGuard _(m_process_lock);
|
||||
TRY(m_mapped_regions.push_back(BAN::move(region)));
|
||||
|
@ -2522,7 +2522,7 @@ namespace Kernel
|
|||
goto unauthorized_access;
|
||||
|
||||
// trying to access kernel space memory
|
||||
if (vaddr + size > KERNEL_OFFSET)
|
||||
if (vaddr + size > USERSPACE_END)
|
||||
goto unauthorized_access;
|
||||
|
||||
if (vaddr == 0)
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace Kernel
|
|||
|
||||
thread->m_kernel_stack = TRY(VirtualRange::create_to_vaddr_range(
|
||||
page_table,
|
||||
0x200000, KERNEL_OFFSET,
|
||||
0x200000, USERSPACE_END,
|
||||
kernel_stack_size,
|
||||
PageTable::Flags::ReadWrite | PageTable::Flags::Present,
|
||||
true
|
||||
|
@ -111,7 +111,7 @@ namespace Kernel
|
|||
|
||||
thread->m_userspace_stack = TRY(VirtualRange::create_to_vaddr_range(
|
||||
page_table,
|
||||
0x200000, KERNEL_OFFSET,
|
||||
0x200000, USERSPACE_END,
|
||||
userspace_stack_size,
|
||||
PageTable::Flags::UserSupervisor | PageTable::Flags::ReadWrite | PageTable::Flags::Present,
|
||||
true
|
||||
|
|
Loading…
Reference in New Issue