summaryrefslogtreecommitdiff
path: root/Kernel/Arch/x86/common
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/Arch/x86/common
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/Arch/x86/common')
-rw-r--r--Kernel/Arch/x86/common/SafeMem.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/Kernel/Arch/x86/common/SafeMem.cpp b/Kernel/Arch/x86/common/SafeMem.cpp
index 9fb7208ad3..36824714f8 100644
--- a/Kernel/Arch/x86/common/SafeMem.cpp
+++ b/Kernel/Arch/x86/common/SafeMem.cpp
@@ -299,13 +299,8 @@ bool handle_safe_access_fault(RegisterState& regs, FlatPtr fault_address)
else
return false;
-#if ARCH(I386)
- regs.eip = ip;
- regs.edx = fault_address;
-#else
- regs.rip = ip;
- regs.rdx = fault_address;
-#endif
+ regs.set_ip(ip);
+ regs.set_dx(fault_address);
return true;
}
if (ip >= (FlatPtr)&start_of_safemem_atomic_text && ip < (FlatPtr)&end_of_safemem_atomic_text) {
@@ -325,13 +320,8 @@ bool handle_safe_access_fault(RegisterState& regs, FlatPtr fault_address)
else
return false;
-#if ARCH(I386)
- regs.eip = ip;
- regs.edx = 1;
-#else
- regs.rip = ip;
- regs.rdx = 1;
-#endif
+ regs.set_ip(ip);
+ regs.set_dx(1);
return true;
}
return false;