From d74e3b124889c808c3b21516f9a646588b884f28 Mon Sep 17 00:00:00 2001 From: aurel32 Date: Wed, 17 Sep 2008 22:04:29 +0000 Subject: [PATCH] [PATCH] alpha: fix linux syscall convention According to linux kernel sources, register a3 is set in case of failure (and cleared in case of success) while register v0 contains the result (or -errno in case of error). The convention was not followed which results in weird behaviour. Signed-off-by: Tristan Gingold Signed-off-by: Aurelien Jarno git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5243 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/alpha_palcode.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/alpha_palcode.c b/hw/alpha_palcode.c index fe14c1082b..38466dbd8f 100644 --- a/hw/alpha_palcode.c +++ b/hw/alpha_palcode.c @@ -1071,11 +1071,12 @@ void call_pal (CPUState *env, int palcode) ret = do_syscall(env, env->ir[IR_V0], env->ir[IR_A0], env->ir[IR_A1], env->ir[IR_A2], env->ir[IR_A3], env->ir[IR_A4], env->ir[IR_A5]); - env->ir[IR_A3] = ret; - if (ret > (target_ulong)(-515)) { - env->ir[IR_V0] = 1; + if (ret >= 0) { + env->ir[IR_A3] = 0; + env->ir[IR_V0] = ret; } else { - env->ir[IR_V0] = 0; + env->ir[IR_A3] = 1; + env->ir[IR_V0] = -ret; } break; case 0x9E: -- GitLab