From owner-p4-projects@FreeBSD.ORG Thu Oct 1 17:33:29 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id AEEEE1065676; Thu, 1 Oct 2009 17:33:29 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73448106568B for ; Thu, 1 Oct 2009 17:33:29 +0000 (UTC) (envelope-from stas@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 485F68FC1E for ; Thu, 1 Oct 2009 17:33:29 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n91HXTME047051 for ; Thu, 1 Oct 2009 17:33:29 GMT (envelope-from stas@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n91HXT7f047049 for perforce@freebsd.org; Thu, 1 Oct 2009 17:33:29 GMT (envelope-from stas@freebsd.org) Date: Thu, 1 Oct 2009 17:33:29 GMT Message-Id: <200910011733.n91HXT7f047049@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to stas@freebsd.org using -f From: Stanislav Sedov To: Perforce Change Reviews Cc: Subject: PERFORCE change 169091 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2009 17:33:30 -0000 http://perforce.freebsd.org/chv.cgi?CH=169091 Change 169091 by stas@stas_yandex on 2009/10/01 17:33:04 - Fix one subtle error with pthread_exit/pthread_join. Before this change we were not passing the right argument value to thr_exit syscall and thus consumers sleeping on our wait channel were not awakened. Affected files ... .. //depot/projects/valgrind/coregrind/m_syswrap/syswrap-freebsd.c#44 edit Differences ... ==== //depot/projects/valgrind/coregrind/m_syswrap/syswrap-freebsd.c#44 (text+ko) ==== @@ -171,11 +171,11 @@ #if defined(VGP_x86_freebsd) /* FreeBSD has args on the stack */ asm volatile ( "movl %1, %0\n" /* set tst->status = VgTs_Empty */ - "movl %2, %%eax\n" /* set %eax = __NR_thr_exit */ - "leal %3, %%ebx\n" /* set %ebx = tst->os_state.exitcode */ + "movl %2, %%eax\n" /* set %eax = __NR_hr_exit */ + "movl %3, %%ebx\n" /* set %ebx = tst->os_state.exitcode */ "pushl %%ebx\n" /* arg on stack */ "pushl %%ebx\n" /* fake return address */ - "int $0x80\n" /* thr_exit(&tst->os_state.exitcode) */ + "int $0x80\n" /* thr_exit(tst->os_state.exitcode) */ "popl %%ebx\n" /* fake return address */ "popl %%ebx\n" /* arg off stack */ : "=m" (tst->status) @@ -184,9 +184,9 @@ asm volatile ( "movl %1, %0\n" /* set tst->status = VgTs_Empty */ "movq %2, %%rax\n" /* set %rax = __NR_thr_exit */ - "leaq %3, %%rdi\n" /* set %rdi = tst->os_state.exitcode */ + "movq %3, %%rdi\n" /* set %rdi = tst->os_state.exitcode */ "pushq %%rdi\n" /* fake return address */ - "syscall\n" /* thr_exit(&tst->os_state.exitcode) */ + "syscall\n" /* thr_exit(tst->os_state.exitcode) */ "popq %%rdi\n" /* fake return address */ : "=m" (tst->status) : "n" (VgTs_Empty), "n" (__NR_thr_exit), "m" (tst->os_state.exitcode)); @@ -1808,8 +1808,8 @@ PRE_MEM_WRITE( "thr_exit(status)", ARG1, sizeof(long) ); tst = VG_(get_ThreadState)(tid); tst->exitreason = VgSrc_ExitThread; - tst->os_state.exitcode = 0; - VG_(exit_thread)(tid); + tst->os_state.exitcode = ARG1; + SET_STATUS_Success(0); } PRE(sys_thr_set_name)