Kernel: Stack pointer is validated when updated

This allows us not to fail stack pointer when in syscall since
interrupts use their own stack
This commit is contained in:
2023-04-21 10:40:24 +03:00
parent b1c7af38d0
commit 9c506ef85b
9 changed files with 37 additions and 23 deletions

View File

@@ -99,12 +99,12 @@ namespace BAN::Formatter
}
extern "C" uintptr_t g_rodata_start;
extern "C" uintptr_t g_rodata_end;
extern "C" uintptr_t g_userspace_start;
extern "C" uintptr_t g_userspace_end;
extern "C" uintptr_t g_kernel_start;
extern "C" uintptr_t g_kernel_end;
extern void userspace_entry();
static void jump_userspace();
@@ -213,7 +213,7 @@ static void jump_userspace()
using namespace Kernel;
MMU::get().map_range((uintptr_t)&g_userspace_start, (uintptr_t)&g_userspace_end - (uintptr_t)&g_userspace_start, MMU::Flags::UserSupervisor | MMU::Flags::Present);
MMU::get().map_range((uintptr_t)&g_rodata_start, (uintptr_t)&g_rodata_end - (uintptr_t)&g_rodata_start, MMU::Flags::UserSupervisor | MMU::Flags::Present);
MMU::get().map_range((uintptr_t)&g_kernel_start, (uintptr_t)&g_kernel_end - (uintptr_t)&g_kernel_start, MMU::Flags::UserSupervisor | MMU::Flags::Present);
MUST(Process::create_userspace(userspace_entry));
}