Hi Atsushi, On 2/7/07, Atsushi Nemoto <anemo@xxxxxxxxxxxxx> wrote:
On Mon, 5 Feb 2007 15:24:27 +0100, Franck Bui-Huu <vagabon.xyz@xxxxxxxxx> wrote: > For the sys_sigsuspend() case, I don't see any reasons... Maybe that was needed before commit 7b3e2fc847c8325a7b35185fa1fc2f1729ed9c5b. At that time sys_sigsuspend() called do_signal() (which includes setup_sigcontext()) directly. So all registers must be saved to kernel stack.
Well, I haven't look at the old code you pointed out. So I dunno, but I still really think we currently don't need to save/restore static registers at all... I tried the following patch: diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 229276a..046fb1b 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c @@ -68,7 +68,9 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) err |= __put_user(regs->cp0_epc, &sc->sc_pc); err |= __put_user(0, &sc->sc_regs[0]); - for (i = 1; i < 32; i++) + for (i = 1; i < 16; i++) + err |= __put_user(regs->regs[i], &sc->sc_regs[i]); + for (i = 24; i < 32; i++) err |= __put_user(regs->regs[i], &sc->sc_regs[i]); err |= __put_user(regs->hi, &sc->sc_mdhi); @@ -126,7 +128,9 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) err |= __get_user(treg, &sc->sc_dsp); wrdsp(treg, DSP_MASK); } - for (i = 1; i < 32; i++) + for (i = 1; i < 16; i++) + err |= __get_user(regs->regs[i], &sc->sc_regs[i]); + for (i = 24; i < 32; i++) err |= __get_user(regs->regs[i], &sc->sc_regs[i]); err |= __get_user(used_math, &sc->sc_used_math); ...and it still passes LTP tests. Someone reported that not saving/restoring static registers may break user tools but the gain is important I think. If you interested, please take a look to the following thread: http://marc.theaimsgroup.com/?l=linux-mips&m=117032669701164&w=2 Thanks -- Franck