Commit d74e3b124889c808c3b21516f9a646588b884f28

Authored by aurel32
1 parent 8109b9b6

[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 <gingold@adacore.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5243 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 5 additions and 4 deletions
hw/alpha_palcode.c
... ... @@ -1071,11 +1071,12 @@ void call_pal (CPUState *env, int palcode)
1071 1071 ret = do_syscall(env, env->ir[IR_V0], env->ir[IR_A0], env->ir[IR_A1],
1072 1072 env->ir[IR_A2], env->ir[IR_A3], env->ir[IR_A4],
1073 1073 env->ir[IR_A5]);
1074   - env->ir[IR_A3] = ret;
1075   - if (ret > (target_ulong)(-515)) {
1076   - env->ir[IR_V0] = 1;
  1074 + if (ret >= 0) {
  1075 + env->ir[IR_A3] = 0;
  1076 + env->ir[IR_V0] = ret;
1077 1077 } else {
1078   - env->ir[IR_V0] = 0;
  1078 + env->ir[IR_A3] = 1;
  1079 + env->ir[IR_V0] = -ret;
1079 1080 }
1080 1081 break;
1081 1082 case 0x9E:
... ...