Always save proccess registers

Not sure if this is going to be required, and I'm not sure if this will
hurt performance, y'know, *always* doing this.
This commit is contained in:
jD91mZM2
2020-07-08 11:47:12 +02:00
parent 103ed1b17f
commit 56f55a3b97
3 changed files with 1 additions and 9 deletions

View File

@@ -18,8 +18,6 @@ interrupt_stack!(divide_by_zero, stack, {
interrupt_stack!(debug, stack, {
let mut handled = false;
let guard = ptrace::set_process_regs(stack);
// Disable singlestep before there is a breakpoint, since the breakpoint
// handler might end up setting it again but unless it does we want the
// default to be false.
@@ -33,8 +31,6 @@ interrupt_stack!(debug, stack, {
stack.set_singlestep(had_singlestep);
}
drop(guard);
if !handled {
println!("Debug trap");
stack.dump();
@@ -61,11 +57,7 @@ interrupt_stack!(breakpoint, stack, {
// int3 instruction. After all, it's the sanest thing to do.
stack.iret.rip -= 1;
let guard = ptrace::set_process_regs(stack);
if ptrace::breakpoint_callback(PTRACE_STOP_BREAKPOINT, None).is_none() {
drop(guard);
println!("Breakpoint trap");
stack.dump();
ksignal(SIGTRAP);

View File

@@ -189,7 +189,6 @@ interrupt_stack!(pit, stack, {
timeout::trigger();
if PIT_TICKS.fetch_add(1, Ordering::SeqCst) >= 10 {
let _guard = ptrace::set_process_regs(stack);
let _ = context::switch();
}
});

View File

@@ -335,6 +335,7 @@ macro_rules! interrupt_stack {
pub unsafe extern fn $name () {
#[inline(never)]
unsafe fn inner($stack: &mut $crate::arch::x86_64::macros::InterruptStack) {
let _guard = ptrace::set_process_regs($stack);
$func
}