Received: from eggs.gnu.org ([2001:4830:134:3::10]:49925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQHHm-0003xJ-9U for qemu-devel@nongnu.org; Fri, 14 Aug 2015 11:52:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZQHHj-0003XE-19 for qemu-devel@nongnu.org; Fri, 14 Aug 2015 11:52:50 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:37568) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQHHi-0003Wv-SA for qemu-devel@nongnu.org; Fri, 14 Aug 2015 11:52:46 -0400 Received: by wibhh20 with SMTP id hh20so25428239wib.0 for ; Fri, 14 Aug 2015 08:52:46 -0700 (PDT) From: Alvise Rigo Date: Fri, 14 Aug 2015 17:55:32 +0200 Message-Id: <1439567732-14118-7-git-send-email-a.rigo@virtualopensystems.com> In-Reply-To: <1439567732-14118-1-git-send-email-a.rigo@virtualopensystems.com> References: <1439567732-14118-1-git-send-email-a.rigo@virtualopensystems.com> Subject: [Qemu-devel] [mttcg RFC v4 6/6] target-arm: Use a runtime helper for excl accesses List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, mttcg@listserver.greensocs.com Cc: claudio.fontana@huawei.com, pbonzini@redhat.com, jani.kokkonen@huawei.com, tech@virtualopensystems.com, alex.bennee@linaro.org, aurelien@aurel32.net Instead of using TCG's load and store instructions, use a runtime helper as a hook for the slow-path. This is a proof of concept to verify that this approach is actually working. At the moment only the 32bit STREX is relying on this new code-path and it's working as expected. Signed-off-by: Alvise Rigo --- target-arm/helper.h | 2 ++ target-arm/op_helper.c | 11 +++++++++++ target-arm/translate.c | 12 +++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/target-arm/helper.h b/target-arm/helper.h index c77bf04..c4da74a 100644 --- a/target-arm/helper.h +++ b/target-arm/helper.h @@ -534,6 +534,8 @@ DEF_HELPER_4(atomic_cmpxchg64, i32, env, i32, i64, i32) DEF_HELPER_1(atomic_clear, void, env) DEF_HELPER_3(atomic_claim, void, env, i32, i64) +DEF_HELPER_4(stcond_aa32_i32, i32, env, i32, i32, i32) + #ifdef TARGET_AARCH64 #include "helper-a64.h" #endif diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c index ba8c5f5..53dcdde 100644 --- a/target-arm/op_helper.c +++ b/target-arm/op_helper.c @@ -1095,3 +1095,14 @@ uint32_t HELPER(ror_cc)(CPUARMState *env, uint32_t x, uint32_t i) return ((uint32_t)x >> shift) | (x << (32 - shift)); } } + +uint32_t HELPER(stcond_aa32_i32)(CPUARMState *env, uint32_t val, uint32_t addr, + uint32_t index) +{ + CPUArchState *state = env; + TCGMemOpIdx op; + + op = make_memop_idx(MO_LEUL, index); + + return helper_le_stcondl_mmu(state, addr, val, op, 0); +} diff --git a/target-arm/translate.c b/target-arm/translate.c index d90a27b..591ce97 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -1006,6 +1006,17 @@ static inline void gen_aa32_stex64(TCGv_i32 is_dirty, TCGv_i64 val, #endif +/* Use the runtime helper for 32bit exclusive stores. */ +static inline void gen_aa32_stex32(TCGv_i32 is_dirty, TCGv_i32 val, + TCGv_i32 addr, int index) +{ + TCGv index_tmp = tcg_temp_new_i32(); + + tcg_gen_movi_i32(index_tmp, index); + gen_helper_stcond_aa32_i32(is_dirty, cpu_env, val, addr, index_tmp); + tcg_temp_free_i32(index_tmp); +} + DO_GEN_LD(8s, MO_SB) DO_GEN_LD(8u, MO_UB) DO_GEN_LD(8uex, MO_UB | MO_EXCL) @@ -1021,7 +1032,6 @@ DO_GEN_ST(32, MO_TEUL) /* Load/Store exclusive generators (always unsigned) */ DO_GEN_STEX(8, MO_UB) DO_GEN_STEX(16, MO_TEUW) -DO_GEN_STEX(32, MO_TEUL) static inline void gen_set_pc_im(DisasContext *s, target_ulong val) { -- 2.5.0