Skip to contentSkip to conversation

[5243] [PATCH] alpha: fix linux syscall convention

Qemu-devel Aurelien Jarno 1 participant 1 message Sep 17, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 5243

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5243
Author:   aurel32
Date:     2008-09-17 22:04:29 +0000 (Wed, 17 Sep 2008)

Log Message:
-----------
[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.

Modified Paths:
--------------
trunk/hw/alpha_palcode.c

Modified: trunk/hw/alpha_palcode.c
===================================================================

hw/alpha_palcode.c +5 -4
@@ -1071,11 +1071,12 @@
         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: