+ switch (info.all_image_info_format) {
+ case TASK_DYLD_ALL_IMAGE_INFO_32:
+ bottom = reinterpret_cast<thread_state_t>(&state.ts_32);
+ flavor = ARM_THREAD_STATE;
+ count = ARM_THREAD_STATE_COUNT;
+ state.ash.flavor = ARM_THREAD_STATE32;
+ break;
+ case TASK_DYLD_ALL_IMAGE_INFO_64:
+ bottom = reinterpret_cast<thread_state_t>(&state.ts_64);
+ flavor = ARM_THREAD_STATE64;
+ count = ARM_THREAD_STATE64_COUNT + 1;
+ state.ash.flavor = ARM_THREAD_STATE64;
+ break;
+ default:
+ _assert(false);
+ }
+#else
+ #error XXX: implement
+#endif
+
+ mach_msg_type_number_t read(count);
+ _krncall(thread_get_state(thread, flavor, bottom, &read));
+ _assert(read == count);
+
+ Trampoline *trampoline;
+ size_t align;
+ size_t push;
+
+#if defined(__i386__) || defined(__x86_64__)
+ switch (state.tsh.flavor) {
+ case i386_THREAD_STATE:
+ trampoline = &Trampoline_i386_;
+ align = 4;
+ push = 5;
+ break;
+ case x86_THREAD_STATE64:
+ trampoline = &Trampoline_x86_64_;
+ align = 8;
+ push = 2;
+ break;
+ default:
+ _assert(false);
+ }
+#elif defined(__arm__) || defined(__arm64__)
+ switch (state.ash.flavor) {
+ case ARM_THREAD_STATE32:
+ trampoline = &Trampoline_armv6_;
+ align = 4;
+ push = 0;
+ break;
+ case ARM_THREAD_STATE64:
+ trampoline = &Trampoline_arm64_;
+ align = 8;
+ push = 0;
+ break;
+ default:
+ _assert(false);
+ }
+#else
+ #error XXX: implement
+#endif