From 6c94f57ea902001efa0a89617e9bc98891ca8009 Mon Sep 17 00:00:00 2001 From: Reiko Asakura Date: Sun, 21 Mar 2021 15:12:30 -0400 Subject: Align Thumb jump patch to halfword boundary No need to align to word boundary. --- lib/arm/assemble.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/arm/assemble.h') diff --git a/lib/arm/assemble.h b/lib/arm/assemble.h index 91b273e..4c25527 100644 --- a/lib/arm/assemble.h +++ b/lib/arm/assemble.h @@ -120,16 +120,15 @@ static inline void Bccrel(struct assemble_ctx ctx, int offset) { } static inline void LDR_PC(struct assemble_ctx ctx, uint32_t dpc) { - int align = !!(actx_pc(ctx) & 2); - if (align) + if (actx_pc(ctx) & 2) { + substitute_assert(ctx.thumb); 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 (align) - op16(ctx.codep, 0xbf00); } static inline void ADD_PC(struct assemble_ctx ctx, uint32_t Rd, uint32_t imm12) { -- cgit v1.2.3