From 4fb1e502dbd2a492eb5c9b89151120b8f615840d Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Wed, 29 Oct 2025 22:09:08 +0100 Subject: [PATCH] Bug 511329 - Darwin and FreeBSD: Move setting of carry flag out of ML_(do_syscall_for_client_WRK) part 3 Remove guest_SETC and GENOFFSET --- NEWS | 2 ++ VEX/auxprogs/genoffsets.c | 3 --- VEX/priv/guest_amd64_helpers.c | 2 -- VEX/priv/guest_x86_helpers.c | 2 -- VEX/pub/libvex_guest_amd64.h | 5 +---- VEX/pub/libvex_guest_arm64.h | 8 +------- VEX/pub/libvex_guest_x86.h | 3 +-- coregrind/m_syswrap/syswrap-main.c | 12 ------------ 8 files changed, 5 insertions(+), 32 deletions(-) diff --git a/NEWS b/NEWS index 2ecf886a2..526969ebf 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,8 @@ than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. 487055 memcheck/tests/x86-linux/scalar fails running in Docker +511329 Darwin and FreeBSD: Move setting of carry flag out of + ML_(do_syscall_for_client_WRK) To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/VEX/auxprogs/genoffsets.c b/VEX/auxprogs/genoffsets.c index 07ff09be7..914dbee74 100644 --- a/VEX/auxprogs/genoffsets.c +++ b/VEX/auxprogs/genoffsets.c @@ -98,7 +98,6 @@ void foo ( void ) GENOFFSET(X86,x86,FS); GENOFFSET(X86,x86,GS); GENOFFSET(X86,x86,SS); - GENOFFSET(X86,x86,SETC); // amd64 GENOFFSET(AMD64,amd64,RAX); @@ -118,7 +117,6 @@ void foo ( void ) GENOFFSET(AMD64,amd64,R14); GENOFFSET(AMD64,amd64,R15); GENOFFSET(AMD64,amd64,RIP); - GENOFFSET(AMD64,amd64,SETC); // ppc32 GENOFFSET(PPC32,ppc32,GPR0); @@ -174,7 +172,6 @@ void foo ( void ) GENOFFSET(ARM64,arm64,X8); GENOFFSET(ARM64,arm64,XSP); GENOFFSET(ARM64,arm64,PC); - GENOFFSET(ARM64,arm64,SETC); // s390x GENOFFSET(S390X,s390x,r2); diff --git a/VEX/priv/guest_amd64_helpers.c b/VEX/priv/guest_amd64_helpers.c index ca33f7c81..b8fa52460 100644 --- a/VEX/priv/guest_amd64_helpers.c +++ b/VEX/priv/guest_amd64_helpers.c @@ -4820,8 +4820,6 @@ void LibVEX_GuestAMD64_initialise ( /*OUT*/VexGuestAMD64State* vex_state ) vex_state->guest_EMNOTE = EmNote_NONE; - vex_state->guest_SETC = 0; - /* These should not ever be either read or written, but we initialise them anyway. */ vex_state->guest_CMSTART = 0; diff --git a/VEX/priv/guest_x86_helpers.c b/VEX/priv/guest_x86_helpers.c index 90722d767..f744ff53e 100644 --- a/VEX/priv/guest_x86_helpers.c +++ b/VEX/priv/guest_x86_helpers.c @@ -2914,8 +2914,6 @@ void LibVEX_GuestX86_initialise ( /*OUT*/VexGuestX86State* vex_state ) vex_state->guest_SC_CLASS = 0; vex_state->guest_IP_AT_SYSCALL = 0; - vex_state->guest_SETC = 0; - vex_state->padding1 = 0; vex_state->padding2 = 0; } diff --git a/VEX/pub/libvex_guest_amd64.h b/VEX/pub/libvex_guest_amd64.h index e96b6b0f3..1e2ca5dc6 100644 --- a/VEX/pub/libvex_guest_amd64.h +++ b/VEX/pub/libvex_guest_amd64.h @@ -131,10 +131,7 @@ typedef /* Emulation notes */ UInt guest_EMNOTE; - /* Used by Darwin and FreeBSD when setting the carry flag from - * ML_(do_syscall_for_client_WRK). Needed to determine how - * to restart interrupted syscalls. */ - UInt guest_SETC; + UInt pad2; /* Translation-invalidation area description. Not used on amd64 (there is no invalidate-icache insn), but needed so as to diff --git a/VEX/pub/libvex_guest_arm64.h b/VEX/pub/libvex_guest_arm64.h index 30317dae6..35b417348 100644 --- a/VEX/pub/libvex_guest_arm64.h +++ b/VEX/pub/libvex_guest_arm64.h @@ -168,18 +168,12 @@ typedef /* Used for FreeBSD syscall dispatching. */ ULong guest_SC_CLASS; - /* Used for FreeBSD client syscall when putting the carry flag - value into VEX. */ - UInt guest_SETC; - UInt pad_end_0; /* Padding to make it have an 16-aligned size */ - /* UInt pad_end_1; */ - /* ULong pad_end_2; */ + ULong pad_end_1; } VexGuestARM64State; - /*---------------------------------------------------------------*/ /*--- Utility functions for ARM64 guest stuff. ---*/ /*---------------------------------------------------------------*/ diff --git a/VEX/pub/libvex_guest_x86.h b/VEX/pub/libvex_guest_x86.h index 80916a2ba..baf13f402 100644 --- a/VEX/pub/libvex_guest_x86.h +++ b/VEX/pub/libvex_guest_x86.h @@ -219,11 +219,10 @@ typedef been interrupted by a signal. */ UInt guest_IP_AT_SYSCALL; - UInt guest_SETC; - /* Padding to make it have an 16-aligned size */ UInt padding1; UInt padding2; + UInt padding3; } VexGuestX86State; diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c index 64fa3c325..49c264c40 100644 --- a/coregrind/m_syswrap/syswrap-main.c +++ b/coregrind/m_syswrap/syswrap-main.c @@ -3355,18 +3355,6 @@ VG_(fixup_guest_state_after_syscall_interrupted)( ThreadId tid, # error "Unknown OS" # endif -#if defined(VGO_freebsd) || defined(VGO_darwin) - if (outside_range) - { - if (th_regs->vex.guest_SETC) - { - outside_range = False; - in_complete_to_committed = True; - } - } -#endif - - /* Figure out what the state of the syscall was by examining the (real) IP at the time of the signal, and act accordingly. */ if (outside_range) { -- 2.47.3