• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Capstone Disassembly Engine */
2 /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
3 
4 #ifndef CS_X86_MAP_H
5 #define CS_X86_MAP_H
6 
7 #include "../../include/capstone.h"
8 #include "../../cs_priv.h"
9 
10 // map sib_base to x86_reg
11 x86_reg x86_map_sib_base(int r);
12 
13 // map sib_index to x86_reg
14 x86_reg x86_map_sib_index(int r);
15 
16 // map seg_override to x86_reg
17 x86_reg x86_map_segment(int r);
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);
35 x86_reg X86_insn_reg_att(unsigned int id);
36 bool X86_insn_reg_intel2(unsigned int id, x86_reg *reg1, x86_reg *reg2);
37 bool X86_insn_reg_att2(unsigned int id, x86_reg *reg1, x86_reg *reg2);
38 
39 extern uint64_t arch_masks[9];
40 
41 // handle LOCK/REP/REPNE prefixes
42 // return True if we patch mnemonic, like in MULPD case
43 bool X86_lockrep(MCInst *MI, SStream *O);
44 
45 // map registers to sizes
46 extern uint8_t regsize_map_32[];
47 extern uint8_t regsize_map_64[];
48 
49 void op_addReg(MCInst *MI, int reg);
50 void op_addImm(MCInst *MI, int v);
51 
52 void op_addAvxBroadcast(MCInst *MI, x86_avx_bcast v);
53 
54 void op_addSseCC(MCInst *MI, int v);
55 void op_addAvxCC(MCInst *MI, int v);
56 
57 void op_addAvxZeroOpmask(MCInst *MI);
58 
59 void op_addAvxSae(MCInst *MI);
60 
61 void op_addAvxRoundingMode(MCInst *MI, int v);
62 
63 #endif
64