diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arm/assemble.h | 7 | ||||
-rw-r--r-- | lib/arm/jump-patch.h | 4 |
2 files changed, 5 insertions, 6 deletions
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) { diff --git a/lib/arm/jump-patch.h b/lib/arm/jump-patch.h index 361e357..5dd7d18 100644 --- a/lib/arm/jump-patch.h +++ b/lib/arm/jump-patch.h @@ -1,14 +1,14 @@ #pragma once #include "dis.h" #include "arm/assemble.h" -#define MAX_JUMP_PATCH_SIZE 12 +#define MAX_JUMP_PATCH_SIZE 10 #define MAX_EXTENDED_PATCH_SIZE (MAX_JUMP_PATCH_SIZE+14) static inline int jump_patch_size(uint_tptr pc, UNUSED uint_tptr dpc, UNUSED struct arch_dis_ctx arch, UNUSED bool force) { - return (pc & 2) ? 12 : 8; + return (pc & 2) ? 10 : 8; } static inline void make_jump_patch(void **codep, uint_tptr pc, |