X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/d336c0247563c5a1a95fb205386945fc76251e7e..aa82b83bc1cf1a31523f5ca3e3c7e44b34c8d72c:/Mach/Inject.cpp?ds=inline

diff --git a/Mach/Inject.cpp b/Mach/Inject.cpp
index ec1f1f5..8679e03 100644
--- a/Mach/Inject.cpp
+++ b/Mach/Inject.cpp
@@ -1,5 +1,5 @@
 /* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2010  Jay Freeman (saurik)
+ * Copyright (C) 2009-2012  Jay Freeman (saurik)
 */
 
 /* GNU Lesser General Public License, Version 3 {{{ */
@@ -22,7 +22,7 @@
 #include <dlfcn.h>
 #include <mach/mach.h>
 
-#include <mach/i386/thread_status.h>
+#include <mach/machine/thread_status.h>
 
 #include <cstdio>
 #include <pthread.h>
@@ -47,6 +47,10 @@ void InjectLibrary(pid_t pid) {
     Baton *baton(reinterpret_cast<Baton *>(local));
 
     baton->__pthread_set_self = &__pthread_set_self;
+    baton->pthread_create = &pthread_create;
+
+    baton->mach_thread_self = &mach_thread_self;
+    baton->thread_terminate = &thread_terminate;
 
     baton->dlerror = &dlerror;
     baton->dlsym = &dlsym;
@@ -75,7 +79,7 @@ void InjectLibrary(pid_t pid) {
     Trampoline *trampoline;
 
 #if defined(__arm__)
-    trampoline = &Trampoline_arm_;
+    trampoline = &Trampoline_armv6_;
     arm_thread_state_t state;
     flavor = ARM_THREAD_STATE;
     count = ARM_THREAD_STATE_COUNT;
@@ -117,13 +121,13 @@ void InjectLibrary(pid_t pid) {
     _assert(count == count);
 
 #if defined(__arm__)
-    state.r[0] = data;
-    state.sp = stack + Stack_;
-    state.pc = code + trampoline->entry_;
+    state.__r[0] = data;
+    state.__sp = stack + Stack_;
+    state.__pc = code + trampoline->entry_;
 
-    if ((state.pc & 0x1) != 0) {
-        state.pc &= ~0x1;
-        state.cpsr |= 0x20;
+    if ((state.__pc & 0x1) != 0) {
+        state.__pc &= ~0x1;
+        state.__cpsr |= 0x20;
     }
 #elif defined(__i386__)
     frame[1] = data;