mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 08:37:34 +00:00
Kernel: Consolidate a bunch of i386/x86_64 code paths
Add some arch-specific getters and setters that allow us to merge blocks that were previously specific to either ARCH(I386) or ARCH(X86_64).
This commit is contained in:
parent
3f5a42b3dd
commit
961f727448
6 changed files with 64 additions and 117 deletions
|
@ -60,14 +60,10 @@ KResultOr<FlatPtr> Process::sys$create_thread(void* (*entry)(void*), Userspace<c
|
|||
thread->detach();
|
||||
|
||||
auto& regs = thread->regs();
|
||||
#if ARCH(I386)
|
||||
regs.eip = (FlatPtr)entry;
|
||||
regs.eflags = 0x0202;
|
||||
regs.esp = user_sp.value();
|
||||
#else
|
||||
regs.rip = (FlatPtr)entry;
|
||||
regs.rflags = 0x0202;
|
||||
regs.rsp = user_sp.value();
|
||||
regs.set_ip((FlatPtr)entry);
|
||||
regs.set_flags(0x0202);
|
||||
regs.set_sp(user_sp.value());
|
||||
#if ARCH(X86_64)
|
||||
regs.rdi = params.rdi;
|
||||
regs.rsi = params.rsi;
|
||||
regs.rdx = params.rdx;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue