4 #if __arm || __arm64 || __arch64
6 static int isThumb32(
ut16 op) {
7 return (((
op & 0xE000) == 0xE000) && (
op & 0x1800));
10 static bool ios_hwstep_enable64(
RzDebug *
dbg,
bool enable) {
12 thread_t th = getcurthread(
dbg,
NULL);
14 mach_msg_type_number_t
count = ARM_DEBUG_STATE64_COUNT;
15 if (thread_get_state(th, ARM_DEBUG_STATE64, (thread_state_t)&ds, &
count)) {
16 perror(
"thread-get-state");
28 ds.mdscr_el1 &= ~(1ULL);
30 if (thread_set_state(th, ARM_DEBUG_STATE64, (thread_state_t)&ds,
count)) {
31 perror(
"thread-set-state");
36 static bool ios_hwstep_enable32(
RzDebug *
dbg,
bool enable) {
37 mach_msg_type_number_t
count;
38 arm_unified_thread_state_t
state = { { 0 } };
39 _STRUCT_ARM_DEBUG_STATE ds;
41 thread_t th = getcurthread(
dbg, &task);
44 count = ARM_DEBUG_STATE32_COUNT;
45 ret = thread_get_state(th, ARM_DEBUG_STATE32, (thread_state_t)&ds, &
count);
46 if (ret != KERN_SUCCESS) {
47 perror(
"thread_get_state(debug)");
50 count = ARM_UNIFIED_THREAD_STATE_COUNT;
51 ret = thread_get_state(th, ARM_UNIFIED_THREAD_STATE, (thread_state_t)&
state, &
count);
52 if (ret != KERN_SUCCESS) {
53 perror(
"thread_get_state(unified)");
61 for (
i = 0;
i < 16;
i++) {
62 ds.__bcr[
i] = ds.__bvr[
i] = 0;
66 ds.__bcr[
i] = BCR_M_IMVA_MISMATCH | S_USER | BCR_ENABLE;
70 ds.__bcr[
i] |= BAS_IMVA_2_3;
72 ds.__bcr[
i] |= BAS_IMVA_0_1;
77 eprintf(
"Thumb32 chain stepping not supported yet\n");
79 ds.__bcr[
i] |= BAS_IMVA_ALL;
82 ds.__bcr[
i] |= BAS_IMVA_ALL;
85 if (thread_set_state(th, ARM_DEBUG_STATE32, (thread_state_t)&ds, ARM_DEBUG_STATE32_COUNT)) {
86 perror(
"ios_hwstep_enable32");
92 bool xnu_native_hwstep_enable(
RzDebug *
dbg,
bool enable) {
94 return ios_hwstep_enable64(
dbg, enable);
96 return ios_hwstep_enable32(
dbg, enable);
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count