From 67ebaf0d22fefa885d29c3c697fbe61956d18354 Mon Sep 17 00:00:00 2001 From: comex Date: Sat, 14 Feb 2015 23:14:14 -0500 Subject: Trampoline fixes. The transformed code was incorrect because it assumed the pointer it was writing to was where the code would execute, but it was actually 'rewritten_temp'. Changed transform_dis_main to take a pc_trampoline pointer, which also helps the test harness. However, this means that it has to be called after the trampoline has been allocated, while before the trampoline allocation depended on the generated size; this change doesn't bother to use two passes or anything, but just allocates a new code buffer if the maximum possible size isn't available - not the end of the world, since trampoline_ptr will still only be increased by the actual size before the next hook in the series (if any). --- lib/transform-dis.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/transform-dis.h') diff --git a/lib/transform-dis.h b/lib/transform-dis.h index c1de937..4e853b0 100644 --- a/lib/transform-dis.h +++ b/lib/transform-dis.h @@ -7,5 +7,6 @@ int transform_dis_main(const void *restrict code_ptr, void **restrict rewritten_ptr_ptr, uint_tptr pc_patch_start, uint_tptr *pc_patch_end_p, + uint_tptr pc_trampoline, struct arch_dis_ctx *arch_ctx_p, int *offset_by_pcdiff); -- cgit v1.2.3