qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>
Subject: [Qemu-devel] [PATCH 7/9] alpha-linux-user: Fix a3 error return with v0 error bypass.
Date: Thu,  7 Jun 2012 15:24:29 -0700	[thread overview]
Message-ID: <1339107871-4487-8-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1339107871-4487-1-git-send-email-rth@twiddle.net>

We were failing to initialize a3 for syscalls that bypass the
negative return value error check.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 linux-user/main.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/linux-user/main.c b/linux-user/main.c
index e81abb2..605018a 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2758,13 +2758,11 @@ void cpu_loop(CPUAlphaState *env)
                     break;
                 }
                 /* Syscall writes 0 to V0 to bypass error check, similar
-                   to how this is handled internal to Linux kernel.  */
-                if (env->ir[IR_V0] == 0) {
-                    env->ir[IR_V0] = sysret;
-                } else {
-                    env->ir[IR_V0] = (sysret < 0 ? -sysret : sysret);
-                    env->ir[IR_A3] = (sysret < 0);
-                }
+                   to how this is handled internal to Linux kernel.
+                   (Ab)use trapnr temporarily as boolean indicating error.  */
+                trapnr = (env->ir[IR_V0] != 0 && sysret < 0);
+                env->ir[IR_V0] = (trapnr ? -sysret : sysret);
+                env->ir[IR_A3] = trapnr;
                 break;
             case 0x86:
                 /* IMB */
-- 
1.7.7.6

  parent reply	other threads:[~2012-06-07 22:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-07 22:24 [Qemu-devel] [PATCH v3 0/9] {alpha-}linux user improvements Richard Henderson
2012-06-07 22:24 ` [Qemu-devel] [PATCH 1/9] alpha-linux-user: Fix signal handling Richard Henderson
2012-06-22 14:10   ` Peter Maydell
2012-06-07 22:24 ` [Qemu-devel] [PATCH 2/9] alpha-linux-user: Work around hosted mmap allocation problems Richard Henderson
2012-06-12 14:12   ` Andreas Färber
2012-06-12 14:27     ` Richard Henderson
2012-06-12 14:53       ` Alexander Graf
2012-06-12 14:57         ` Richard Henderson
2012-06-12 15:11           ` Alexander Graf
2012-06-12 15:27             ` Richard Henderson
2012-06-07 22:24 ` [Qemu-devel] [PATCH 3/9] alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly Richard Henderson
2012-06-07 22:24 ` [Qemu-devel] [PATCH 4/9] linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH Richard Henderson
2012-06-22 14:15   ` Peter Maydell
2012-06-07 22:24 ` [Qemu-devel] [PATCH 5/9] linux-user: Allocate the right amount of space for non-fixed file maps Richard Henderson
2012-06-07 22:24 ` [Qemu-devel] [PATCH 6/9] linux-user: Translate pipe2 flags; add to strace Richard Henderson
2012-06-22 14:18   ` Peter Maydell
2012-06-07 22:24 ` Richard Henderson [this message]
2012-06-07 22:24 ` [Qemu-devel] [PATCH 8/9] alpha-linux-user: Properly handle the non-rt sigprocmask syscall Richard Henderson
2012-06-22 14:27   ` Peter Maydell
2012-06-07 22:24 ` [Qemu-devel] [PATCH 9/9] alpha-linux-user: Fix the getpriority syscall Richard Henderson
2012-06-12 13:48 ` [Qemu-devel] [PATCH v3 0/9] {alpha-}linux user improvements Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339107871-4487-8-git-send-email-rth@twiddle.net \
    --to=rth@twiddle.net \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).