summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-06-30 13:09:18 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-30 15:13:30 +0200
commite37576440d15a847008915cd97227e07f45173d4 (patch)
treeb531905971f1326d139514647c23dbaff4ea50a7 /Kernel
parent50839bd1f10724d2c56b540f57b71cef39ba8315 (diff)
downloadserenity-e37576440d15a847008915cd97227e07f45173d4.zip
Kernel: Fix stack alignment on x86_64
These were already properly aligned (as far as I can tell).
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Arch/x86/common/Interrupts.cpp6
-rw-r--r--Kernel/Arch/x86/x86_64/InterruptEntry.cpp6
-rw-r--r--Kernel/Syscall.cpp6
3 files changed, 6 insertions, 12 deletions
diff --git a/Kernel/Arch/x86/common/Interrupts.cpp b/Kernel/Arch/x86/common/Interrupts.cpp
index 445e923be0..5ddc6ed487 100644
--- a/Kernel/Arch/x86/common/Interrupts.cpp
+++ b/Kernel/Arch/x86/common/Interrupts.cpp
@@ -152,13 +152,11 @@ asm( \
" pushq %rdi\n" \
" pushq %rsp \n" /* set TrapFrame::regs */ \
" subq $" __STRINGIFY(TRAP_FRAME_SIZE - 8) ", %rsp \n" \
- " subq $0x8, %rsp\n" /* align stack */ \
- " lea 0x8(%rsp), %rdi \n" \
+ " movq %rsp, %rdi \n" \
" cld\n" \
" call enter_trap_no_irq \n" \
- " lea 0x8(%rsp), %rdi \n" \
+ " movq %rsp, %rdi \n" \
" call " #title "_handler\n" \
- " addq $0x8, %rsp\n" /* undo alignment */\
" jmp common_trap_exit \n");
#endif
diff --git a/Kernel/Arch/x86/x86_64/InterruptEntry.cpp b/Kernel/Arch/x86/x86_64/InterruptEntry.cpp
index 4e1277b154..4426edbb24 100644
--- a/Kernel/Arch/x86/x86_64/InterruptEntry.cpp
+++ b/Kernel/Arch/x86/x86_64/InterruptEntry.cpp
@@ -38,13 +38,11 @@ asm(
" pushq %rdi\n"
" pushq %rsp \n" /* set TrapFrame::regs */
" subq $" __STRINGIFY(TRAP_FRAME_SIZE - 8) ", %rsp \n"
- " subq $0x8, %rsp\n" /* align stack */
- " lea 0x8(%rsp), %rdi \n"
+ " movq %rsp, %rdi \n"
" cld\n"
" call enter_trap \n"
- " lea 0x8(%rsp), %rdi \n"
+ " movq %rsp, %rdi \n"
" call handle_interrupt \n"
- " addq $0x8, %rsp\n" /* undo alignment */
".globl common_trap_exit \n"
"common_trap_exit: \n"
// another thread may have handled this trap at this point, so don't
diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp
index d316af2dd3..74075d8542 100644
--- a/Kernel/Syscall.cpp
+++ b/Kernel/Syscall.cpp
@@ -74,13 +74,11 @@ NEVER_INLINE void syscall_asm_entry_dummy()
" pushq %rdi\n"
" pushq %rsp \n" /* set TrapFrame::regs */
" subq $" __STRINGIFY(TRAP_FRAME_SIZE - 8) ", %rsp \n"
- " subq $0x8, %rsp\n" /* align stack */
- " lea 0x8(%rsp), %rdi \n"
+ " movq %rsp, %rdi \n"
" cld\n"
" call enter_trap_no_irq \n"
- " lea 0x8(%rsp), %rdi \n"
+ " movq %rsp, %rdi \n"
" call syscall_handler\n"
- " addq $0x8, %rsp\n" /* undo alignment */
" jmp common_trap_exit \n");
#endif
// clang-format on