SIM_INTERFACE(disassemble) { /* Set up new block to disassemble */ void (*init)(conf_object_t *obj, uint8 *buff, int buff_len, uint64 address); /* Disassemble the next instruction */ disasm_instr_t (*next)(conf_object_t *obj); }; #define DISASSEMBLE_INTERFACE "disassemble"
init() is used to initialize a new disassemble
session. You should provide a buffer in buff
, the buffer
length in bytes in buff_len
and the base address for this
chunk in address
. The address
parameter is used
to calculate program counter relative offsets (for branches and
other program counter relative constructs).
typedef struct { int start; /* Where the instructions starts in the buffer */ int length; /* Length of instruction, or -1 if incomplete */ char *string; /* Disassembly string (allocated) */ } disasm_instr_t;
next() returns a structure with the next disassembled instruction. Repeated use of next() will disassemble additional instructions.