From patchwork Sun Feb 10 18:30:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 219518 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 16E242C0080 for ; Mon, 11 Feb 2013 06:21:56 +1100 (EST) Received: from localhost ([::1]:41235 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4bhH-0007AO-RV for incoming@patchwork.ozlabs.org; Sun, 10 Feb 2013 13:32:15 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4bgI-0004n8-0f for qemu-devel@nongnu.org; Sun, 10 Feb 2013 13:31:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U4bgB-0000Xk-Cg for qemu-devel@nongnu.org; Sun, 10 Feb 2013 13:31:12 -0500 Received: from mail-pb0-f44.google.com ([209.85.160.44]:36810) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4bgB-0000Xc-66 for qemu-devel@nongnu.org; Sun, 10 Feb 2013 13:31:07 -0500 Received: by mail-pb0-f44.google.com with SMTP id wz12so400012pbc.3 for ; Sun, 10 Feb 2013 10:31:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=v0H/VDCxy4C/ZppR1ooqCwb67kLQICU88BOpyLv0akI=; b=a12DEMgsP3cr/QAFNFHhZkWbhVw8qU9jylxZg2y3CtltNtYa6v7eW+sqlXTdkYfMD5 6YxwZxZAlygje7pkyUDRZyyRSKMKPZjqJ1EISSIVBhG05iRt5YLRU9XwBgBtqEZPNesE RnS8zxS2nVSKmPF+2SD/Js2MRQ1CYuRNa8f+Q5j9ueoBBfkpygRhAMXYdtNilOlwYi4h FPKSvUSXTFTQodRYiWEpN2nL4MGMzttXflYK4r7H0Ycsh8BcZ9cfppVmUeb3vfTNYNvX FDE3uLeOVNo6NSv5eVjeNj9sQPq0PIx6ZTaoQk+/QVugjlJY1vx1IeHKYWxdiIB+6f2V qyYQ== X-Received: by 10.68.135.163 with SMTP id pt3mr12875069pbb.23.1360521066576; Sun, 10 Feb 2013 10:31:06 -0800 (PST) Received: from pebble.twiddle.net (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPS id rk5sm5105766pbb.21.2013.02.10.10.31.04 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 10 Feb 2013 10:31:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 10 Feb 2013 10:30:45 -0800 Message-Id: <1360521050-29680-6-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1360521050-29680-1-git-send-email-rth@twiddle.net> References: <1360521050-29680-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.160.44 Cc: peter.maydell@linaro.org, riku.voipio@iki.fi, aurelien@aurel32.net Subject: [Qemu-devel] [PATCH 05/10] mips-linux-user: Fix n32 and n64 syscalls 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 Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- linux-user/main.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 3df8aa2..3a3be70 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -1783,8 +1783,8 @@ void cpu_loop(CPUPPCState *env) #ifdef TARGET_MIPS -#define MIPS_SYS(name, args) args, - +# ifdef TARGET_ABI_MIPSO32 +# define MIPS_SYS(name, args) args, static const uint8_t mips_syscall_args[] = { MIPS_SYS(sys_syscall , 8) /* 4000 */ MIPS_SYS(sys_exit , 1) @@ -2130,8 +2130,8 @@ static const uint8_t mips_syscall_args[] = { MIPS_SYS(sys_clock_adjtime, 2) MIPS_SYS(sys_syncfs, 1) }; - -#undef MIPS_SYS +# undef MIPS_SYS +# endif /* O32 */ static int do_store_exclusive(CPUMIPSState *env) { @@ -2185,8 +2185,11 @@ static int do_store_exclusive(CPUMIPSState *env) void cpu_loop(CPUMIPSState *env) { target_siginfo_t info; - int trapnr, ret; + int trapnr; + abi_long ret; +# ifdef TARGET_ABI_MIPSO32 unsigned int syscall_num; +# endif for(;;) { cpu_exec_start(env); @@ -2194,8 +2197,9 @@ void cpu_loop(CPUMIPSState *env) cpu_exec_end(env); switch(trapnr) { case EXCP_SYSCALL: - syscall_num = env->active_tc.gpr[2] - 4000; env->active_tc.PC += 4; +# ifdef TARGET_ABI_MIPSO32 + syscall_num = env->active_tc.gpr[2] - 4000; if (syscall_num >= sizeof(mips_syscall_args)) { ret = -TARGET_ENOSYS; } else { @@ -2234,12 +2238,19 @@ void cpu_loop(CPUMIPSState *env) arg5, arg6, arg7, arg8); } done_syscall: +# else + ret = do_syscall(env, env->active_tc.gpr[2], + env->active_tc.gpr[4], env->active_tc.gpr[5], + env->active_tc.gpr[6], env->active_tc.gpr[7], + env->active_tc.gpr[8], env->active_tc.gpr[9], + env->active_tc.gpr[10], env->active_tc.gpr[11]); +# endif /* O32 */ if (ret == -TARGET_QEMU_ESIGRETURN) { /* Returning from a successful sigreturn syscall. Avoid clobbering register state. */ break; } - if ((unsigned int)ret >= (unsigned int)(-1133)) { + if ((abi_ulong)ret >= (abi_ulong)-1133) { env->active_tc.gpr[7] = 1; /* error flag */ ret = -ret; } else {