Unlock context switch lock without potentially screwing up switch_to function
This commit is contained in:
parent
36fde7c7c5
commit
1331f4103f
|
@ -52,6 +52,7 @@ impl Context {
|
|||
}
|
||||
|
||||
/// Switch to the next context by restoring its stack and registers
|
||||
#[cold]
|
||||
#[inline(never)]
|
||||
#[naked]
|
||||
pub unsafe fn switch_to(&mut self, next: &mut Context) {
|
||||
|
@ -94,7 +95,12 @@ impl Context {
|
|||
asm!("mov $0, rbp" : "=r"(self.rbp) : : "memory" : "intel", "volatile");
|
||||
asm!("mov rbp, $0" : : "r"(next.rbp) : "memory" : "intel", "volatile");
|
||||
|
||||
// Unset global lock, set inside of kernel
|
||||
CONTEXT_SWITCH_LOCK.store(false, Ordering::SeqCst);
|
||||
asm!("call context_switch_unlock" : : : "memory" : "intel", "volatile");
|
||||
}
|
||||
}
|
||||
|
||||
/// Unset global lock, set inside of kernel
|
||||
#[no_mangle]
|
||||
extern fn context_switch_unlock(){
|
||||
CONTEXT_SWITCH_LOCK.store(false, Ordering::SeqCst);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue