From: Mark Wielaard Date: Fri, 28 Apr 2023 11:34:48 +0000 (+0200) Subject: Support SCV_FLAG also on VGP_ppc64be_linux X-Git-Tag: VALGRIND_3_21_0~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4ec6a6ff767098714ffa8c4e3e3081d98fd2d66;p=thirdparty%2Fvalgrind.git Support SCV_FLAG also on VGP_ppc64be_linux Running on a kernel that supports the SCV instruction (sets PPC_FEATURE2_SCV in auxv AT_HWCAPS2) valgrind will assert: valgrind: m_syswrap/syswrap-main.c:549 (getSyscallArgsFromGuestState): Assertion 'gst->guest_syscall_flag == SC_FLAG' failed. Removing that assert makes most things work. But also filter out PPC_FEATURE2_SCV from AT_HWCAPS2 for the client, so it shouldn't try using the SCV instruction. https://bugs.kde.org/show_bug.cgi?id=469097 --- diff --git a/NEWS b/NEWS index 22d5d4a1d8..118c5e65d0 100644 --- a/NEWS +++ b/NEWS @@ -188,6 +188,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 468401 [PATCH] Add a style file for clang-format 468556 Build failure for vgdb 468606 build: remove "Valgrind relies on GCC" check/output +469097 ppc64(be) doesn't support SCV syscall instruction n-i-bz FreeBSD rfork syscall fail with EINVAL or ENOSYS rather than VG_(unimplemented) To see details of a given bug, visit diff --git a/coregrind/m_initimg/initimg-linux.c b/coregrind/m_initimg/initimg-linux.c index 4da9a8b976..7a7d453350 100644 --- a/coregrind/m_initimg/initimg-linux.c +++ b/coregrind/m_initimg/initimg-linux.c @@ -852,7 +852,11 @@ Addr setup_client_stack( void* init_sp, | 0x04000000ULL /* TAR */ | 0x04000000ULL /* VEC_CRYPTO */ | 0x00800000ULL /* ARCH_3_00 */ +#if defined(VGP_ppc64le_linux) + /* Should also be supported on ppc64be, + but see https://bugs.kde.org/show_bug.cgi?id=469097 */ | 0x00100000ULL /* PPC_FEATURE2_SCV */ +#endif | 0x00400000ULL /* HAS_IEEE128 */ | 0x00200000ULL /* PPC_FEATURE2_DARN */ | 0x00040000ULL /* ARCH_3_1 */ diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c index abd8472e92..4f8c0fe1cb 100644 --- a/coregrind/m_syswrap/syswrap-main.c +++ b/coregrind/m_syswrap/syswrap-main.c @@ -544,11 +544,6 @@ void getSyscallArgsFromGuestState ( /*OUT*/SyscallArgs* canonical, canonical->arg7 = gst->guest_syscall_flag; canonical->arg8 = 0; -#if defined(VGP_ppc64be_linux) - /* The sc instruction is currently only supported on LE systems. */ - vg_assert(gst->guest_syscall_flag == SC_FLAG); -#endif - #elif defined(VGP_x86_freebsd) VexGuestX86State* gst = (VexGuestX86State*)gst_vanilla; UWord *stack = (UWord *)gst->guest_ESP;