1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:17:44 +00:00

Kernel: Fix stack alignment on x86_64

These were already properly aligned (as far as I can tell).
This commit is contained in:
Gunnar Beutner 2021-06-30 13:09:18 +02:00 committed by Andreas Kling
parent 50839bd1f1
commit e37576440d
3 changed files with 6 additions and 12 deletions

View file

@ -152,13 +152,11 @@ asm( \
" pushq %rdi\n" \ " pushq %rdi\n" \
" pushq %rsp \n" /* set TrapFrame::regs */ \ " pushq %rsp \n" /* set TrapFrame::regs */ \
" subq $" __STRINGIFY(TRAP_FRAME_SIZE - 8) ", %rsp \n" \ " subq $" __STRINGIFY(TRAP_FRAME_SIZE - 8) ", %rsp \n" \
" subq $0x8, %rsp\n" /* align stack */ \ " movq %rsp, %rdi \n" \
" lea 0x8(%rsp), %rdi \n" \
" cld\n" \ " cld\n" \
" call enter_trap_no_irq \n" \ " call enter_trap_no_irq \n" \
" lea 0x8(%rsp), %rdi \n" \ " movq %rsp, %rdi \n" \
" call " #title "_handler\n" \ " call " #title "_handler\n" \
" addq $0x8, %rsp\n" /* undo alignment */\
" jmp common_trap_exit \n"); " jmp common_trap_exit \n");
#endif #endif

View file

@ -38,13 +38,11 @@ asm(
" pushq %rdi\n" " pushq %rdi\n"
" pushq %rsp \n" /* set TrapFrame::regs */ " pushq %rsp \n" /* set TrapFrame::regs */
" subq $" __STRINGIFY(TRAP_FRAME_SIZE - 8) ", %rsp \n" " subq $" __STRINGIFY(TRAP_FRAME_SIZE - 8) ", %rsp \n"
" subq $0x8, %rsp\n" /* align stack */ " movq %rsp, %rdi \n"
" lea 0x8(%rsp), %rdi \n"
" cld\n" " cld\n"
" call enter_trap \n" " call enter_trap \n"
" lea 0x8(%rsp), %rdi \n" " movq %rsp, %rdi \n"
" call handle_interrupt \n" " call handle_interrupt \n"
" addq $0x8, %rsp\n" /* undo alignment */
".globl common_trap_exit \n" ".globl common_trap_exit \n"
"common_trap_exit: \n" "common_trap_exit: \n"
// another thread may have handled this trap at this point, so don't // another thread may have handled this trap at this point, so don't

View file

@ -74,13 +74,11 @@ NEVER_INLINE void syscall_asm_entry_dummy()
" pushq %rdi\n" " pushq %rdi\n"
" pushq %rsp \n" /* set TrapFrame::regs */ " pushq %rsp \n" /* set TrapFrame::regs */
" subq $" __STRINGIFY(TRAP_FRAME_SIZE - 8) ", %rsp \n" " subq $" __STRINGIFY(TRAP_FRAME_SIZE - 8) ", %rsp \n"
" subq $0x8, %rsp\n" /* align stack */ " movq %rsp, %rdi \n"
" lea 0x8(%rsp), %rdi \n"
" cld\n" " cld\n"
" call enter_trap_no_irq \n" " call enter_trap_no_irq \n"
" lea 0x8(%rsp), %rdi \n" " movq %rsp, %rdi \n"
" call syscall_handler\n" " call syscall_handler\n"
" addq $0x8, %rsp\n" /* undo alignment */
" jmp common_trap_exit \n"); " jmp common_trap_exit \n");
#endif #endif
// clang-format on // clang-format on