Preserve registers and align stack in interrupt handlers
This commit is contained in:
parent
2fa4193517
commit
5d8343ed40
@ -83,19 +83,34 @@ struct Idt
|
|||||||
movabs $$1f, %rax
|
movabs $$1f, %rax
|
||||||
jmp 2f
|
jmp 2f
|
||||||
1:
|
1:
|
||||||
pushq %rdi
|
|
||||||
pushq %rsi
|
|
||||||
pushq %rax
|
pushq %rax
|
||||||
|
pushq %rcx
|
||||||
pushq %rdx
|
pushq %rdx
|
||||||
|
pushq %rsi
|
||||||
|
pushq %rdi
|
||||||
|
pushq %r8
|
||||||
|
pushq %r9
|
||||||
|
pushq %r10
|
||||||
|
pushq %r11
|
||||||
|
pushq %rbp
|
||||||
|
mov %rsp, %rbp
|
||||||
|
and $$0xFFFFFFFFFFFFFFF0, %rsp
|
||||||
mov $$", isr, ", %rdi
|
mov $$", isr, ", %rdi
|
||||||
" ~ (isr_has_error_code(isr) ? "mov 0x20(%rsp), %rsi" : "") ~ "
|
" ~ (isr_has_error_code(isr) ? "mov 0x50(%rbp), %rsi" : "") ~ "
|
||||||
" ~ (isr_has_error_code(isr) ? "lea 0x28(%rsp), %rdx" : "lea 0x20(%rsp), %rdx") ~ "
|
" ~ (isr_has_error_code(isr) ? "lea 0x58(%rbp), %rdx" : "lea 0x50(%rbp), %rdx") ~ "
|
||||||
movabs $$isr, %rax
|
movabs $$isr, %rax
|
||||||
callq *%rax
|
callq *%rax
|
||||||
popq %rdx
|
mov %rbp, %rsp
|
||||||
popq %rax
|
popq %rbp
|
||||||
popq %rsi
|
popq %r11
|
||||||
|
popq %r10
|
||||||
|
popq %r9
|
||||||
|
popq %r8
|
||||||
popq %rdi
|
popq %rdi
|
||||||
|
popq %rsi
|
||||||
|
popq %rdx
|
||||||
|
popq %rcx
|
||||||
|
popq %rax
|
||||||
" ~ (isr_has_error_code(isr) ? "add $$8, %rsp" : "") ~ "
|
" ~ (isr_has_error_code(isr) ? "add $$8, %rsp" : "") ~ "
|
||||||
iretq
|
iretq
|
||||||
2:`, `={rax}`);");
|
2:`, `={rax}`);");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user