aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYifan Lu2016-11-23 17:25:19 -0600
committerYifan Lu2016-11-23 17:25:19 -0600
commitbbfc407fd6cb437c9cc720de1f4dfbb9050dccd4 (patch)
treeba915dfbb0ed068adcc5c9574fdc2436d7a4845a
parentFixed defination of CC_CBXZ collides with other bits (diff)
downloadsubstitute-bbfc407fd6cb437c9cc720de1f4dfbb9050dccd4.tar.gz
Changes to reflect older changes in merge
-rw-r--r--lib/arm/assemble.h5
-rw-r--r--lib/substitute.h8
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/arm/assemble.h b/lib/arm/assemble.h
index 3066802..91b273e 100644
--- a/lib/arm/assemble.h
+++ b/lib/arm/assemble.h
@@ -120,14 +120,15 @@ static inline void Bccrel(struct assemble_ctx ctx, int offset) {
}
static inline void LDR_PC(struct assemble_ctx ctx, uint32_t dpc) {
- if (actx_pc(ctx) & 2)
+ int align = !!(actx_pc(ctx) & 2);
+ if (align)
op16(ctx.codep, 0xbf00);
if (ctx.thumb)
op32(ctx.codep, 0xf000f8df);
else
op32(ctx.codep, 0x051ff004 | ctx.cond << 28);
op32(ctx.codep, (uint32_t) dpc);
- if (ctx.pc & 2) // for alignment
+ if (align)
op16(ctx.codep, 0xbf00);
}
diff --git a/lib/substitute.h b/lib/substitute.h
index 023a728..3f5b191 100644
--- a/lib/substitute.h
+++ b/lib/substitute.h
@@ -116,12 +116,12 @@ struct substitute_function_hook_record {
};
/* substitute_hook_functions options */
-#ifndef NO_PTHREADS
enum {
- SUBSTITUTE_NO_THREAD_SAFETY = 1,
- SUBSTITUTE_RELAXED = 2,
-};
+#ifndef NO_PTHREADS
+ SUBSTITUTE_NO_THREAD_SAFETY = 1,
#endif
+ SUBSTITUTE_RELAXED = 2,
+};
/* Patch the machine code of the specified functions to redirect them to the
* specified replacements.