1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:17:35 +00:00

Kernel: Don't byteswap the ISR number on interrupt entry

Let's just add the padding before we jump to interrupt_common_asm_entry.
This commit is contained in:
Gunnar Beutner 2021-07-01 23:02:21 +02:00 committed by Andreas Kling
parent 59ba316ac6
commit db334b50d0
2 changed files with 9 additions and 7 deletions

View file

@ -16,6 +16,13 @@ class GenericInterruptHandeler;
extern "C" void interrupt_common_asm_entry();
#if ARCH(I386)
# define INTERRUPT_HANDLER_PUSH_PADDING
#else
# define INTERRUPT_HANDLER_PUSH_PADDING "pushw $0\npushw $0\n"
#endif
// clang-format off
#define GENERATE_GENERIC_INTERRUPT_HANDLER_ASM_ENTRY(isr_number) \
extern "C" void interrupt_##isr_number##_asm_entry(); \
static void interrupt_##isr_number##_asm_entry_dummy() __attribute__((used)); \
@ -23,10 +30,12 @@ extern "C" void interrupt_common_asm_entry();
{ \
asm(".globl interrupt_" #isr_number "_asm_entry\n" \
"interrupt_" #isr_number "_asm_entry:\n" \
INTERRUPT_HANDLER_PUSH_PADDING \
" pushw $" #isr_number "\n" \
" pushw $0\n" \
" jmp interrupt_common_asm_entry\n"); \
}
// clang-format on
void register_interrupt_handler(u8 number, void (*handler)());
void register_user_callable_interrupt_handler(u8 number, void (*handler)());

View file

@ -12,13 +12,6 @@
asm(
".globl interrupt_common_asm_entry\n"
"interrupt_common_asm_entry: \n"
// add the padding field in RegisterState
" subq $4, %rsp\n"
" pushq %rax\n"
" movl 12(%rsp), %eax\n"
" movl $0, 12(%rsp)\n"
" movl %eax, 8(%rsp)\n"
" popq %rax\n"
// save all the other registers
" pushq %r15\n"
" pushq %r14\n"