|
From: <sv...@va...> - 2009-06-05 02:28:52
|
Author: njn
Date: 2009-06-05 02:33:16 +0100 (Fri, 05 Jun 2009)
New Revision: 10249
Log:
For no apparent reason, the machine-dependent syscall
thread_fast_set_cthread_self was being called pthread_set_self. This commit
fixes this.
Modified:
trunk/coregrind/m_syswrap/priv_syswrap-darwin.h
trunk/coregrind/m_syswrap/syswrap-darwin.c
trunk/coregrind/m_syswrap/syswrap-main.c
trunk/exp-ptrcheck/h_main.c
trunk/include/vki/vki-scnums-darwin.h
Modified: trunk/coregrind/m_syswrap/priv_syswrap-darwin.h
===================================================================
--- trunk/coregrind/m_syswrap/priv_syswrap-darwin.h 2009-06-04 23:17:12 UTC (rev 10248)
+++ trunk/coregrind/m_syswrap/priv_syswrap-darwin.h 2009-06-05 01:33:16 UTC (rev 10249)
@@ -241,7 +241,7 @@
DECL_TEMPLATE(darwin, swtch_pri);
// Machine-dependent traps
-DECL_TEMPLATE(darwin, pthread_set_self);
+DECL_TEMPLATE(darwin, thread_fast_set_cthread_self);
// syswrap-<arch>-darwin.c
#include <mach/mach.h>
Modified: trunk/coregrind/m_syswrap/syswrap-darwin.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-darwin.c 2009-06-04 23:17:12 UTC (rev 10248)
+++ trunk/coregrind/m_syswrap/syswrap-darwin.c 2009-06-05 01:33:16 UTC (rev 10249)
@@ -6873,13 +6873,12 @@
}
#endif
-PRE(pthread_set_self)
+PRE(thread_fast_set_cthread_self)
{
- PRINT("pthread_set_self ( %#lx )", ARG1);
- PRE_REG_READ1(void, "pthread_set_self", struct pthread_t *, self);
+ PRINT("thread_fast_set_cthread_self ( %#lx )", ARG1);
+ PRE_REG_READ1(void, "thread_fast_set_cthread_self", struct pthread_t *, self);
#if defined(VGA_x86)
- // GrP fixme hack this isn't really pthread_set_self
// Point the USER_CTHREAD ldt entry (slot 6, reg 0x37) at this pthread
{
VexGuestX86SegDescr *ldt;
@@ -6912,7 +6911,7 @@
// and use that to set the syscall return status.
SET_STATUS_from_SysRes(
VG_(mk_SysRes_x86_darwin)(
- VG_DARWIN_SYSNO_CLASS(__NR_pthread_set_self),
+ VG_DARWIN_SYSNO_CLASS(__NR_thread_fast_set_cthread_self),
False, 0, 0x37
)
);
@@ -6928,7 +6927,7 @@
// see comments on x86 case just above
SET_STATUS_from_SysRes(
VG_(mk_SysRes_amd64_darwin)(
- VG_DARWIN_SYSNO_CLASS(__NR_pthread_set_self),
+ VG_DARWIN_SYSNO_CLASS(__NR_thread_fast_set_cthread_self),
False, 0, 0x60
)
);
@@ -7524,11 +7523,11 @@
#if defined(VGA_x86)
const SyscallTableEntry ML_(mdep_trap_table)[] = {
- MACX_(__NR_pthread_set_self, pthread_set_self),
+ MACX_(__NR_thread_fast_set_cthread_self, thread_fast_set_cthread_self),
};
#elif defined(VGA_amd64)
const SyscallTableEntry ML_(mdep_trap_table)[] = {
- MACX_(__NR_pthread_set_self, pthread_set_self),
+ MACX_(__NR_thread_fast_set_cthread_self, thread_fast_set_cthread_self),
};
#else
#error unknown architecture
Modified: trunk/coregrind/m_syswrap/syswrap-main.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-main.c 2009-06-04 23:17:12 UTC (rev 10248)
+++ trunk/coregrind/m_syswrap/syswrap-main.c 2009-06-05 01:33:16 UTC (rev 10249)
@@ -1622,9 +1622,9 @@
when they really should call SET_STATUS_from_SysRes. The former
create a UNIX-class syscall result on Darwin, which may not be
correct for the syscall; if that's the case then this assertion
- fires. See PRE(pthread_set_self) for an example. On non-Darwin
- platforms this assertion is should never fail, and this comment
- is completely irrelevant. */
+ fires. See PRE(thread_fast_set_cthread_self) for an example. On
+ non-Darwin platforms this assertion is should never fail, and this
+ comment is completely irrelevant. */
/* Ok, looks sane */
/* Get the system call number. Because the pre-handler isn't
Modified: trunk/exp-ptrcheck/h_main.c
===================================================================
--- trunk/exp-ptrcheck/h_main.c 2009-06-04 23:17:12 UTC (rev 10248)
+++ trunk/exp-ptrcheck/h_main.c 2009-06-05 01:33:16 UTC (rev 10249)
@@ -2461,7 +2461,7 @@
ADD(0, __NR_task_self_trap);
// Machine-dependent syscalls.
- ADD(0, __NR_pthread_set_self);
+ ADD(0, __NR_thread_fast_set_cthread_self);
/* ------------------------------------ */
Modified: trunk/include/vki/vki-scnums-darwin.h
===================================================================
--- trunk/include/vki/vki-scnums-darwin.h 2009-06-04 23:17:12 UTC (rev 10248)
+++ trunk/include/vki/vki-scnums-darwin.h 2009-06-05 01:33:16 UTC (rev 10249)
@@ -116,18 +116,21 @@
#if defined(VGA_x86)
// osfmk/i386/machdep_call.c
-// # define __NR_thread_get_cthread_self VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(0)
-// # define __NR_thread_set_cthread_self VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(1)
-// # define __NR_2 VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(2)
-# define __NR_pthread_set_self VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(3)
-// # define __NR_thread_set_user_ldt VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(4)
-// # define __NR_i386_set_ldt VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(5)
-// # define __NR_i386_get_ldt VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(6)
+// DDD: the last two are BSD_CALL instead of CALL...
+//#define __NR_thread_get_cthread_self VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(0)
+//#define __NR_thread_set_cthread_self VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(1)
+// 2 is invalid
+#define __NR_thread_fast_set_cthread_self VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(3)
+//#define __NR_thread_set_user_ldt VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(4)
+//#define __NR_i386_set_ldt VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(5)
+//#define __NR_i386_get_ldt VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(6)
#elif defined(VGA_amd64)
// osfmk/i386/machdep_call.c
-# define __NR_pthread_set_self VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(3)
+// 0, 1, 2 are invalid
+#define __NR_thread_fast_set_cthread_self VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(3)
+// 4, 5, 6 are invalid
#else
# error unknown architecture
|