rt: implement i686 signal entry stub

This commit is contained in:
Mark Poliakov 2024-11-30 12:41:55 +02:00
parent d2a31ef99b
commit 1e96666fda

View File

@ -164,6 +164,8 @@ pub fn setup_signal_full(size: usize) -> Result<(), Error> {
// TODO // TODO
#[cfg(any(target_arch = "x86", rust_analyzer))] #[cfg(any(target_arch = "x86", rust_analyzer))]
mod imp { mod imp {
use super::common_signal_entry;
// i686 is a bit tricky: cdecl ABI requires the arguments to be passed on the stack, while // 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 // 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. // before entering a proper handler. The wrapper also aligns the stack nicely.
@ -172,9 +174,13 @@ mod imp {
// %eax - SignalEntryData pointer // %eax - SignalEntryData pointer
core::arch::naked_asm!( core::arch::naked_asm!(
r#" r#"
jmp . // Align the stack
and $~0xF, %esp
push %eax
call {entry}
"#, "#,
options(att_syntax) options(att_syntax),
entry = sym common_signal_entry
); );
} }
} }