qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [5243] [PATCH] alpha: fix linux syscall convention


From: Aurelien Jarno
Subject: [Qemu-devel] [5243] [PATCH] alpha: fix linux syscall convention
Date: Wed, 17 Sep 2008 22:04:30 +0000

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.

Signed-off-by: Tristan Gingold <address@hidden>
Signed-off-by: Aurelien Jarno <address@hidden>

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

Modified: trunk/hw/alpha_palcode.c
===================================================================
--- trunk/hw/alpha_palcode.c    2008-09-17 22:04:21 UTC (rev 5242)
+++ trunk/hw/alpha_palcode.c    2008-09-17 22:04:29 UTC (rev 5243)
@@ -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:






reply via email to

[Prev in Thread] Current Thread [Next in Thread]