]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
For no apparent reason, the machine-dependent syscall
authorNicholas Nethercote <njn@valgrind.org>
Fri, 5 Jun 2009 01:33:16 +0000 (01:33 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Fri, 5 Jun 2009 01:33:16 +0000 (01:33 +0000)
thread_fast_set_cthread_self was being called pthread_set_self.  This commit
fixes this.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10249

coregrind/m_syswrap/priv_syswrap-darwin.h
coregrind/m_syswrap/syswrap-darwin.c
coregrind/m_syswrap/syswrap-main.c
exp-ptrcheck/h_main.c
include/vki/vki-scnums-darwin.h

index bc8570625ea8d45fcc5d1ff9a7f374df35d57bd1..6dd8cb344bbb3d3977c4604b124af8a055b891e2 100644 (file)
@@ -241,7 +241,7 @@ DECL_TEMPLATE(darwin, swtch);
 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>
index 49b8a9a6b6294ad2afd37601507f52a6df7f2a38..20d665f0f5e587544a24261831546d5a3f8c064b 100644 (file)
@@ -6873,13 +6873,12 @@ static VexGuestX86SegDescr* alloc_zeroed_x86_LDT ( void )
 }
 #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 @@ PRE(pthread_set_self)
       // 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 @@ PRE(pthread_set_self)
       // 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 @@ const SyscallTableEntry ML_(mach_trap_table)[] = {
 
 #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
index 5cd70b7f5aff477705c46fadb077836683fc23b9..11f56ec600cf1ab39d8c212ad94a4c96213aa188 100644 (file)
@@ -1622,9 +1622,9 @@ void VG_(post_syscall) (ThreadId tid)
       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
index fccefe162df6ee3fef7fb27e531833f53ad010c3..c2c2aa3dba1892fb4f1cfce9c39f44690e8f1414 100644 (file)
@@ -2461,7 +2461,7 @@ static void setup_post_syscall_table ( void )
       ADD(0, __NR_task_self_trap);
 
       // Machine-dependent syscalls.
-      ADD(0, __NR_pthread_set_self);
+      ADD(0, __NR_thread_fast_set_cthread_self);
 
    /* ------------------------------------ */
 
index 8046542b08e9d66f534c3ba0b94b292a93fec86f..4dfd22ae25fbb6dcccc0239b849e623a31a0646d 100644 (file)
 #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