mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
MIPS signal handling fixes.
Also fixes a register corruption bug in do_sigreturn. When "returning" from sigreturn we are actually restoring the virtual cpu state from the signal frame. This is actually surprisingly hard to observe in practice. Typically an thread be blocked in a FUTEX_WAIT call when the signal arrives, so the effect is a spurious syscall success and the introduction of a subtle race condition. On x86/arm a syscall modifies a single word sized register, so do_sigreturn can just return that value. On MIPS a syscall clobbers multiple registers, so we need additional smarts. My solution is to invent a magic errno value that means "don't touch CPU state". git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7194 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
e4474235d8
commit
0b1bcb00fb
3 changed files with 109 additions and 4 deletions
|
@ -1858,6 +1858,11 @@ void cpu_loop(CPUMIPSState *env)
|
|||
env->active_tc.gpr[7],
|
||||
arg5, arg6/*, arg7, arg8*/);
|
||||
}
|
||||
if (ret == -TARGET_QEMU_ESIGRETURN) {
|
||||
/* Returning from a successful sigreturn syscall.
|
||||
Avoid clobbering register state. */
|
||||
break;
|
||||
}
|
||||
if ((unsigned int)ret >= (unsigned int)(-1133)) {
|
||||
env->active_tc.gpr[7] = 1; /* error flag */
|
||||
ret = -ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue