diff --git a/src/arch/aarch64/interrupt/handler.rs b/src/arch/aarch64/interrupt/handler.rs index 13aa805159..42ab5e1ecb 100644 --- a/src/arch/aarch64/interrupt/handler.rs +++ b/src/arch/aarch64/interrupt/handler.rs @@ -123,8 +123,8 @@ impl InterruptStack { pub fn set_stack_pointer(&mut self, sp: usize) { self.iret.sp_el0 = sp; } - pub fn stack_pointer(&self) -> usize { - self.iret.sp_el0 + pub fn sig_archdep_reg(&self) -> usize { + self.scratch.x0 } pub fn set_instr_pointer(&mut self, ip: usize) { self.iret.elr_el1 = ip; @@ -132,9 +132,6 @@ impl InterruptStack { pub fn instr_pointer(&self) -> usize { self.iret.elr_el1 } - pub fn flags(&self) -> usize { - 0 // TODO - } // TODO: This can maybe be done in userspace? pub fn set_syscall_ret_reg(&mut self, ret: usize) { self.scratch.x0 = ret; diff --git a/src/arch/x86/interrupt/handler.rs b/src/arch/x86/interrupt/handler.rs index 3ced68da11..b1dca99699 100644 --- a/src/arch/x86/interrupt/handler.rs +++ b/src/arch/x86/interrupt/handler.rs @@ -13,12 +13,6 @@ pub struct ScratchRegisters { } impl ScratchRegisters { - pub fn a(&self) -> usize { - self.eax - } - pub fn b(&self) -> usize { - self.edx - } pub fn dump(&self) { println!("EAX: {:08x}", { self.eax }); println!("ECX: {:08x}", { self.ecx }); @@ -133,13 +127,10 @@ impl InterruptStack { pub fn set_stack_pointer(&mut self, esp: usize) { self.iret.esp = esp; } - pub fn stack_pointer(&self) -> usize { - self.iret.esp - } pub fn instr_pointer(&self) -> usize { self.iret.eip } - pub fn flags(&self) -> usize { + pub fn sig_archdep_reg(&self) -> usize { self.iret.eflags } pub fn set_instr_pointer(&mut self, eip: usize) { diff --git a/src/arch/x86_64/interrupt/handler.rs b/src/arch/x86_64/interrupt/handler.rs index 1e4f02e257..1e2d6f3ec7 100644 --- a/src/arch/x86_64/interrupt/handler.rs +++ b/src/arch/x86_64/interrupt/handler.rs @@ -107,13 +107,10 @@ impl InterruptStack { pub fn set_stack_pointer(&mut self, rsp: usize) { self.iret.rsp = rsp; } - pub fn stack_pointer(&self) -> usize { - self.iret.rsp - } pub fn instr_pointer(&self) -> usize { self.iret.rip } - pub fn flags(&self) -> usize { + pub fn sig_archdep_reg(&self) -> usize { self.iret.rflags } pub fn set_instr_pointer(&mut self, rip: usize) { @@ -199,14 +196,6 @@ impl InterruptStack { self.iret.rflags & FLAG_SINGLESTEP == FLAG_SINGLESTEP } } -impl ScratchRegisters { - pub fn a(&self) -> usize { - self.rax - } - pub fn b(&self) -> usize { - self.rdx - } -} #[macro_export] macro_rules! push_scratch { diff --git a/src/context/signal.rs b/src/context/signal.rs index 75736580cd..2bbb54bec8 100644 --- a/src/context/signal.rs +++ b/src/context/signal.rs @@ -83,10 +83,7 @@ pub fn signal_handler() { }; let ip = regs.instr_pointer(); - let sp = regs.stack_pointer(); - let fl = regs.flags(); - let scratch_a = regs.scratch.a(); - let scratch_b = regs.scratch.b(); + let archdep_reg = regs.sig_archdep_reg(); regs.set_instr_pointer(sigh_instr_ptr); @@ -94,10 +91,7 @@ pub fn signal_handler() { .expect("cannot have been unset while holding the lock"); thread_ctl.saved_ip.set(ip); - thread_ctl.saved_sp.set(sp); - thread_ctl.saved_flags.set(fl); - thread_ctl.saved_scratch_a.set(scratch_a); - thread_ctl.saved_scratch_b.set(scratch_b); + thread_ctl.saved_archdep_reg.set(archdep_reg); thread_ctl.control_flags.store((control_flags | SigcontrolFlags::INHIBIT_DELIVERY).bits(), Ordering::Release); } diff --git a/syscall b/syscall index bf01feb121..bda8fe89c6 160000 --- a/syscall +++ b/syscall @@ -1 +1 @@ -Subproject commit bf01feb12119e2ab39e60d8e7f7f257c41e7de6b +Subproject commit bda8fe89c63e05db51ee4b5171e90d33a5580265