diff options
author | 2023-10-10 14:33:42 +0000 | |
---|---|---|
committer | 2023-10-10 14:33:42 +0000 | |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /capstone/arch/WASM/WASMInstPrinter.c | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'capstone/arch/WASM/WASMInstPrinter.c')
-rw-r--r-- | capstone/arch/WASM/WASMInstPrinter.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/capstone/arch/WASM/WASMInstPrinter.c b/capstone/arch/WASM/WASMInstPrinter.c new file mode 100644 index 000000000..6cd76fa3f --- /dev/null +++ b/capstone/arch/WASM/WASMInstPrinter.c @@ -0,0 +1,47 @@ +/* Capstone Disassembly Engine */ +/* By Spike, xwings 2019 */ + +#include "WASMInstPrinter.h" +#include "WASMMapping.h" + + +void WASM_printInst(MCInst *MI, struct SStream *O, void *PrinterInfo) +{ + SStream_concat(O, WASM_insn_name((csh)MI->csh, MI->Opcode)); + + switch (MI->wasm_data.type) { + default: + break; + + case WASM_OP_VARUINT32: + SStream_concat(O, "\t0x%x", MI->wasm_data.varuint32); + break; + + case WASM_OP_VARUINT64: + SStream_concat(O, "\t0x%lx", MI->wasm_data.varuint64); + break; + + case WASM_OP_UINT32: + SStream_concat(O, "\t0x%2" PRIx32, MI->wasm_data.uint32); + break; + + case WASM_OP_UINT64: + SStream_concat(O, "\t0x%2" PRIx64, MI->wasm_data.uint64); + break; + + case WASM_OP_IMM: + SStream_concat(O, "\t0x%x, 0x%x", MI->wasm_data.immediate[0], MI->wasm_data.immediate[1]); + break; + + case WASM_OP_INT7: + SStream_concat(O, "\t%d", MI->wasm_data.int7); + break; + + case WASM_OP_BRTABLE: + SStream_concat(O, "\t0x%x, [", MI->wasm_data.brtable.length); + SStream_concat(O, "0x%x", MI->wasm_data.brtable.address); + SStream_concat(O, "], 0x%x", MI->wasm_data.brtable.default_target); + + break; + } +} |