From patchwork Mon Mar 19 21:57:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 147651 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 AF2F3B6F6E for ; Tue, 20 Mar 2012 08:58:03 +1100 (EST) Received: from localhost ([::1]:52080 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9kaX-0007c6-Jj for incoming@patchwork.ozlabs.org; Mon, 19 Mar 2012 17:58:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9kaI-0007UY-R4 for qemu-devel@nongnu.org; Mon, 19 Mar 2012 17:57:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9kaG-0005as-OJ for qemu-devel@nongnu.org; Mon, 19 Mar 2012 17:57:46 -0400 Received: from mail-iy0-f173.google.com ([209.85.210.173]:33664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9kaG-0005Gg-HT for qemu-devel@nongnu.org; Mon, 19 Mar 2012 17:57:44 -0400 Received: by mail-iy0-f173.google.com with SMTP id j26so11568565iaf.4 for ; Mon, 19 Mar 2012 14:57:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=fGPItyJmRc9QIyNoZL4+rtmzUTz3i4zclFvDV+mxo7U=; b=XcKC7cXPo7cRo1PT6DCQS/E9UVw6N0TQ5fLz0BVDsiN7W/eUukzi61Ujz3xwMTNvID LvaiHZe+4UZGGD2pJb+so+JsDFYvU7TXvT4iFEhUCgfXu5MKnrnR8kRkc/swQ0U7WdbK qaZX0YeIgyAAA4GVtsqssTKlgAsx9WUTsbZH29Gyv3meoB0v5YeRemi7IF0vKot649Qx syyQfuMQ2DL1h2d2eOQA8Fs6inBPBydrE5n/m5wEThACa6mVpN1lMNZq2PeOYi5y68TA vYKSB8RXkbaiLNLMjFP6iMHa7j10Vrp3r8Xz2DUV5cVrN6s8JhF4w5x/Nj0glfEN1KZU lTEw== Received: by 10.42.203.148 with SMTP id fi20mr2449765icb.10.1332194263702; Mon, 19 Mar 2012 14:57:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.75.41 with HTTP; Mon, 19 Mar 2012 14:57:23 -0700 (PDT) From: Blue Swirl Date: Mon, 19 Mar 2012 21:57:23 +0000 Message-ID: To: Paul Brook , Peter Maydell , qemu-devel X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.173 Subject: [Qemu-devel] [PATCH 5/6] arm: move exception and wfi helpers to helper.c 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 Add an explicit CPUARMState parameter instead of relying on AREG0 and move exception and wfi helpers to helper.c. Merge raise_exception() and helper_exception(). Signed-off-by: Blue Swirl --- target-arm/helper.c | 13 +++++++++++++ target-arm/helper.h | 4 ++-- target-arm/op_helper.c | 23 +---------------------- target-arm/translate.c | 4 ++-- 4 files changed, 18 insertions(+), 26 deletions(-) gen_exception(EXCP_SWI); diff --git a/target-arm/helper.c b/target-arm/helper.c index 77415b3..075e8fa 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -775,6 +775,19 @@ uint32_t HELPER(ror_cc)(CPUARMState *env, uint32_t x, uint32_t i) } } +void HELPER(wfi)(CPUARMState *env) +{ + env->exception_index = EXCP_HLT; + env->halted = 1; + cpu_loop_exit(env); +} + +void HELPER(exception)(CPUARMState *env, uint32_t excp) +{ + env->exception_index = excp; + cpu_loop_exit(env); +} + #if defined(CONFIG_USER_ONLY) void do_interrupt (CPUARMState *env) diff --git a/target-arm/helper.h b/target-arm/helper.h index 3e5f92e..e9f2201 100644 --- a/target-arm/helper.h +++ b/target-arm/helper.h @@ -50,8 +50,8 @@ DEF_HELPER_2(usad8, i32, i32, i32) DEF_HELPER_1(logicq_cc, i32, i64) DEF_HELPER_3(sel_flags, i32, i32, i32, i32) -DEF_HELPER_1(exception, void, i32) -DEF_HELPER_0(wfi, void) +DEF_HELPER_2(exception, void, env, i32) +DEF_HELPER_1(wfi, void, env) DEF_HELPER_3(cpsr_write, void, env, i32, i32) DEF_HELPER_1(cpsr_read, i32, env) diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c index b1ced67..f1933c3 100644 --- a/target-arm/op_helper.c +++ b/target-arm/op_helper.c @@ -21,14 +21,6 @@ #include "helper.h" #if !defined(CONFIG_USER_ONLY) -static void raise_exception(int tt) -{ - env->exception_index = tt; - cpu_loop_exit(env); -} -#endif - -#if !defined(CONFIG_USER_ONLY) #include "softmmu_exec.h" @@ -72,21 +64,8 @@ void tlb_fill(CPUARMState *env1, target_ulong addr, int is_write, int mmu_idx, cpu_restore_state(tb, env, pc); } } - raise_exception(env->exception_index); + helper_exception(env, env->exception_index); } env = saved_env; } #endif - -void HELPER(wfi)(void) -{ - env->exception_index = EXCP_HLT; - env->halted = 1; - cpu_loop_exit(env); -} - -void HELPER(exception)(uint32_t excp) -{ - env->exception_index = excp; - cpu_loop_exit(env); -} diff --git a/target-arm/translate.c b/target-arm/translate.c index d654255..643a573 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -208,7 +208,7 @@ static void gen_exception(int excp) { TCGv tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, excp); - gen_helper_exception(tmp); + gen_helper_exception(cpu_env, tmp); tcg_temp_free_i32(tmp); } @@ -10083,7 +10083,7 @@ static inline void gen_intermediate_code_internal(CPUARMState *env, /* nothing more to generate */ break; case DISAS_WFI: - gen_helper_wfi(); + gen_helper_wfi(cpu_env); break; case DISAS_SWI: