/* For whatever reason, tst->os_state.pthread appear to have a
constant offset of 96 on 10.7, but zero on 10.6 and 10.5. No
idea why. */
-# if DARWIN_VERS <= DARWIN_10_6
+# if DARWIN_VERS <= DARWIN_10_6 || DARWIN_VERS == DARWIN_10_13
UWord magic_delta = 0;
# elif DARWIN_VERS == DARWIN_10_7 || DARWIN_VERS == DARWIN_10_8
UWord magic_delta = 0x60;
# elif DARWIN_VERS == DARWIN_10_9 \
|| DARWIN_VERS == DARWIN_10_10 \
|| DARWIN_VERS == DARWIN_10_11 \
- || DARWIN_VERS == DARWIN_10_12 \
- || DARWIN_VERS == DARWIN_10_13
+ || DARWIN_VERS == DARWIN_10_12
UWord magic_delta = 0xE0;
# else
# error "magic_delta: to be computed on new OS version"
vex->guest_R8 = reuse;
vex->guest_R9 = 0;
vex->guest_RSP = sp;
+#if DARWIN_VERS >= DARWIN_10_12
+ vex->guest_GS_CONST = self + pthread_tsd_offset;
+#endif
stacksize = 512*1024; // wq stacks are always DEFAULT_STACK_SIZE
stack = VG_PGROUNDUP(sp) - stacksize;
pthread_starter = ARG1;
wqthread_starter = ARG2;
pthread_structsize = ARG3;
- #if DARWIN_VERS >= DARWIN_10_12
- typedef struct {
+#if DARWIN_VERS >= DARWIN_10_12
+ typedef struct {
uint64_t version;
uint64_t dispatch_queue_offset;
uint64_t main_qos;
uint32_t tsd_offset;
uint32_t return_to_kernel_offset;
uint32_t mach_thread_self_offset;
- } __attribute__ ((packed)) _pthread_registration_data;
+ } __attribute__ ((packed)) _pthread_registration_data;
- pthread_tsd_offset = ((_pthread_registration_data*) ARG4)->tsd_offset;
- #endif
+ pthread_tsd_offset = ((_pthread_registration_data*) ARG4)->tsd_offset;
+#endif
ARG1 = (Word)&pthread_hijack_asm;
ARG2 = (Word)&wqthread_hijack_asm;
}
// GrP fixme need anything here?
// GrP fixme may block?
break;
+ case VKI_WQOPS_THREAD_KEVENT_RETURN:
case VKI_WQOPS_THREAD_RETURN: {
// The interesting case. The kernel will do one of two things:
// 1. Return normally. We continue; libc proceeds to stop the thread.
// JRS uh, looks like it queues up a bunch of threads, or some such?
*flags |= SfMayBlock; // the kernel sources take a spinlock, so play safe
break;
- case VKI_WQOPS_THREAD_KEVENT_RETURN:
- // RK fixme need anything here?
- // perhaps similar to VKI_WQOPS_THREAD_RETURN above?
- break;
case VKI_WQOPS_SET_EVENT_MANAGER_PRIORITY:
// RK fixme this just sets scheduling priorities - don't think we need
// to do anything here
/* Otherwise handle normally */
*flags |= SfMayBlock;
}
+
POST(openat_nocancel)
{
vg_assert(SUCCESS);