diff options
author | comex | 2015-02-24 20:39:14 -0500 |
---|---|---|
committer | comex | 2015-02-24 20:39:14 -0500 |
commit | 24eddaa8240137328a0522eccf741e7868a2ee58 (patch) | |
tree | ef7915f83133d966ff8986d3ea41c640832d3d96 /lib/darwin | |
parent | Add transform-dis-cases-arm64.S and fix a serious bug thus discovered. (diff) | |
download | substitute-24eddaa8240137328a0522eccf741e7868a2ee58.tar.gz |
fix arm64/armv7 ish
Diffstat (limited to 'lib/darwin')
-rw-r--r-- | lib/darwin/execmem.c | 4 | ||||
-rw-r--r-- | lib/darwin/manual-syscall.h | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/darwin/execmem.c b/lib/darwin/execmem.c index 0155b1f..b142aff 100644 --- a/lib/darwin/execmem.c +++ b/lib/darwin/execmem.c @@ -115,7 +115,7 @@ static bool apply_one_pcp_with_state(native_thread_state *state, uintptr_t old = *pcp; #ifdef __arm__ /* thumb */ - if (state.cpsr & 0x20) + if (state->__cpsr & 0x20) old |= 1; #endif uintptr_t new = callback(ctx, *pcp); @@ -123,7 +123,7 @@ static bool apply_one_pcp_with_state(native_thread_state *state, *pcp = new; #ifdef __arm__ *pcp &= ~1; - state.cpsr = (state.cpsr & ~0x20) | ((new & 1) * 0x20); + state->__cpsr = (state->__cpsr & ~0x20) | ((new & 1) * 0x20); #endif return changed; } diff --git a/lib/darwin/manual-syscall.h b/lib/darwin/manual-syscall.h index 88ac179..f16ec54 100644 --- a/lib/darwin/manual-syscall.h +++ b/lib/darwin/manual-syscall.h @@ -3,10 +3,12 @@ #define GEN_SYSCALL(name, num) \ __asm__(".globl _manual_" #name "\n" \ ".pushsection __TEXT,__text,regular,pure_instructions\n" \ + GEN_SYSCALL_PRE(name) \ "_manual_" #name ":\n" \ ".set num, " #num "\n" \ GEN_SYSCALL_INNER() \ ".popsection\n") +#define GEN_SYSCALL_PRE(name) #if defined(__x86_64__) /* Look at me, I'm different! */ @@ -30,13 +32,18 @@ "sysenter\n" \ "1: ret\n" #elif defined(__arm__) +#ifdef __thumb__ +#undef GEN_SYSCALL_PRE +#define GEN_SYSCALL_PRE(name) \ + ".thumb_func _manual_" #name "\n" +#endif #define GEN_SYSCALL_INNER() \ "mov r12, #num\n" \ "svc #0x80\n" \ "bx lr\n" #elif defined(__arm64__) #define GEN_SYSCALL_INNER() \ - "mov x12, #num\n" \ + "mov x16, #num\n" \ "svc #0x80\n" \ "ret\n" #else |