aboutsummaryrefslogtreecommitdiff
path: root/lib/arm/jump-patch.h
diff options
context:
space:
mode:
authorcomex2015-03-01 23:07:15 -0500
committercomex2015-03-01 23:07:15 -0500
commit7f24621bec0b0a5b3cab9ec2dfc68929a2d49d25 (patch)
tree7c227bfa4d8010e23b726eed8efb6bc51746e3f5 /lib/arm/jump-patch.h
parentseems to work (diff)
downloadsubstitute-7f24621bec0b0a5b3cab9ec2dfc68929a2d49d25.tar.gz
A number of critical fixes painstakingly discovered in the slowest way possible.
Diffstat (limited to 'lib/arm/jump-patch.h')
-rw-r--r--lib/arm/jump-patch.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/arm/jump-patch.h b/lib/arm/jump-patch.h
index b65a97d..8787070 100644
--- a/lib/arm/jump-patch.h
+++ b/lib/arm/jump-patch.h
@@ -2,17 +2,18 @@
#include "dis.h"
#include "arm/assemble.h"
#define MAX_JUMP_PATCH_SIZE 8
+#define MAX_EXTENDED_PATCH_SIZE (MAX_JUMP_PATCH_SIZE+14)
-static inline int jump_patch_size(UNUSED uintptr_t pc,
- UNUSED uintptr_t dpc,
+static inline int jump_patch_size(uint_tptr pc,
+ UNUSED uint_tptr dpc,
UNUSED struct arch_dis_ctx arch,
UNUSED bool force) {
- return 8;
+ return (pc & 2) ? 10 : 8;
}
-static inline void make_jump_patch(void **codep, UNUSED uintptr_t pc,
- uintptr_t dpc,
+static inline void make_jump_patch(void **codep, uint_tptr pc,
+ uint_tptr dpc,
struct arch_dis_ctx arch) {
- struct assemble_ctx actx = {codep, arch.pc_low_bit, 0xe};
+ struct assemble_ctx actx = {codep, pc, arch.pc_low_bit, 0xe};
LDR_PC(actx, dpc);
}