Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_types.h>
#include <rz_asm.h>
#include <rz_endian.h>
#include <rz_util/rz_strbuf.h>
#include "cil_dis.h"
#include "opcodes_single.def"
#include "opcodes_double.def"
#include "opcodes_prefix.def"
Go to the source code of this file.
Classes | |
struct | CILOpcodeReader |
Macros | |
#define | DEF_READ_GENERIC(bytes, readtype, fmt) |
#define | read_ShortInlineVar read_generic8 |
#define | read_ShortInlineI read_generic8 |
#define | read_InlineVar read_generic16 |
#define | read_InlineI read_generic32 |
#define | read_InlineSig read_generic32 |
#define | read_InlineType read_generic32 |
#define | read_InlineField read_generic32 |
#define | read_InlineString read_generic32 |
#define | read_InlineTok read_generic32 |
#define | read_InlineI8 read_generic64 |
#define | read_ShortInlineR read_generic_float |
#define | read_InlineR read_generic_double |
#define | OPCODE_SINGLE(name, string, param, byte, control) [name] = { .str = string, .read_param = read_##param }, |
#define | OPCODE_DOUBLE(name, string, param, byte, control) [name] = { .str = string, .read_param = read_##param }, |
#define | OPCODE_PREFIX(name, string, param, byte, control) |
Functions | |
static int | read_InlineNone (int *pos, CILOp *op, const ut8 *buf, int len) |
static int | read_InlineMethod (int *pos, CILOp *op, const ut8 *buf, int len) |
static int | read_InlineBrTarget (int *pos, CILOp *op, const ut8 *buf, int len) |
static int | read_ShortInlineBrTarget (int *pos, CILOp *op, const ut8 *buf, int len) |
static int | read_InlineSwitch (int *pos, CILOp *op, const ut8 *buf, int len) |
int | cil_dis (CILOp *op, const ut8 *buf, int len) |
Disassemble a CIL buffer. More... | |
Variables | |
static const CILOpcodeReader | opcode_readers_single [] |
static const CILOpcodeReader | opcode_readers_double [] |
The read_## functions are dispatched based on the opcode param
they take the position in by pointer and can alter it, and return a nonzero value if an error occurs
The position is always the index of the next byte to read. If, after incrementing by the number of bytes to be read, the index == the buffer length, the read has gone to the end of the buffer and should succeed. If index > buffer length, the read is past the bounds and should fail
The opcode_readers arrays include the opcode mnemonic, the appropriate parameter reader to call, and whether or not the opcode is a prefix opcode
eg. OPCODE_SINGLE(CIL_OP_NOP, "nop", InlineNone, 0x00, NEXT) -> CILOpcodeReader opcode_readers_single[] = { [CIL_OP_NOP] = { .str = "nop", .read_param = read_InlineNone }, ... }
Definition in file cil_dis.c.
#define DEF_READ_GENERIC | ( | bytes, | |
readtype, | |||
fmt | |||
) |
Disassemble a CIL buffer.
Definition at line 150 of file cil_dis.c.
References len, opcode_readers_double, opcode_readers_single, pos, CILOpcodeReader::prefix, CILOpcodeReader::read_param, rz_strbuf_append(), rz_strbuf_init(), start, and CILOpcodeReader::str.
Referenced by cil_analyze_op(), and disassemble().
Definition at line 74 of file cil_dis.c.
References len, pos, rz_read_at_le32(), rz_strbuf_appendf(), and st32.
Definition at line 63 of file cil_dis.c.
References len, pos, rz_read_at_le32(), and rz_strbuf_appendf().
Definition at line 96 of file cil_dis.c.
References count, len, pos, and rz_read_le32().
Definition at line 85 of file cil_dis.c.
References len, pos, rz_read_at_le8(), rz_strbuf_appendf(), and st8.
|
static |
|
static |