Commit c7206893 authored by Nifou's avatar Nifou

Don't mangle the `r15` register during the context switch

parent 5c223784
Pipeline #166368781 passed with stages
in 9 minutes and 19 seconds
......@@ -76,20 +76,25 @@ pub extern "x86-interrupt" fn timer_interrupt_handler(_: &mut InterruptStackFram
unsafe {
llvm_asm!("
// Registers (store the kstack address in rdi because this register
// will be restored later)
mov qword ptr [rdi + 8], rbp
mov qword ptr [rdi + 16], r15
mov qword ptr [rdi + 24], r14
mov qword ptr [rdi + 32], r13
mov qword ptr [rdi + 40], r12
mov qword ptr [rdi + 48], r11
mov qword ptr [rdi + 56], r10
mov qword ptr [rdi + 64], r9
mov qword ptr [rdi + 72], r8
mov r15, rdi
// Restore the saved registers
pop rsi
pop rdi
// Registers
mov qword ptr [r15 + 8], rbp
mov qword ptr [r15 + 16], r15
mov qword ptr [r15 + 24], r14
mov qword ptr [r15 + 32], r13
mov qword ptr [r15 + 40], r12
mov qword ptr [r15 + 48], r11
mov qword ptr [r15 + 56], r10
mov qword ptr [r15 + 64], r9
mov qword ptr [r15 + 72], r8
// Registers (store the kstack address in r15 because this register is
// already saved)
mov qword ptr [r15 + 80], rsi
mov qword ptr [r15 + 88], rdi
mov qword ptr [r15 + 96], rdx
......@@ -109,7 +114,7 @@ pub extern "x86-interrupt" fn timer_interrupt_handler(_: &mut InterruptStackFram
mov rax, qword ptr [rsp + 48]
mov qword ptr [r15 + 160], rax"
:
: "{r15}"(get_kstack())
: "{rdi}"(get_kstack())
:
: "intel", "volatile");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment