From 57bab02d57bc982e6b07d715ae6d1a753343a021 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Mon, 4 Feb 2013 04:08:12 +0100 Subject: [PATCH] kernel, libc: signals fixes . kernel: signal handler args for ARM . kernel: sanity check return address (LSB indicates thumb mode) . libc: properly retrieve signal mask for ARM together fix test37 on ARM. Change-Id: I4e00f754c50104ed85c7fdf8ec5ad54568f20a81 --- kernel/system/do_sigsend.c | 6 ++++++ lib/libc/arch/arm/gen/setjmp.S | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/kernel/system/do_sigsend.c b/kernel/system/do_sigsend.c index ddb8db93c..eeb13f6c7 100644 --- a/kernel/system/do_sigsend.c +++ b/kernel/system/do_sigsend.c @@ -86,6 +86,12 @@ int do_sigsend(struct proc * caller, message * m_ptr) * handler */ rp->p_reg.lr = (reg_t) fr.sf_retadr; + if(rp->p_reg.lr & 1) { printf("sigsend: LSB LR makes no sense.\n"); } + + /* pass signal handler parameters in registers */ + rp->p_reg.retreg = (reg_t) fr.sf_signo; + rp->p_reg.r1 = (reg_t) fr.sf_code; + rp->p_reg.r2 = (reg_t) fr.sf_scp; #endif /* Copy the sigframe structure to the user's stack. */ diff --git a/lib/libc/arch/arm/gen/setjmp.S b/lib/libc/arch/arm/gen/setjmp.S index 3f3750c9c..56b8202e0 100644 --- a/lib/libc/arch/arm/gen/setjmp.S +++ b/lib/libc/arch/arm/gen/setjmp.S @@ -87,7 +87,11 @@ ENTRY(__longjmp14) stmfd sp!, {r0-r2, r14} mov r2, #0x00000000 add r1, r0, #(_JB_SIGMASK * 4) +#ifdef __minix + mov r0, #2 /* SIG_SETMASK */ +#else mov r0, #3 /* SIG_SETMASK */ +#endif bl PIC_SYM(_C_LABEL(__sigprocmask14), PLT) ldmfd sp!, {r0-r2, r14} -- 2.11.4.GIT