From 1239b472bb0dba8060f1af29d40dafbc1b2860d4 Mon Sep 17 00:00:00 2001 From: Kwok Cheung Yeung Date: Fri, 17 May 2013 14:51:21 -0700 Subject: linux-user: Save the correct resume address for MIPS signal handling The current ISA mode needs to be saved in bit 0 of the resume address. If the current instruction happens to be in a branch delay slot, then the address of the preceding jump instruction should be stored instead. exception_resume_pc already does both of these tasks, so it is made available and reused. MIPS_HFLAG_BMASK in hflags is cleared, otherwise QEMU may treat the first instruction of the signal handler as a delay slot instruction. Signed-off-by: Kwok Cheung Yeung Signed-off-by: Aurelien Jarno --- linux-user/signal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'linux-user') diff --git a/linux-user/signal.c b/linux-user/signal.c index dc34ae7bbb..5da8452b2a 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -2528,7 +2528,8 @@ setup_sigcontext(CPUMIPSState *regs, struct target_sigcontext *sc) int err = 0; int i; - err |= __put_user(regs->active_tc.PC, &sc->sc_pc); + err |= __put_user(exception_resume_pc(regs), &sc->sc_pc); + regs->hflags &= ~MIPS_HFLAG_BMASK; __put_user(0, &sc->sc_regs[0]); for (i = 1; i < 32; ++i) { -- cgit v1.2.3-55-g7522