|
|
@ -336,16 +336,18 @@ macro_rules! interrupt_switch {
|
|
|
|
let mut rsp: usize;
|
|
|
|
let mut rsp: usize;
|
|
|
|
asm!("" : "={rsp}"(rsp) : : : "intel", "volatile");
|
|
|
|
asm!("" : "={rsp}"(rsp) : : : "intel", "volatile");
|
|
|
|
|
|
|
|
|
|
|
|
// Map kernel
|
|
|
|
|
|
|
|
// $crate::arch::x86_64::pti::map();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Call inner rust function
|
|
|
|
// Call inner rust function
|
|
|
|
inner(&mut rsp);
|
|
|
|
inner(&mut rsp);
|
|
|
|
|
|
|
|
|
|
|
|
asm!("" : : "{rsp}"(rsp) : : "intel", "volatile");
|
|
|
|
// Set return rsp if to user
|
|
|
|
|
|
|
|
use arch::gdt;
|
|
|
|
|
|
|
|
use core::mem::size_of;
|
|
|
|
|
|
|
|
let tf = &mut *(rsp as *mut TrapFrame);
|
|
|
|
|
|
|
|
if tf.iret.cs == gdt::UCODE_SELECTOR.0 as usize {
|
|
|
|
|
|
|
|
gdt::set_ring0_rsp(rsp + size_of::<TrapFrame>());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Unmap kernel
|
|
|
|
asm!("" : : "{rsp}"(rsp) : : "intel", "volatile");
|
|
|
|
// $crate::arch::x86_64::pti::unmap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Pop scratch registers and return
|
|
|
|
// Pop scratch registers and return
|
|
|
|
fs_pop!();
|
|
|
|
fs_pop!();
|
|
|
|