/* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2010 Jay Freeman (saurik)
+ * Copyright (C) 2009-2013 Jay Freeman (saurik)
*/
-/* GNU Lesser General Public License, Version 3 {{{ */
+/* GNU General Public License, Version 3 {{{ */
/*
- * Cycript is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your
- * option) any later version.
+ * Cycript is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
*
- * Cycript is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
+ * Cycript is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public License
+ * You should have received a copy of the GNU General Public License
* along with Cycript. If not, see <http://www.gnu.org/licenses/>.
**/
/* }}} */
#include <dlfcn.h>
#include <mach/mach.h>
-#include <mach/i386/thread_status.h>
+#include <mach/machine/thread_status.h>
#include <cstdio>
#include <pthread.h>
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;
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;
mach_msg_type_number_t read(count);
_krncall(thread_get_state(thread, flavor, reinterpret_cast<thread_state_t>(&state), &read));
- _assert(count == count);
+ _assert(read == 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;