|
|
|
@ -156,14 +156,13 @@ impl Context {
|
|
|
|
|
/// Push all callee-saved registers at the current kernel stack.
|
|
|
|
|
/// Store current sp, switch to target.
|
|
|
|
|
/// Pop all callee-saved registers, then return to the target.
|
|
|
|
|
#[naked]
|
|
|
|
|
#[inline(never)]
|
|
|
|
|
pub unsafe extern fn switch(&mut self, _target: &mut Self) {
|
|
|
|
|
extern {
|
|
|
|
|
fn switch_context(src : &mut Context, dst : &mut Context);
|
|
|
|
|
#[inline(always)]
|
|
|
|
|
pub unsafe fn switch(&mut self, target: &mut Self) {
|
|
|
|
|
extern "C" {
|
|
|
|
|
fn switch_context(src: *mut Context, dst: *mut Context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_context(self, _target);
|
|
|
|
|
switch_context(self as *mut Context, target as *mut Context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Constructs a null Context for the current running thread.
|
|
|
|
|