mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:08:13 +00:00
Kernel: Push ARCH specific ifdef's down into RegisterState functions
The non CPU specific code of the kernel shouldn't need to deal with architecture specific registers, and should instead deal with an abstract view of the machine. This allows us to remove a variety of architecture specific ifdefs and helps keep the code slightly more portable. We do this by exposing the abstract representation of instruction pointer, stack pointer, base pointer, return register, etc on the RegisterState struct.
This commit is contained in:
parent
ff8429a749
commit
1cffecbe8d
9 changed files with 119 additions and 97 deletions
|
@ -13,12 +13,7 @@ namespace Kernel {
|
|||
KResultOr<FlatPtr> Process::sys$get_stack_bounds(Userspace<FlatPtr*> user_stack_base, Userspace<size_t*> user_stack_size)
|
||||
{
|
||||
auto& regs = Thread::current()->get_register_dump_from_stack();
|
||||
FlatPtr stack_pointer;
|
||||
#if ARCH(I386)
|
||||
stack_pointer = regs.userspace_esp;
|
||||
#else
|
||||
stack_pointer = regs.userspace_rsp;
|
||||
#endif
|
||||
FlatPtr stack_pointer = regs.userspace_sp();
|
||||
auto* stack_region = space().find_region_containing(Range { VirtualAddress(stack_pointer), 1 });
|
||||
|
||||
// The syscall handler should have killed us if we had an invalid stack pointer.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue