From 4f6ca13404f6cd49e294b097f3da71de575c58d8 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Thu, 22 Jul 2010 08:47:19 +0000 Subject: [PATCH] Add a fix equivalent to r10751 for amd64-darwin: Resync after {wq,p}thread_hijack rather than merely doing a check. Also, some whitespace changes that make it easier to diff by eye relative to the x86-darwin versions. "Fixes" the problem reported at https://bugs.kde.org/show_bug.cgi?id=205241#c74 git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11223 --- coregrind/m_syswrap/syswrap-amd64-darwin.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-amd64-darwin.c b/coregrind/m_syswrap/syswrap-amd64-darwin.c index b84f42057b..27422e51d1 100644 --- a/coregrind/m_syswrap/syswrap-amd64-darwin.c +++ b/coregrind/m_syswrap/syswrap-amd64-darwin.c @@ -331,12 +331,13 @@ void pthread_hijack(Addr self, Addr kport, Addr func, Addr func_arg, VKI_PROT_READ|VKI_PROT_WRITE, VKI_MAP_PRIVATE, -1, 0); // guard page ML_(notify_core_and_tool_of_mmap)( - stack-VKI_PAGE_SIZE, VKI_PAGE_SIZE, 0, VKI_MAP_PRIVATE, -1, 0); + stack-VKI_PAGE_SIZE, VKI_PAGE_SIZE, + 0, VKI_MAP_PRIVATE, -1, 0); } else { // client allocated stack find_stack_segment(tst->tid, sp); } - VG_(am_do_sync_check)("after", "pthread_hijack", 0); + ML_(sync_mappings)("after", "pthread_hijack", 0); // Tell parent thread's POST(sys_bsdthread_create) that we're done // initializing registers and mapping memory. @@ -446,7 +447,6 @@ void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem, ML_(wqthread_continue_NORETURN)(tst->tid); } else { - // Record thread's stack and Mach port and pthread struct tst->os_state.pthread = self; tst->os_state.lwpid = kport; @@ -470,9 +470,10 @@ void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem, // guard page // GrP fixme ban_mem_stack! ML_(notify_core_and_tool_of_mmap)( - stack-VKI_PAGE_SIZE, VKI_PAGE_SIZE, 0, VKI_MAP_PRIVATE, -1, 0); + stack-VKI_PAGE_SIZE, VKI_PAGE_SIZE, + 0, VKI_MAP_PRIVATE, -1, 0); - VG_(am_do_sync_check)("after", "wqthread_hijack", 0); + ML_(sync_mappings)("after", "wqthread_hijack", 0); // Go! /* Same comments as the 'release' in the then-clause. -- 2.47.2