From cfe176847416ea9f71ca1a4f53a9f113e969b3cc Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sat, 3 Sep 2011 20:21:25 +0000 Subject: [PATCH] Added a peek() helper and passing the base address through the "call" pointer --- include/Asm/arch.h | 4 ++-- include/Asm/asm.h | 2 ++ src/arch/dalvik.c | 6 ++---- src/arch/java.c | 6 ++---- src/arch/sparc.h | 6 ++---- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/include/Asm/arch.h b/include/Asm/arch.h index 7d41f42..49474c0 100644 --- a/include/Asm/arch.h +++ b/include/Asm/arch.h @@ -203,6 +203,7 @@ typedef struct _ArchPluginHelper ssize_t (*write)(Arch * arch, void const * buf, size_t size); /* disassembly */ + ssize_t (*peek)(Arch * arch, void * buf, size_t size); ssize_t (*read)(Arch * arch, void * buf, size_t size); off_t (*seek)(Arch * arch, off_t offset, int whence); } ArchPluginHelper; @@ -221,8 +222,7 @@ struct _ArchPlugin int (*write)(ArchPlugin * arch, ArchInstruction * instruction, ArchInstructionCall * call); - int (*decode)(ArchPlugin * arch, ArchInstructionCall * call, - off_t base); + int (*decode)(ArchPlugin * arch, ArchInstructionCall * call); }; #endif /* !DEVEL_ASM_ARCH_H */ diff --git a/include/Asm/asm.h b/include/Asm/asm.h index d106f04..ec6ab9f 100644 --- a/include/Asm/asm.h +++ b/include/Asm/asm.h @@ -101,6 +101,8 @@ int asm_close(Asm * a); /* assemble */ int asm_assemble(Asm * a, AsmPrefs * prefs, char const * infile, char const * outfile); +int asm_assemble_string(Asm * a, AsmPrefs * prefs, char const * outfile, + char const * string); int asm_open_assemble(Asm * a, char const * outfile); int asm_instruction(Asm * a, char const * name, unsigned int operands_cnt, ...); diff --git a/src/arch/dalvik.c b/src/arch/dalvik.c index 430327d..2837822 100644 --- a/src/arch/dalvik.c +++ b/src/arch/dalvik.c @@ -79,8 +79,7 @@ static ArchInstruction _dalvik_instructions[] = /* plug-in */ static int _dalvik_write(ArchPlugin * plugin, ArchInstruction * instruction, ArchInstructionCall * call); -static int _dalvik_decode(ArchPlugin * plugin, ArchInstructionCall * call, - off_t base); +static int _dalvik_decode(ArchPlugin * plugin, ArchInstructionCall * call); /* public */ @@ -139,8 +138,7 @@ static int _decode_immediate(DalvikDecode * dd, size_t i); static int _decode_operand(DalvikDecode * dd, size_t i); static int _decode_register(DalvikDecode * dd, size_t i); -static int _dalvik_decode(ArchPlugin * plugin, ArchInstructionCall * call, - off_t base) +static int _dalvik_decode(ArchPlugin * plugin, ArchInstructionCall * call) { DalvikDecode dd; ArchPluginHelper * helper = plugin->helper; diff --git a/src/arch/java.c b/src/arch/java.c index 20d9f86..b817b35 100644 --- a/src/arch/java.c +++ b/src/arch/java.c @@ -250,8 +250,7 @@ static ArchInstruction _java_instructions[] = /* plug-in */ static int _java_write(ArchPlugin * plugin, ArchInstruction * instruction, ArchInstructionCall * call); -static int _java_decode(ArchPlugin * plugin, ArchInstructionCall * call, - off_t base); +static int _java_decode(ArchPlugin * plugin, ArchInstructionCall * call); /* public */ @@ -318,8 +317,7 @@ static int _java_write(ArchPlugin * plugin, ArchInstruction * instruction, /* java_decode */ -static int _java_decode(ArchPlugin * plugin, ArchInstructionCall * call, - off_t base) +static int _java_decode(ArchPlugin * plugin, ArchInstructionCall * call) { ArchPluginHelper * helper = plugin->helper; uint8_t u8; diff --git a/src/arch/sparc.h b/src/arch/sparc.h index 894af70..ed3131b 100644 --- a/src/arch/sparc.h +++ b/src/arch/sparc.h @@ -22,8 +22,7 @@ /* private */ /* prototypes */ /* plug-in */ -static int _sparc_decode(ArchPlugin * plugin, ArchInstructionCall * call, - off_t base); +static int _sparc_decode(ArchPlugin * plugin, ArchInstructionCall * call); static int _sparc_write(ArchPlugin * plugin, ArchInstruction * instruction, ArchInstructionCall * call); @@ -31,8 +30,7 @@ static int _sparc_write(ArchPlugin * plugin, ArchInstruction * instruction, /* functions */ /* plug-in */ /* sparc_decode */ -static int _sparc_decode(ArchPlugin * plugin, ArchInstructionCall * call, - off_t base) +static int _sparc_decode(ArchPlugin * plugin, ArchInstructionCall * call) { ArchPluginHelper * helper = plugin->helper; uint32_t u32;