From 6052ee66a0cf5234e8e2a2b49a8760226bc13b92 Mon Sep 17 00:00:00 2001 From: Assad Hashmi Date: Fri, 15 May 2020 16:44:14 +0200 Subject: [PATCH] Enable v8.1 atomics and fix SWP and LDUMAX instructions. The atomics test drd/tests/std_mutex hangs on Arm v8.1 when built with GCC10. Add HWCAP_ATOMICS to ARM64_SUPPORTED_HWCAP and fix the ldumax and swp instructions to make it work. https://bugs.kde.org/show_bug.cgi?id=421570 --- NEWS | 2 ++ VEX/priv/guest_arm64_toIR.c | 4 ++-- coregrind/m_initimg/initimg-linux.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 53908689a6..3a2680550b 100644 --- a/NEWS +++ b/NEWS @@ -161,6 +161,8 @@ where XXXXXX is the bug number as listed below. 418435 s390x: spurious "Conditional jump or move depends on uninitialised [..]" 418997 s390x: Support Iex_ITE for float and vector types 419503 s390x: Avoid modifying registers returned from isel functions +421321 gcc10 arm64 build needs __getauxval for linking with libgcc +421570 std_mutex fails on Arm v8.1 h/w n-i-bz Fix minor one time leaks in dhat. n-i-bz Add --run-cxx-freeres=no in outer args to avoid inner crashes. n-i-bz Add support for the Linux io_uring system calls diff --git a/VEX/priv/guest_arm64_toIR.c b/VEX/priv/guest_arm64_toIR.c index ab68da13dd..c65bbbad21 100644 --- a/VEX/priv/guest_arm64_toIR.c +++ b/VEX/priv/guest_arm64_toIR.c @@ -6821,7 +6821,7 @@ Bool dis_ARM64_load_store(/*MB_OUT*/DisResult* dres, UInt insn, break; case 6: nm = "ldumax"; - res = IRExpr_ITE(binop(Iop_CmpLT64U, lhs, rhs), rhs, rhs); + res = IRExpr_ITE(binop(Iop_CmpLT64U, lhs, rhs), rhs, lhs); break; case 7: nm = "ldumin"; @@ -6829,7 +6829,7 @@ Bool dis_ARM64_load_store(/*MB_OUT*/DisResult* dres, UInt insn, break; case 8: nm = "swp"; - res = lhs; + res = rhs; break; default: vassert(0); diff --git a/coregrind/m_initimg/initimg-linux.c b/coregrind/m_initimg/initimg-linux.c index 0b44f825d8..bab8aeca0f 100644 --- a/coregrind/m_initimg/initimg-linux.c +++ b/coregrind/m_initimg/initimg-linux.c @@ -705,7 +705,8 @@ Addr setup_client_stack( void* init_sp, { /* Limit the AT_HWCAP to just those features we explicitly support in VEX. */ -#define ARM64_SUPPORTED_HWCAP (VKI_HWCAP_AES \ +#define ARM64_SUPPORTED_HWCAP (VKI_HWCAP_ATOMICS \ + | VKI_HWCAP_AES \ | VKI_HWCAP_PMULL \ | VKI_HWCAP_SHA1 \ | VKI_HWCAP_SHA2 \ -- 2.47.3