summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-19 21:53:53 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-19 23:22:02 +0200
commit961f727448019047433ac1b045f8075f269ba9f7 (patch)
tree25f3972636525b96df35941cb72fc7a03e6f78e5 /Kernel/Syscalls
parent3f5a42b3dd05e56794e5a1394c6e008c15b3f58e (diff)
downloadserenity-961f727448019047433ac1b045f8075f269ba9f7.zip
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).
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r--Kernel/Syscalls/thread.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/Kernel/Syscalls/thread.cpp b/Kernel/Syscalls/thread.cpp
index e3c3ff9e07..ec4b567f03 100644
--- a/Kernel/Syscalls/thread.cpp
+++ b/Kernel/Syscalls/thread.cpp
@@ -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;