From patchwork Sat Oct 1 09:26:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khansa Butt X-Patchwork-Id: 117260 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8D8791007D5 for ; Sat, 1 Oct 2011 19:16:07 +1000 (EST) Received: from localhost ([::1]:39935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9vfw-0002k5-LF for incoming@patchwork.ozlabs.org; Sat, 01 Oct 2011 05:16:04 -0400 Received: from eggs.gnu.org ([140.186.70.92]:52021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9vfq-0002jt-1r for qemu-devel@nongnu.org; Sat, 01 Oct 2011 05:15:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R9vfo-00033l-SB for qemu-devel@nongnu.org; Sat, 01 Oct 2011 05:15:58 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:60175) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9vfo-00033f-L6 for qemu-devel@nongnu.org; Sat, 01 Oct 2011 05:15:56 -0400 Received: by wwg14 with SMTP id 14so3240290wwg.10 for ; Sat, 01 Oct 2011 02:15:55 -0700 (PDT) Received: by 10.216.163.194 with SMTP id a44mr4186407wel.1.1317460555486; Sat, 01 Oct 2011 02:15:55 -0700 (PDT) Received: from localhost.localdomain ([111.68.102.16]) by mx.google.com with ESMTPS id fa3sm12979558wbb.3.2011.10.01.02.15.51 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 01 Oct 2011 02:15:55 -0700 (PDT) From: khansa@kics.edu.pk To: qemu-devel@nongnu.org Date: Sat, 1 Oct 2011 14:26:36 +0500 Message-Id: <1317461201-11180-2-git-send-email-khansa@kics.edu.pk> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1317461201-11180-1-git-send-email-khansa@kics.edu.pk> References: <1317461201-11180-1-git-send-email-khansa@kics.edu.pk> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.53 Cc: peter.maydell@linaro.org, riku.voipio@iki.fi, andreas.faerber@web.de, Khansa Butt , aurelien@aurel32.net, rth@twiddle.net Subject: [Qemu-devel] [PATCH v1 1/6] linux-user: Support for MIPS64 user mode emulation in QEMU 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 From: Khansa Butt Signed-off-by: Khansa Butt --- configure | 1 + default-configs/mips64-linux-user.mak | 1 + linux-user/main.c | 21 +++++++++++++++++++-- linux-user/mips64/syscall.h | 2 ++ linux-user/signal.c | 2 -- 5 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 default-configs/mips64-linux-user.mak diff --git a/configure b/configure index 9ab3ab4..5e45a43 100755 --- a/configure +++ b/configure @@ -891,6 +891,7 @@ m68k-linux-user \ microblaze-linux-user \ microblazeel-linux-user \ mips-linux-user \ +mips64-linux-user \ mipsel-linux-user \ ppc-linux-user \ ppc64-linux-user \ diff --git a/default-configs/mips64-linux-user.mak b/default-configs/mips64-linux-user.mak new file mode 100644 index 0000000..1598bfc --- /dev/null +++ b/default-configs/mips64-linux-user.mak @@ -0,0 +1 @@ +# Default configuration for mips64-linux-user diff --git a/linux-user/main.c b/linux-user/main.c index 89a51d7..1cc564d 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -2068,7 +2068,8 @@ static int do_store_exclusive(CPUMIPSState *env) void cpu_loop(CPUMIPSState *env) { target_siginfo_t info; - int trapnr, ret; + int trapnr; + abi_long ret; unsigned int syscall_num; for(;;) { @@ -2077,8 +2078,23 @@ 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; +#if defined(TARGET_MIPS64) + syscall_num = env->active_tc.gpr[2] - 5000; + /* MIPS64 has eight argument registers so there is + * no need to get arguments from stack + */ + 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]); +#else + syscall_num = env->active_tc.gpr[2] - 4000; if (syscall_num >= sizeof(mips_syscall_args)) { ret = -TARGET_ENOSYS; } else { @@ -2105,6 +2121,7 @@ void cpu_loop(CPUMIPSState *env) env->active_tc.gpr[7], arg5, arg6, arg7, arg8); } +#endif if (ret == -TARGET_QEMU_ESIGRETURN) { /* Returning from a successful sigreturn syscall. Avoid clobbering register state. */ diff --git a/linux-user/mips64/syscall.h b/linux-user/mips64/syscall.h index 668a2b9..96f03da 100644 --- a/linux-user/mips64/syscall.h +++ b/linux-user/mips64/syscall.h @@ -218,4 +218,6 @@ struct target_pt_regs { +#define TARGET_QEMU_ESIGRETURN 255 + #define UNAME_MACHINE "mips64" diff --git a/linux-user/signal.c b/linux-user/signal.c index 89276eb..59c3c88 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -2415,8 +2415,6 @@ void sparc64_get_context(CPUSPARCState *env) #endif #elif defined(TARGET_ABI_MIPSN64) -# warning signal handling not implemented - static void setup_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUState *env) {