Added a peek() helper and passing the base address through the "call" pointer

This commit is contained in:
Pierre Pronchery 2011-09-03 20:21:25 +00:00
parent 98576fdf6d
commit cfe1768474
5 changed files with 10 additions and 14 deletions

View File

@ -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 */

View File

@ -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, ...);

View File

@ -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;

View File

@ -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;

View File

@ -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;