mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
For no apparent reason, the machine-dependent syscall
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
This commit is contained in:
parent
cd689f75c5
commit
2314fe1acc
@ -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>
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
/* ------------------------------------ */
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user