qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [5243] [PATCH] alpha: fix linux syscall convention
@ 2008-09-17 22:04 Aurelien Jarno
  0 siblings, 0 replies; only message in thread
From: Aurelien Jarno @ 2008-09-17 22:04 UTC (permalink / raw)
  To: qemu-devel

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

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:

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-17 22:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-17 22:04 [Qemu-devel] [5243] [PATCH] alpha: fix linux syscall convention Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).