Allow cloning of kernel threads. Userspace breaks potentially due to stack aliasing
This commit is contained in:
parent
4341a2d725
commit
ce50faf7ca
1 changed files with 109 additions and 38 deletions
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue