From patchwork Wed Jul 25 22:10:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173306 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BD6472C0078 for ; Thu, 26 Jul 2012 09:04:31 +1000 (EST) Received: from localhost ([::1]:52341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Su9np-0001DH-Ln for incoming@patchwork.ozlabs.org; Wed, 25 Jul 2012 18:11:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Su9nF-0007wW-Iv for qemu-devel@nongnu.org; Wed, 25 Jul 2012 18:10:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Su9nD-00013o-47 for qemu-devel@nongnu.org; Wed, 25 Jul 2012 18:10:57 -0400 Received: from mail-yx0-f173.google.com ([209.85.213.173]:33038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Su9nC-00013d-W2 for qemu-devel@nongnu.org; Wed, 25 Jul 2012 18:10:55 -0400 Received: by yenl1 with SMTP id l1so1280761yen.4 for ; Wed, 25 Jul 2012 15:10:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=XSPiBi6UDEnqQzWuKH3ids/XDMP4uttNk6QyliIlHo0=; b=oXtHnkY1tFyzMhUInNfPJlPl6mIhyar5IwfSW2Nb8RcrnChbMEcWtteiPQkFnnEIwD YCIX5J5mwAw0RzxtFFZ2tm42FZkf+VU5aMifdfzczRkMc5lLuSs/LwFAu4TAKD5ZzNJv bh//5XwtzCIejQSwni02h+CUatullkp3PIglpLWLtRYcWru916LChdiljwbVsWupUb+G 9GeSitUI8dbeME/5tW/9EXAgAUVcZ/xb9d3Kenvi7OWXlY2P6U7uNvKWiwQzbiSTi4Tc zKi/RCZ7GerTlFgRRprsbrV060zf+8Fj68ixWNLKBjT9qLI7FVIh/0/QOxNxKhbF3RdP WVkw== Received: by 10.66.75.228 with SMTP id f4mr15752388paw.52.1343254254192; Wed, 25 Jul 2012 15:10:54 -0700 (PDT) Received: from anchor.twiddle.home.com ([173.160.232.49]) by mx.google.com with ESMTPS id oo6sm15136761pbc.22.2012.07.25.15.10.53 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Jul 2012 15:10:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 25 Jul 2012 15:10:36 -0700 Message-Id: <1343254238-4727-9-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1343254238-4727-1-git-send-email-rth@twiddle.net> References: <1343254238-4727-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.213.173 Cc: riku.voipio@iki.fi Subject: [Qemu-devel] [PATCH 08/10] alpha-linux-user: Fix a3 error return with v0 error bypass. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org We were failing to initialize a3 for syscalls that bypass the negative return value error check. Signed-off-by: Richard Henderson --- 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 5787432..343b85c 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -2759,13 +2759,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 */