Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Oct 2009 17:33:29 GMT
From:      Stanislav Sedov <stas@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 169091 for review
Message-ID:  <200910011733.n91HXT7f047049@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910011733.n91HXT7f047049>