diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-06-29 10:30:37 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-29 20:03:36 +0200 |
commit | 36ce2a2b765a54c2548475134060d0a89081c2fa (patch) | |
tree | aff749f178863d79b3252281951b5676ae6121bc /Kernel | |
parent | 5afec84cc282d6e13967f5602fb31bc9c771e148 (diff) | |
download | serenity-36ce2a2b765a54c2548475134060d0a89081c2fa.zip |
Kernel: Fix struct layout for interrupt entries on x86_64
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Arch/x86/RegisterState.h | 4 | ||||
-rw-r--r-- | Kernel/Arch/x86/x86_64/InterruptEntry.cpp | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/Kernel/Arch/x86/RegisterState.h b/Kernel/Arch/x86/RegisterState.h index ec3f2db073..95c6bb4795 100644 --- a/Kernel/Arch/x86/RegisterState.h +++ b/Kernel/Arch/x86/RegisterState.h @@ -47,11 +47,11 @@ struct [[gnu::packed]] RegisterState { FlatPtr r14; FlatPtr r15; #endif + u16 exception_code; + u16 isr_number; #if ARCH(X86_64) u32 padding; #endif - u16 exception_code; - u16 isr_number; #if ARCH(I386) FlatPtr eip; #else diff --git a/Kernel/Arch/x86/x86_64/InterruptEntry.cpp b/Kernel/Arch/x86/x86_64/InterruptEntry.cpp index 80adf123b6..4e1277b154 100644 --- a/Kernel/Arch/x86/x86_64/InterruptEntry.cpp +++ b/Kernel/Arch/x86/x86_64/InterruptEntry.cpp @@ -14,7 +14,11 @@ asm( "interrupt_common_asm_entry: \n" // add the padding field in RegisterState " subq $4, %rsp\n" - " movl $0, 0(%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" |