| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
#ifndef I386_H_INCLUDE |
| 14 |
#define I386_H_INCLUDE |
| 15 |
#define I386_OP(mnemonic,addressoperand,number) I386_INS_ ## mnemonic ## _ ## addressoperand, |
| 16 |
enum one_byte_opcode |
| 17 |
{ |
| 18 |
#include "i386_ops.h" |
| 19 |
NUM_ONE_BYTE_OPCODES |
| 20 |
}; |
| 21 |
|
| 22 |
enum two_byte_opcode |
| 23 |
{ |
| 24 |
#include "i386_ops_2b.h" |
| 25 |
NUM_TWO_BYTE_OPCODES |
| 26 |
}; |
| 27 |
|
| 28 |
enum group1_opcode |
| 29 |
{ |
| 30 |
#include "i386_ops_g1.h" |
| 31 |
NUM_GROUP_1_OPCODES |
| 32 |
}; |
| 33 |
|
| 34 |
enum group2_opcode |
| 35 |
{ |
| 36 |
#include "i386_ops_g2.h" |
| 37 |
NUM_GROUP_2_OPCODES |
| 38 |
}; |
| 39 |
|
| 40 |
enum group3_opcode |
| 41 |
{ |
| 42 |
#include "i386_ops_g3.h" |
| 43 |
NUM_GROUP_3_OPCODES |
| 44 |
}; |
| 45 |
|
| 46 |
enum group4_opcode |
| 47 |
{ |
| 48 |
#include "i386_ops_g4.h" |
| 49 |
NUM_GROUP_4_OPCODES |
| 50 |
}; |
| 51 |
|
| 52 |
enum group5_opcode |
| 53 |
{ |
| 54 |
#include "i386_ops_g5.h" |
| 55 |
NUM_GROUP_5_OPCODES |
| 56 |
}; |
| 57 |
|
| 58 |
enum group6_opcode |
| 59 |
{ |
| 60 |
#include "i386_ops_g6.h" |
| 61 |
NUM_GROUP_6_OPCODES |
| 62 |
}; |
| 63 |
|
| 64 |
enum group7_opcode |
| 65 |
{ |
| 66 |
#include "i386_ops_g7.h" |
| 67 |
NUM_GROUP_7_OPCODES |
| 68 |
}; |
| 69 |
|
| 70 |
enum group8_opcode |
| 71 |
{ |
| 72 |
#include "i386_ops_g8.h" |
| 73 |
NUM_GROUP_8_OPCODES |
| 74 |
}; |
| 75 |
|
| 76 |
#define I386_MOD(mnemonic,number) I386_MOD16_ ## mnemonic, |
| 77 |
enum mod16 |
| 78 |
{ |
| 79 |
#include "i386_mod_16.h" |
| 80 |
NUM_16_BIT_MODS |
| 81 |
}; |
| 82 |
#undef I386_MOD |
| 83 |
|
| 84 |
#define I386_MOD(mnemonic,number) I386_MOD32_ ## mnemonic, |
| 85 |
enum mod32 |
| 86 |
{ |
| 87 |
#include "i386_mod_32.h" |
| 88 |
NUM_32_BIT_MODS |
| 89 |
}; |
| 90 |
|
| 91 |
#define SS_CODE(mnemonic,number) I386_SS_ ## mnemonic, |
| 92 |
enum ssval |
| 93 |
{ |
| 94 |
#include "i386_ss.h" |
| 95 |
NUM_SS_CODES |
| 96 |
}; |
| 97 |
|
| 98 |
#define REGDEF(mnemonic,number) I386_REG_ ## mnemonic |
| 99 |
|
| 100 |
#ifdef __x86_64__ |
| 101 |
enum reg64 |
| 102 |
{ |
| 103 |
#include "i386_reg64.h" |
| 104 |
NUM_64_BIT_REGISTERS |
| 105 |
}; |
| 106 |
#endif |
| 107 |
|
| 108 |
enum reg32 |
| 109 |
{ |
| 110 |
#include "i386_reg32.h" |
| 111 |
NUM_32_BIT_REGISTERS |
| 112 |
}; |
| 113 |
|
| 114 |
enum reg16 |
| 115 |
{ |
| 116 |
#include "i386_reg16.h" |
| 117 |
NUM_16_BIT_REGISTERS |
| 118 |
}; |
| 119 |
|
| 120 |
enum reg8 |
| 121 |
{ |
| 122 |
#include "i386_reg8.h" |
| 123 |
NUM_8_BIT_REGISTERS |
| 124 |
}; |
| 125 |
|
| 126 |
|
| 127 |
typedef struct |
| 128 |
{ |
| 129 |
unsigned char r_m : 3; |
| 130 |
unsigned char reg_opcode : 3; |
| 131 |
unsigned char mod : 2; |
| 132 |
} ModR_M; |
| 133 |
|
| 134 |
typedef struct |
| 135 |
{ |
| 136 |
unsigned char base : 3; |
| 137 |
unsigned char index : 3; |
| 138 |
unsigned char ss : 2; |
| 139 |
} SIB; |
| 140 |
|
| 141 |
|
| 142 |
#endif |