summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-07-01 23:02:21 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-01 23:36:17 +0200
commitdb334b50d0a14c983e3218464ecf52f42e41b3de (patch)
tree102896a30c06d01d5638e8f5b29a64c5d814ef06 /Kernel
parent59ba316ac6e6315c3142e95916f977e8fe8655a7 (diff)
downloadserenity-db334b50d0a14c983e3218464ecf52f42e41b3de.zip
Kernel: Don't byteswap the ISR number on interrupt entry
Let's just add the padding before we jump to interrupt_common_asm_entry.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Arch/x86/Interrupts.h9
-rw-r--r--Kernel/Arch/x86/x86_64/InterruptEntry.cpp7
2 files changed, 9 insertions, 7 deletions
diff --git a/Kernel/Arch/x86/Interrupts.h b/Kernel/Arch/x86/Interrupts.h
index 1607d60ab5..f97b82c43f 100644
--- a/Kernel/Arch/x86/Interrupts.h
+++ b/Kernel/Arch/x86/Interrupts.h
@@ -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)());
diff --git a/Kernel/Arch/x86/x86_64/InterruptEntry.cpp b/Kernel/Arch/x86/x86_64/InterruptEntry.cpp
index 4426edbb24..cc1811106c 100644
--- a/Kernel/Arch/x86/x86_64/InterruptEntry.cpp
+++ b/Kernel/Arch/x86/x86_64/InterruptEntry.cpp
@@ -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"