From 95cf1b8a374655041624d285697d12d9943b03f7 Mon Sep 17 00:00:00 2001 From: Alex Hornung Date: Tue, 16 Mar 2010 22:22:46 +0000 Subject: [PATCH] linux emu - fix some signalling mess * This fixes sigaction in the linux emu, which broke times03 and possibly also part of java (and who knows, maybe flash?) --- sys/emulation/linux/i386/linux_genassym.c | 1 + sys/emulation/linux/i386/linux_locore.s | 5 +++-- sys/emulation/linux/i386/linux_machdep.c | 9 +++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/emulation/linux/i386/linux_genassym.c b/sys/emulation/linux/i386/linux_genassym.c index 481694bd3e..9a85b1fde7 100644 --- a/sys/emulation/linux/i386/linux_genassym.c +++ b/sys/emulation/linux/i386/linux_genassym.c @@ -12,3 +12,4 @@ ASSYM(LINUX_SC_GS, offsetof(struct l_sigcontext, sc_gs)); ASSYM(LINUX_SC_EFLAGS, offsetof(struct l_sigcontext, sc_eflags)); ASSYM(LINUX_RT_SIGF_HANDLER, offsetof(struct l_rt_sigframe, sf_handler)); ASSYM(LINUX_RT_SIGF_UC, offsetof(struct l_rt_sigframe, sf_sc)); +ASSYM(LINUX_RT_SIGF_SC, offsetof(struct l_ucontext, uc_mcontext)); diff --git a/sys/emulation/linux/i386/linux_locore.s b/sys/emulation/linux/i386/linux_locore.s index 7530681e27..1f20d9c60a 100644 --- a/sys/emulation/linux/i386/linux_locore.s +++ b/sys/emulation/linux/i386/linux_locore.s @@ -8,7 +8,7 @@ NON_GPROF_ENTRY(linux_sigcode) call *LINUX_SIGF_HANDLER(%esp) leal LINUX_SIGF_SC(%esp),%ebx /* linux scp */ - movw LINUX_SC_GS(%ebx),%gs + mov LINUX_SC_GS(%ebx),%gs movl %esp, %ebx /* pass sigframe */ push %eax /* fake ret addr */ movl $LINUX_SYS_linux_sigreturn,%eax /* linux_sigreturn() */ @@ -19,7 +19,8 @@ NON_GPROF_ENTRY(linux_sigcode) linux_rt_sigcode: call *LINUX_RT_SIGF_HANDLER(%esp) leal LINUX_RT_SIGF_UC(%esp),%ebx /* linux ucp */ - movw LINUX_SC_GS(%ebx),%gs + leal LINUX_RT_SIGF_SC(%ebx),%ecx /* linux sigcontext */ + mov LINUX_SC_GS(%ecx),%gs push %eax /* fake ret addr */ movl $LINUX_SYS_linux_rt_sigreturn,%eax /* linux_rt_sigreturn() */ int $0x80 /* enter kernel with args */ diff --git a/sys/emulation/linux/i386/linux_machdep.c b/sys/emulation/linux/i386/linux_machdep.c index a89afe1ccd..af6b1eeae5 100644 --- a/sys/emulation/linux/i386/linux_machdep.c +++ b/sys/emulation/linux/i386/linux_machdep.c @@ -943,7 +943,7 @@ sys_linux_sigaction(struct linux_sigaction_args *args) l_osigaction_t osa; l_sigaction_t linux_act, linux_oact; struct sigaction act, oact; - int error; + int error, sig; #ifdef DEBUG if (ldebug(sigaction)) @@ -963,8 +963,13 @@ sys_linux_sigaction(struct linux_sigaction_args *args) linux_to_bsd_sigaction(&linux_act, &act); } + if (args->sig <= LINUX_SIGTBLSZ) + sig = linux_to_bsd_signal[_SIG_IDX(args->sig)]; + else + sig = args->sig; + get_mplock(); - error = kern_sigaction(args->sig, args->nsa ? &act : NULL, + error = kern_sigaction(sig, args->nsa ? &act : NULL, args->osa ? &oact : NULL); rel_mplock(); -- 2.41.0