aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2012-06-07 14:47:41 -0700
committerRichard Henderson <rth@twiddle.net>2012-08-04 09:37:49 -0700
commit0e141977e690ee6cd06e5a842eae0be291297efa (patch)
tree913c137679b20ad5b8bda0aa8bbdaf4a95e6c47a /linux-user
parente7ea6cbefdddd63851d3e9b7bc1f82c2c2985756 (diff)
alpha-linux-user: Fix a3 error return with v0 error bypass.
We were failing to initialize a3 for syscalls that bypass the negative return value error check. Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/main.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index a21942cf30..53714de0d4 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2846,13 +2846,11 @@ void cpu_loop(CPUAlphaState *env)
break;
}
/* Syscall writes 0 to V0 to bypass error check, similar
- to how this is handled internal to Linux kernel. */
- if (env->ir[IR_V0] == 0) {
- env->ir[IR_V0] = sysret;
- } else {
- env->ir[IR_V0] = (sysret < 0 ? -sysret : sysret);
- env->ir[IR_A3] = (sysret < 0);
- }
+ to how this is handled internal to Linux kernel.
+ (Ab)use trapnr temporarily as boolean indicating error. */
+ trapnr = (env->ir[IR_V0] != 0 && sysret < 0);
+ env->ir[IR_V0] = (trapnr ? -sysret : sysret);
+ env->ir[IR_A3] = trapnr;
break;
case 0x86:
/* IMB */