diff options
author | Yifan Lu | 2016-11-03 23:09:51 -0700 |
---|---|---|
committer | Yifan Lu | 2016-11-03 23:09:51 -0700 |
commit | d6ccfd36f805f98648afc785c29100dbfb50614e (patch) | |
tree | e6f8d527d7a0736cae6bc197ee2aadb05102cddb /lib | |
parent | Fixed extraction for BL/BLX thumb2 (diff) | |
download | substitute-d6ccfd36f805f98648afc785c29100dbfb50614e.tar.gz |
Made ARM patch alignment 0x4 so copy from kernel to user works
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arm/assemble.h | 2 | ||||
-rw-r--r-- | lib/arm/jump-patch.h | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/arm/assemble.h b/lib/arm/assemble.h index 2303a7a..625f464 100644 --- a/lib/arm/assemble.h +++ b/lib/arm/assemble.h @@ -108,4 +108,6 @@ static inline void LDR_PC(struct assemble_ctx ctx, uint32_t dpc) { else op32(ctx.codep, 0x051ff004 | ctx.cond << 28); op32(ctx.codep, (uint32_t) dpc); + if (ctx.pc & 2) // for alignment + op16(ctx.codep, 0xbf00); } diff --git a/lib/arm/jump-patch.h b/lib/arm/jump-patch.h index 8787070..8ba4c3a 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 8 +#define MAX_JUMP_PATCH_SIZE 12 #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) ? 10 : 8; + return (pc & 2) ? 12 : 8; } static inline void make_jump_patch(void **codep, uint_tptr pc, |