Update PTI patch to inline PTI functions

This commit is contained in:
Jeremy Soller
2018-01-10 17:25:31 -07:00
parent d82ffd16cb
commit 5b389c7ffa
5 changed files with 103 additions and 93 deletions
+1 -7
View File
@@ -118,13 +118,7 @@ pub unsafe fn switch() -> bool {
(&mut *from_ptr).running = false;
(&mut *to_ptr).running = true;
if let Some(ref stack) = (*to_ptr).kstack {
if cfg!(feature = "pti") {
use arch::x86_64::pti::{PTI_CPU_STACK, PTI_CONTEXT_STACK};
gdt::TSS.rsp[0] = (PTI_CPU_STACK.as_ptr() as usize + PTI_CPU_STACK.len()) as u64;
PTI_CONTEXT_STACK = stack.as_ptr() as usize + stack.len();
} else {
gdt::TSS.rsp[0] = (stack.as_ptr() as usize + stack.len()) as u64;
}
gdt::set_tss_stack(stack.as_ptr() as usize + stack.len());
}
CONTEXT_ID.store((&mut *to_ptr).id, Ordering::SeqCst);
}