From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHbnz-0006YW-Do for qemu-devel@nongnu.org; Mon, 27 Jun 2016 15:02:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHbnw-0008Cd-Tx for qemu-devel@nongnu.org; Mon, 27 Jun 2016 15:02:47 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:33562) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHbnu-00088c-LX for qemu-devel@nongnu.org; Mon, 27 Jun 2016 15:02:44 -0400 From: "Emilio G. Cota" Date: Mon, 27 Jun 2016 15:01:50 -0400 Message-Id: <1467054136-10430-5-git-send-email-cota@braap.org> In-Reply-To: <1467054136-10430-1-git-send-email-cota@braap.org> References: <1467054136-10430-1-git-send-email-cota@braap.org> Subject: [Qemu-devel] [RFC 04/30] target-i386: add cmpxchg helpers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developers , MTTCG Devel Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Richard Henderson , Sergey Fedorov , Alvise Rigo , Peter Maydell Signed-off-by: Emilio G. Cota --- target-i386/helper.h | 4 ++++ target-i386/mem_helper.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/target-i386/helper.h b/target-i386/helper.h index 1320edc..af84836 100644 --- a/target-i386/helper.h +++ b/target-i386/helper.h @@ -74,8 +74,12 @@ DEF_HELPER_3(boundw, void, env, tl, int) DEF_HELPER_3(boundl, void, env, tl, int) DEF_HELPER_1(rsm, void, env) DEF_HELPER_2(into, void, env, int) +DEF_HELPER_4(cmpxchgb, tl, env, tl, tl, tl) +DEF_HELPER_4(cmpxchgw, tl, env, tl, tl, tl) +DEF_HELPER_4(cmpxchgl, tl, env, tl, tl, tl) DEF_HELPER_2(cmpxchg8b, void, env, tl) #ifdef TARGET_X86_64 +DEF_HELPER_4(cmpxchgq, tl, env, tl, tl, tl) DEF_HELPER_2(cmpxchg16b, void, env, tl) #endif DEF_HELPER_1(single_step, void, env) diff --git a/target-i386/mem_helper.c b/target-i386/mem_helper.c index c2f4769..3b17326 100644 --- a/target-i386/mem_helper.c +++ b/target-i386/mem_helper.c @@ -56,6 +56,21 @@ void helper_lock_init(void) } #endif +#define GEN_CMPXCHG_HELPER(NAME) \ +target_ulong glue(helper_, NAME)(CPUX86State *env, target_ulong addr, \ + target_ulong old, target_ulong new) \ +{ \ + return glue(glue(cpu_, NAME), _data_ra)(env, addr, old, new, GETPC()); \ +} + +GEN_CMPXCHG_HELPER(cmpxchgb) +GEN_CMPXCHG_HELPER(cmpxchgw) +GEN_CMPXCHG_HELPER(cmpxchgl) +#ifdef TARGET_X86_64 +GEN_CMPXCHG_HELPER(cmpxchgq) +#endif +#undef GEN_CMPXCHG_HELPER + void helper_cmpxchg8b(CPUX86State *env, target_ulong a0) { uint64_t d; -- 2.5.0