X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/8964aa089c709fbf370be623d75a204480b26b3c..e7ff015817107dbac9373c19ce851178e4f3c791:/Trampoline.t.cpp?ds=inline diff --git a/Trampoline.t.cpp b/Trampoline.t.cpp index 0ae088d..7c6b388 100644 --- a/Trampoline.t.cpp +++ b/Trampoline.t.cpp @@ -196,14 +196,14 @@ void *Routine(void *arg) { void *(*$dlsym)(void *, const char *); cyset($dlsym, "_dlsym", dyld); - void (*CYHandleServer)(pid_t); - CYHandleServer = reinterpret_cast($dlsym(handle, "CYHandleServer")); + void (*CYHandleServer)(pid_t, char *, size_t); + CYHandleServer = reinterpret_cast($dlsym(handle, "CYHandleServer")); if (CYHandleServer == NULL) { $strlcpy(baton->error, $dlerror(), sizeof(baton->error)); return NULL; } - CYHandleServer(baton->pid); + CYHandleServer(baton->pid, baton->error, sizeof(baton->error)); return NULL; } @@ -219,11 +219,11 @@ extern "C" void Start(Baton *baton) { if (pthread == NULL) pthread = Library(baton, "/usr/lib/libSystem.B.dylib"); - void (*$__pthread_set_self)(pthread_t); + void (*$__pthread_set_self)(void **); cyset($__pthread_set_self, "___pthread_set_self", pthread); self.tsd[0] = &self; - $__pthread_set_self(&self); + $__pthread_set_self(&self.tsd[0]); int (*$pthread_attr_init)(pthread_attr_t *); cyset($pthread_attr_init, "_pthread_attr_init", pthread); @@ -251,24 +251,6 @@ extern "C" void Start(Baton *baton) { $pthread_attr_destroy(&attr); #endif -#if defined(__arm__) || defined(__arm64__) - uintptr_t tpid; -#if defined(__arm__) - __asm__ ("mrc p15, 0, %0, c13, c0, 3\n" : "=r" (tpid)); -#elif defined(__arm64__) - __asm__ ("mrs %0, tpidrro_el0\n" : "=r" (tpid)); -#else -#error XXX -#endif - - void **tsd; - tsd = reinterpret_cast(tpid & ~3); - if (tsd != NULL) - tsd[0] = &self; -#else - _pthread_setspecific_direct(0, &self); -#endif - int (*$pthread_join)(pthread_t, void **); cyset($pthread_join, "_pthread_join", pthread);