Skip to content

Commit

Permalink
Kernel: Fix stack alignment on x86_64
Browse files Browse the repository at this point in the history
These were already properly aligned (as far as I can tell).
  • Loading branch information
gunnarbeutner authored and awesomekling committed Jun 30, 2021
1 parent 50839bd commit e375764
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 2 additions & 4 deletions Kernel/Arch/x86/common/Interrupts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions Kernel/Arch/x86/x86_64/InterruptEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions Kernel/Syscall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e375764

Please sign in to comment.