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>
}
#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;
// 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
)
);
// 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
)
);
#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
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
ADD(0, __NR_task_self_trap);
// Machine-dependent syscalls.
- ADD(0, __NR_pthread_set_self);
+ ADD(0, __NR_thread_fast_set_cthread_self);
/* ------------------------------------ */
#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