OLD | NEW |
1 /* $Id: x86arch.h 2346 2010-08-01 01:37:37Z peter $ | 1 /* |
2 * x86 Architecture header file | 2 * x86 Architecture header file |
3 * | 3 * |
4 * Copyright (C) 2001-2007 Peter Johnson | 4 * Copyright (C) 2001-2007 Peter Johnson |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
11 * 2. Redistributions in binary form must reproduce the above copyright | 11 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 #define CPU_CLMUL 37 /* PCLMULQDQ instruction */ | 71 #define CPU_CLMUL 37 /* PCLMULQDQ instruction */ |
72 #define CPU_MOVBE 38 /* MOVBE instruction */ | 72 #define CPU_MOVBE 38 /* MOVBE instruction */ |
73 #define CPU_XOP 39 /* AMD XOP extensions */ | 73 #define CPU_XOP 39 /* AMD XOP extensions */ |
74 #define CPU_FMA4 40 /* AMD Fused-Multiply-Add extensions */ | 74 #define CPU_FMA4 40 /* AMD Fused-Multiply-Add extensions */ |
75 #define CPU_F16C 41 /* Intel float-16 instructions */ | 75 #define CPU_F16C 41 /* Intel float-16 instructions */ |
76 #define CPU_FSGSBASE 42 /* Intel FSGSBASE instructions */ | 76 #define CPU_FSGSBASE 42 /* Intel FSGSBASE instructions */ |
77 #define CPU_RDRAND 43 /* Intel RDRAND instruction */ | 77 #define CPU_RDRAND 43 /* Intel RDRAND instruction */ |
78 #define CPU_XSAVEOPT 44 /* Intel XSAVEOPT instruction */ | 78 #define CPU_XSAVEOPT 44 /* Intel XSAVEOPT instruction */ |
79 #define CPU_EPTVPID 45 /* Intel INVEPT, INVVPID instructions */ | 79 #define CPU_EPTVPID 45 /* Intel INVEPT, INVVPID instructions */ |
80 #define CPU_SMX 46 /* Intel SMX instruction (GETSEC) */ | 80 #define CPU_SMX 46 /* Intel SMX instruction (GETSEC) */ |
| 81 #define CPU_AVX2 47 /* Intel AVX2 instructions */ |
| 82 #define CPU_BMI1 48 /* Intel BMI1 instructions */ |
| 83 #define CPU_BMI2 49 /* Intel BMI2 instructions */ |
| 84 #define CPU_INVPCID 50 /* Intel INVPCID instruction */ |
| 85 #define CPU_LZCNT 51 /* Intel LZCNT instruction */ |
81 | 86 |
82 enum x86_parser_type { | 87 enum x86_parser_type { |
83 X86_PARSER_NASM = 0, | 88 X86_PARSER_NASM = 0, |
84 X86_PARSER_TASM = 1, | 89 X86_PARSER_TASM = 1, |
85 X86_PARSER_GAS = 2 | 90 X86_PARSER_GAS = 2 |
86 }; | 91 }; |
87 | 92 |
88 #define PARSER(arch) (((arch)->parser == X86_PARSER_GAS && (arch)->gas_intel_mod
e) ? X86_PARSER_NASM : (arch)->parser) | 93 #define PARSER(arch) (((arch)->parser == X86_PARSER_GAS && (arch)->gas_intel_mod
e) ? X86_PARSER_NASM : (arch)->parser) |
89 | 94 |
90 typedef struct yasm_arch_x86 { | 95 typedef struct yasm_arch_x86 { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 * in 64-bit mode or if it wasn't needed to express reg. | 170 * in 64-bit mode or if it wasn't needed to express reg. |
166 */ | 171 */ |
167 int yasm_x86__set_rex_from_reg(unsigned char *rex, unsigned char *low3, | 172 int yasm_x86__set_rex_from_reg(unsigned char *rex, unsigned char *low3, |
168 uintptr_t reg, unsigned int bits, | 173 uintptr_t reg, unsigned int bits, |
169 x86_rex_bit_pos rexbit); | 174 x86_rex_bit_pos rexbit); |
170 | 175 |
171 /* Effective address type */ | 176 /* Effective address type */ |
172 typedef struct x86_effaddr { | 177 typedef struct x86_effaddr { |
173 yasm_effaddr ea; /* base structure */ | 178 yasm_effaddr ea; /* base structure */ |
174 | 179 |
| 180 /* VSIB uses the normal SIB byte, but this flag enables it. */ |
| 181 unsigned char vsib_mode; /* 0 if not, 1 if XMM, 2 if YMM */ |
| 182 |
175 /* How the spare (register) bits in Mod/RM are handled: | 183 /* How the spare (register) bits in Mod/RM are handled: |
176 * Even if valid_modrm=0, the spare bits are still valid (don't overwrite!) | 184 * Even if valid_modrm=0, the spare bits are still valid (don't overwrite!) |
177 * They're set in bytecode_create_insn(). | 185 * They're set in bytecode_create_insn(). |
178 */ | 186 */ |
179 unsigned char modrm; | 187 unsigned char modrm; |
180 unsigned char valid_modrm; /* 1 if Mod/RM byte currently valid, 0 if not */ | 188 unsigned char valid_modrm; /* 1 if Mod/RM byte currently valid, 0 if not */ |
181 unsigned char need_modrm; /* 1 if Mod/RM byte needed, 0 if not */ | 189 unsigned char need_modrm; /* 1 if Mod/RM byte needed, 0 if not */ |
182 | 190 |
183 unsigned char sib; | 191 unsigned char sib; |
184 unsigned char valid_sib; /* 1 if SIB byte currently valid, 0 if not */ | 192 unsigned char valid_sib; /* 1 if SIB byte currently valid, 0 if not */ |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 int yasm_x86__intnum_tobytes | 316 int yasm_x86__intnum_tobytes |
309 (yasm_arch *arch, const yasm_intnum *intn, unsigned char *buf, | 317 (yasm_arch *arch, const yasm_intnum *intn, unsigned char *buf, |
310 size_t destsize, size_t valsize, int shift, const yasm_bytecode *bc, | 318 size_t destsize, size_t valsize, int shift, const yasm_bytecode *bc, |
311 int warn); | 319 int warn); |
312 | 320 |
313 unsigned int yasm_x86__get_reg_size(uintptr_t reg); | 321 unsigned int yasm_x86__get_reg_size(uintptr_t reg); |
314 | 322 |
315 /*@only@*/ yasm_bytecode *yasm_x86__create_empty_insn(yasm_arch *arch, | 323 /*@only@*/ yasm_bytecode *yasm_x86__create_empty_insn(yasm_arch *arch, |
316 unsigned long line); | 324 unsigned long line); |
317 #endif | 325 #endif |
OLD | NEW |