From 1e96666fda2e2df9cc9942109e02ba4858ddfd7c Mon Sep 17 00:00:00 2001 From: Mark Poliakov Date: Sat, 30 Nov 2024 12:41:55 +0200 Subject: [PATCH] rt: implement i686 signal entry stub --- lib/runtime/src/process/signal.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/runtime/src/process/signal.rs b/lib/runtime/src/process/signal.rs index d822df8e..8980236a 100644 --- a/lib/runtime/src/process/signal.rs +++ b/lib/runtime/src/process/signal.rs @@ -164,6 +164,8 @@ pub fn setup_signal_full(size: usize) -> Result<(), Error> { // TODO #[cfg(any(target_arch = "x86", rust_analyzer))] mod imp { + use super::common_signal_entry; + // i686 is a bit tricky: cdecl ABI requires the arguments to be passed on the stack, while // the kernel does the easy thing and just puts it into %eax, so a fixup needs to be done // before entering a proper handler. The wrapper also aligns the stack nicely. @@ -172,9 +174,13 @@ mod imp { // %eax - SignalEntryData pointer core::arch::naked_asm!( r#" - jmp . + // Align the stack + and $~0xF, %esp + push %eax + call {entry} "#, - options(att_syntax) + options(att_syntax), + entry = sym common_signal_entry ); } }