Allow cloning of kernel threads. Userspace breaks potentially due to stack aliasing

This commit is contained in:
Jeremy Soller 2016-09-13 20:06:39 -06:00
commit ce50faf7ca

View file

@ -6,7 +6,7 @@ use core::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
/// This must be done, as no locks can be held on the stack during switch
pub static CONTEXT_SWITCH_LOCK: AtomicBool = ATOMIC_BOOL_INIT;
#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct Context {
/// Page table pointer
cr3: usize,
@ -96,5 +96,7 @@ impl Context {
// Unset global lock, set inside of kernel
CONTEXT_SWITCH_LOCK.store(false, Ordering::SeqCst);
asm!("xchg bx, bx" : : : : "intel", "volatile");
}
}