From ca3ddcdeca5d9f4021216e5129130a218f8aafe1 Mon Sep 17 00:00:00 2001 From: jD91mZM2 Date: Tue, 14 Jul 2020 09:14:16 +0200 Subject: [PATCH] Add TODOs for mapping PTI properly I think we need to reimplement these functions in assembly :( --- src/arch/x86_64/interrupt/handler.rs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/arch/x86_64/interrupt/handler.rs b/src/arch/x86_64/interrupt/handler.rs index 9573925..0a2cfa3 100644 --- a/src/arch/x86_64/interrupt/handler.rs +++ b/src/arch/x86_64/interrupt/handler.rs @@ -299,9 +299,7 @@ macro_rules! interrupt_stack { $code } - $crate::arch::x86_64::pti::map(); [<__interrupt_inner_ $name>](&mut *$stack); - $crate::arch::x86_64::pti::unmap(); } function!(stringify!($name) => { @@ -311,10 +309,16 @@ macro_rules! interrupt_stack { push_preserved!(), push_fs!(), + // TODO: Map PTI + // $crate::arch::x86_64::pti::map(); + // Call inner function with pointer to stack "mov rdi, rsp\n", "call __interrupt_", stringify!($name), "\n", + // TODO: Unmap PTI + // $crate::arch::x86_64::pti::unmap(); + // Restore all userspace registers pop_fs!(), pop_preserved!(), @@ -340,9 +344,7 @@ macro_rules! interrupt { $code } - $crate::arch::x86_64::pti::map(); [<__interrupt_inner_ $name>](); - $crate::arch::x86_64::pti::unmap(); } function!(stringify!($name) => { @@ -351,9 +353,15 @@ macro_rules! interrupt { push_scratch!(), push_fs!(), + // TODO: Map PTI + // $crate::arch::x86_64::pti::map(); + // Call inner function with pointer to stack "call __interrupt_", stringify!($name), "\n", + // TODO: Unmap PTI + // $crate::arch::x86_64::pti::unmap(); + // Restore all userspace registers pop_fs!(), pop_scratch!(), @@ -378,9 +386,7 @@ macro_rules! interrupt_error { $code } - $crate::arch::x86_64::pti::map(); [<__interrupt_inner_ $name>](&mut *$stack); - $crate::arch::x86_64::pti::unmap(); } function!(stringify!($name) => { @@ -396,10 +402,16 @@ macro_rules! interrupt_error { // Put code in, it's now in rax "push rax\n", + // TODO: Map PTI + // $crate::arch::x86_64::pti::map(); + // Call inner function with pointer to stack "mov rdi, rsp\n", "call __interrupt_", stringify!($name), "\n", + // TODO: Unmap PTI + // $crate::arch::x86_64::pti::unmap(); + // Pop code "add rsp, 8\n",