Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kg58S-0003pu-6w for qemu-devel@nongnu.org; Wed, 17 Sep 2008 18:04:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kg58R-0003pA-It for qemu-devel@nongnu.org; Wed, 17 Sep 2008 18:04:31 -0400 Received: from [199.232.76.173] (port=35144 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kg58R-0003p1-Fw for qemu-devel@nongnu.org; Wed, 17 Sep 2008 18:04:31 -0400 Received: from savannah.gnu.org ([199.232.41.3]:58448 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kg58R-0000aF-2i for qemu-devel@nongnu.org; Wed, 17 Sep 2008 18:04:31 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1Kg58Q-0001eA-HG for qemu-devel@nongnu.org; Wed, 17 Sep 2008 22:04:30 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1Kg58Q-0001e6-8v for qemu-devel@nongnu.org; Wed, 17 Sep 2008 22:04:30 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Wed, 17 Sep 2008 22:04:30 +0000 Subject: [Qemu-devel] [5243] [PATCH] alpha: fix linux syscall convention Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 Signed-off-by: Aurelien Jarno 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: