From 98afb15eaa8f8c31bf5763de0e3c83a845414b0a Mon Sep 17 00:00:00 2001 From: comex Date: Sat, 24 Jan 2015 21:59:37 -0500 Subject: ... --- lib/arm/jump-patch.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lib/arm/jump-patch.h (limited to 'lib/arm/jump-patch.h') diff --git a/lib/arm/jump-patch.h b/lib/arm/jump-patch.h new file mode 100644 index 0000000..b19e90f --- /dev/null +++ b/lib/arm/jump-patch.h @@ -0,0 +1,18 @@ +#pragma once +#include "dis.h" +#define MAX_JUMP_PATCH_SIZE 8 +#define MAX_REWRITTEN_SIZE (12 * 4) /* actually should be less */ + +static inline int jump_patch_size(uintptr_t pc, uintptr_t dpc, + struct arch_dis_ctx arch) { + return 8; +} + +static inline void make_jump_patch(void **codep, uintptr_t pc, uintptr_t dpc, + struct arch_dis_ctx arch) { + if (arch.pc_low_bit) + op32(codep, 0xf000f8df); + else + op32(codep, 0xe51ff004); + op32(codep, (uint32_t) pc); +} -- cgit v1.2.3