diff options
author | comex | 2015-02-14 23:14:14 -0500 |
---|---|---|
committer | comex | 2015-02-14 23:41:06 -0500 |
commit | 67ebaf0d22fefa885d29c3c697fbe61956d18354 (patch) | |
tree | f9d3f5395054e8eca4292b344b03b4c97f3fa3ad /lib/arm | |
parent | test harness (diff) | |
download | substitute-67ebaf0d22fefa885d29c3c697fbe61956d18354.tar.gz |
Trampoline fixes.
The transformed code was incorrect because it assumed the pointer it was
writing to was where the code would execute, but it was actually
'rewritten_temp'. Changed transform_dis_main to take a pc_trampoline
pointer, which also helps the test harness. However, this means that it
has to be called after the trampoline has been allocated, while before
the trampoline allocation depended on the generated size; this change
doesn't bother to use two passes or anything, but just allocates a new
code buffer if the maximum possible size isn't available - not the end
of the world, since trampoline_ptr will still only be increased by the
actual size before the next hook in the series (if any).
Diffstat (limited to 'lib/arm')
-rw-r--r-- | lib/arm/arch-dis.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/arm/arch-dis.h b/lib/arm/arch-dis.h index bc98cb9..8f2400b 100644 --- a/lib/arm/arch-dis.h +++ b/lib/arm/arch-dis.h @@ -39,6 +39,10 @@ static inline void arch_dis_ctx_init(struct arch_dis_ctx *ctx) { memset(ctx->it_conds, 0xe, 5); } +static inline int arch_code_alignment(struct arch_dis_ctx ctx) { + return ctx.pc_low_bit ? 2 : 4; +} + static inline void advance_it_cond(struct arch_dis_ctx *ctx) { ctx->it_conds[0] = ctx->it_conds[1]; ctx->it_conds[1] = ctx->it_conds[2]; |