Rizin
unix-like reverse engineering framework and cli tools
X86Mapping.h
Go to the documentation of this file.
1 /* Capstone Disassembly Engine */
2 /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */
3 
4 #ifndef CS_X86_MAP_H
5 #define CS_X86_MAP_H
6 
7 #include "capstone/capstone.h"
8 #include "../../cs_priv.h"
9 
10 // map sib_base to x86_reg
12 
13 // map sib_index to x86_reg
15 
16 // map seg_override to x86_reg
18 
19 // return name of regiser in friendly string
20 const char *X86_reg_name(csh handle, unsigned int reg);
21 
22 // given internal insn id, return public instruction info
23 void X86_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id);
24 
25 // return insn name, given insn id
26 const char *X86_insn_name(csh handle, unsigned int id);
27 
28 // return group name, given group id
29 const char *X86_group_name(csh handle, unsigned int id);
30 
31 // return register of given instruction id
32 // return 0 if not found
33 // this is to handle instructions embedding accumulate registers into AsmStrs[]
34 x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access);
35 x86_reg X86_insn_reg_att(unsigned int id, enum cs_ac_type *access);
36 bool X86_insn_reg_intel2(unsigned int id, x86_reg *reg1, enum cs_ac_type *access1, x86_reg *reg2, enum cs_ac_type *access2);
37 bool X86_insn_reg_att2(unsigned int id, x86_reg *reg1, enum cs_ac_type *access1, x86_reg *reg2, enum cs_ac_type *access2);
38 
39 extern const uint64_t arch_masks[9];
40 
41 // handle LOCK/REP/REPNE prefixes
42 // return True if we patch mnemonic, like in MULPD case
44 
45 // map registers to sizes
46 extern const uint8_t regsize_map_32[];
47 extern const uint8_t regsize_map_64[];
48 
49 void op_addReg(MCInst *MI, int reg);
50 void op_addImm(MCInst *MI, int v);
51 
53 
54 void op_addXopCC(MCInst *MI, int v);
55 void op_addSseCC(MCInst *MI, int v);
56 void op_addAvxCC(MCInst *MI, int v);
57 
59 
60 void op_addAvxSae(MCInst *MI);
61 
63 
64 // given internal insn id, return operand access info
65 uint8_t *X86_get_op_access(cs_struct *h, unsigned int id, uint64_t *eflags);
66 
67 void X86_reg_access(const cs_insn *insn,
68  cs_regs regs_read, uint8_t *regs_read_count,
69  cs_regs regs_write, uint8_t *regs_write_count);
70 
71 // given the instruction id, return the size of its immediate operand (or 0)
72 uint8_t X86_immediate_size(unsigned int id, uint8_t *enc_size);
73 
74 #endif
void op_addAvxBroadcast(MCInst *MI, x86_avx_bcast v)
const char * X86_reg_name(csh handle, unsigned int reg)
const char * X86_insn_name(csh handle, unsigned int id)
uint8_t X86_immediate_size(unsigned int id, uint8_t *enc_size)
x86_reg x86_map_sib_index(int r)
const uint64_t arch_masks[9]
bool X86_lockrep(MCInst *MI, SStream *O)
bool X86_insn_reg_att2(unsigned int id, x86_reg *reg1, enum cs_ac_type *access1, x86_reg *reg2, enum cs_ac_type *access2)
void X86_reg_access(const cs_insn *insn, cs_regs regs_read, uint8_t *regs_read_count, cs_regs regs_write, uint8_t *regs_write_count)
void op_addAvxZeroOpmask(MCInst *MI)
void op_addSseCC(MCInst *MI, int v)
x86_reg x86_map_segment(int r)
void X86_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
void op_addImm(MCInst *MI, int v)
void op_addAvxRoundingMode(MCInst *MI, int v)
const uint8_t regsize_map_32[]
uint8_t * X86_get_op_access(cs_struct *h, unsigned int id, uint64_t *eflags)
void op_addAvxSae(MCInst *MI)
x86_reg X86_insn_reg_att(unsigned int id, enum cs_ac_type *access)
x86_reg x86_map_sib_base(int r)
void op_addXopCC(MCInst *MI, int v)
const uint8_t regsize_map_64[]
void op_addReg(MCInst *MI, int reg)
const char * X86_group_name(csh handle, unsigned int id)
bool X86_insn_reg_intel2(unsigned int id, x86_reg *reg1, enum cs_ac_type *access1, x86_reg *reg2, enum cs_ac_type *access2)
x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)
void op_addAvxCC(MCInst *MI, int v)
static mcore_handle handle
Definition: asm_mcore.c:8
size_t csh
Definition: capstone.h:71
cs_ac_type
Definition: capstone.h:202
x86_avx_bcast
AVX broadcast type.
Definition: x86.h:179
x86_reg
X86 registers.
Definition: x86.h:19
#define r
Definition: crypto_rc6.c:12
const char * v
Definition: dsignal.c:12
#define reg(n)
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause access
Definition: sflib.h:64
#define O
Definition: rcond.c:14
unsigned long uint64_t
Definition: sftypes.h:28
unsigned char uint8_t
Definition: sftypes.h:31
#define h(i)
Definition: sha256.c:48
Definition: MCInst.h:88
Definition: SStream.h:9