Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: third_party/yasm/patched-yasm/modules/arch/x86/x86arch.h

Issue 6170009: Update our yasm copy to yasm 1.1.0 (Part 1: yasm side)... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* $Id: x86arch.h 2181 2009-03-20 07:36:49Z peter $ 1 /* $Id: x86arch.h 2346 2010-08-01 01:37:37Z peter $
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #define CPU_Undoc 23 /* Undocumented instruction */ 57 #define CPU_Undoc 23 /* Undocumented instruction */
58 #define CPU_Obs 24 /* Obsolete instruction */ 58 #define CPU_Obs 24 /* Obsolete instruction */
59 #define CPU_Priv 25 /* Priveleged instruction */ 59 #define CPU_Priv 25 /* Priveleged instruction */
60 #define CPU_SVM 26 /* Secure Virtual Machine instruction */ 60 #define CPU_SVM 26 /* Secure Virtual Machine instruction */
61 #define CPU_PadLock 27 /* VIA PadLock instruction */ 61 #define CPU_PadLock 27 /* VIA PadLock instruction */
62 #define CPU_EM64T 28 /* Intel EM64T or better */ 62 #define CPU_EM64T 28 /* Intel EM64T or better */
63 #define CPU_SSSE3 29 /* Streaming SIMD extensions 3 required */ 63 #define CPU_SSSE3 29 /* Streaming SIMD extensions 3 required */
64 #define CPU_SSE41 30 /* Streaming SIMD extensions 4.1 required */ 64 #define CPU_SSE41 30 /* Streaming SIMD extensions 4.1 required */
65 #define CPU_SSE42 31 /* Streaming SIMD extensions 4.2 required */ 65 #define CPU_SSE42 31 /* Streaming SIMD extensions 4.2 required */
66 #define CPU_SSE4a 32 /* AMD Streaming SIMD extensions 4a required */ 66 #define CPU_SSE4a 32 /* AMD Streaming SIMD extensions 4a required */
67 #define CPU_SSE5 33 /* AMD Streaming SIMD extensions 5 required */ 67 #define CPU_XSAVE 33 /* Intel XSAVE instructions */
68 #define CPU_XSAVE 34 /* Intel XSAVE instructions */ 68 #define CPU_AVX 34 /* Intel Advanced Vector Extensions */
69 #define CPU_AVX 35 /* Intel Advanced Vector Extensions */ 69 #define CPU_FMA 35 /* Intel Fused-Multiply-Add Extensions */
70 #define CPU_FMA 36 /* Intel Fused-Multiply-Add Extensions */ 70 #define CPU_AES 36 /* AES instruction */
71 #define CPU_AES 37 /* AES instruction */ 71 #define CPU_CLMUL 37 /* PCLMULQDQ instruction */
72 #define CPU_CLMUL 38 /* PCLMULQDQ instruction */ 72 #define CPU_MOVBE 38 /* MOVBE instruction */
73 #define CPU_MOVBE 39 /* MOVBE instruction */ 73 #define CPU_XOP 39 /* AMD XOP extensions */
74 #define CPU_FMA4 40 /* AMD Fused-Multiply-Add extensions */
75 #define CPU_F16C 41 /* Intel float-16 instructions */
76 #define CPU_FSGSBASE 42 /* Intel FSGSBASE instructions */
77 #define CPU_RDRAND 43 /* Intel RDRAND instruction */
78 #define CPU_XSAVEOPT 44 /* Intel XSAVEOPT instruction */
79 #define CPU_EPTVPID 45 /* Intel INVEPT, INVVPID instructions */
80 #define CPU_SMX 46 /* Intel SMX instruction (GETSEC) */
81
82 enum x86_parser_type {
83 X86_PARSER_NASM = 0,
84 X86_PARSER_TASM = 1,
85 X86_PARSER_GAS = 2
86 };
87
88 #define PARSER(arch) (((arch)->parser == X86_PARSER_GAS && (arch)->gas_intel_mod e) ? X86_PARSER_NASM : (arch)->parser)
74 89
75 typedef struct yasm_arch_x86 { 90 typedef struct yasm_arch_x86 {
76 yasm_arch_base arch; /* base structure */ 91 yasm_arch_base arch; /* base structure */
77 92
78 /* What instructions/features are enabled? */ 93 /* What instructions/features are enabled? */
79 unsigned int active_cpu; /* active index into cpu_enables table */ 94 unsigned int active_cpu; /* active index into cpu_enables table */
80 unsigned int cpu_enables_size; /* size of cpu_enables table */ 95 unsigned int cpu_enables_size; /* size of cpu_enables table */
81 wordptr *cpu_enables; 96 wordptr *cpu_enables;
82 97
83 unsigned int amd64_machine; 98 unsigned int amd64_machine;
84 enum { 99 enum x86_parser_type parser;
85 X86_PARSER_NASM = 0,
86 X86_PARSER_TASM = 1,
87 X86_PARSER_GAS = 2
88 } parser;
89 unsigned int mode_bits; 100 unsigned int mode_bits;
90 unsigned int force_strict; 101 unsigned int force_strict;
91 unsigned int default_rel; 102 unsigned int default_rel;
103 unsigned int gas_intel_mode;
92 104
93 enum { 105 enum {
94 X86_NOP_BASIC = 0, 106 X86_NOP_BASIC = 0,
95 X86_NOP_INTEL = 1, 107 X86_NOP_INTEL = 1,
96 X86_NOP_AMD = 2 108 X86_NOP_AMD = 2
97 } nop; 109 } nop;
98 } yasm_arch_x86; 110 } yasm_arch_x86;
99 111
100 /* 0-15 (low 4 bits) used for register number, stored in same data area. 112 /* 0-15 (low 4 bits) used for register number, stored in same data area.
101 * Note 8-15 are only valid for some registers, and only in 64-bit mode. 113 * Note 8-15 are only valid for some registers, and only in 64-bit mode.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 X86_REX_R = 2, 157 X86_REX_R = 2,
146 X86_REX_X = 1, 158 X86_REX_X = 1,
147 X86_REX_B = 0 159 X86_REX_B = 0
148 } x86_rex_bit_pos; 160 } x86_rex_bit_pos;
149 161
150 /* Sets REX (4th bit) and 3 LS bits from register size/number. Returns 1 if 162 /* Sets REX (4th bit) and 3 LS bits from register size/number. Returns 1 if
151 * impossible to fit reg into REX, otherwise returns 0. Input parameter rexbit 163 * impossible to fit reg into REX, otherwise returns 0. Input parameter rexbit
152 * indicates bit of REX to use if REX is needed. Will not modify REX if not 164 * indicates bit of REX to use if REX is needed. Will not modify REX if not
153 * in 64-bit mode or if it wasn't needed to express reg. 165 * in 64-bit mode or if it wasn't needed to express reg.
154 */ 166 */
155 int yasm_x86__set_rex_from_reg(unsigned char *rex, unsigned char *drex, 167 int yasm_x86__set_rex_from_reg(unsigned char *rex, unsigned char *low3,
156 unsigned char *low3, uintptr_t reg, 168 uintptr_t reg, unsigned int bits,
157 unsigned int bits, x86_rex_bit_pos rexbit); 169 x86_rex_bit_pos rexbit);
158 170
159 /* Effective address type */ 171 /* Effective address type */
160 typedef struct x86_effaddr { 172 typedef struct x86_effaddr {
161 yasm_effaddr ea; /* base structure */ 173 yasm_effaddr ea; /* base structure */
162 174
163 /* How the spare (register) bits in Mod/RM are handled: 175 /* How the spare (register) bits in Mod/RM are handled:
164 * Even if valid_modrm=0, the spare bits are still valid (don't overwrite!) 176 * Even if valid_modrm=0, the spare bits are still valid (don't overwrite!)
165 * They're set in bytecode_create_insn(). 177 * They're set in bytecode_create_insn().
166 */ 178 */
167 unsigned char modrm; 179 unsigned char modrm;
168 unsigned char valid_modrm; /* 1 if Mod/RM byte currently valid, 0 if not */ 180 unsigned char valid_modrm; /* 1 if Mod/RM byte currently valid, 0 if not */
169 unsigned char need_modrm; /* 1 if Mod/RM byte needed, 0 if not */ 181 unsigned char need_modrm; /* 1 if Mod/RM byte needed, 0 if not */
170 182
171 unsigned char sib; 183 unsigned char sib;
172 unsigned char valid_sib; /* 1 if SIB byte currently valid, 0 if not */ 184 unsigned char valid_sib; /* 1 if SIB byte currently valid, 0 if not */
173 unsigned char need_sib; /* 1 if SIB byte needed, 0 if not, 185 unsigned char need_sib; /* 1 if SIB byte needed, 0 if not,
174 0xff if unknown */ 186 0xff if unknown */
175
176 unsigned char drex; /* DREX SSE5 extension byte */
177 unsigned char need_drex; /* 1 if DREX byte needed, 0 if not */
178 } x86_effaddr; 187 } x86_effaddr;
179 188
180 void yasm_x86__ea_init(x86_effaddr *x86_ea, unsigned int spare, 189 void yasm_x86__ea_init(x86_effaddr *x86_ea, unsigned int spare,
181 unsigned int drex, unsigned int need_drex,
182 yasm_bytecode *precbc); 190 yasm_bytecode *precbc);
183 191
184 void yasm_x86__ea_set_disponly(x86_effaddr *x86_ea); 192 void yasm_x86__ea_set_disponly(x86_effaddr *x86_ea);
185 x86_effaddr *yasm_x86__ea_create_reg(x86_effaddr *x86_ea, unsigned long reg, 193 x86_effaddr *yasm_x86__ea_create_reg(x86_effaddr *x86_ea, unsigned long reg,
186 unsigned char *rex, unsigned char *drex, 194 unsigned char *rex, unsigned int bits);
187 unsigned int bits);
188 x86_effaddr *yasm_x86__ea_create_imm 195 x86_effaddr *yasm_x86__ea_create_imm
189 (x86_effaddr *x86_ea, /*@keep@*/ yasm_expr *imm, unsigned int im_len); 196 (x86_effaddr *x86_ea, /*@keep@*/ yasm_expr *imm, unsigned int im_len);
190 yasm_effaddr *yasm_x86__ea_create_expr(yasm_arch *arch, 197 yasm_effaddr *yasm_x86__ea_create_expr(yasm_arch *arch,
191 /*@keep@*/ yasm_expr *e); 198 /*@keep@*/ yasm_expr *e);
192 void yasm_x86__ea_destroy(yasm_effaddr *ea); 199 void yasm_x86__ea_destroy(yasm_effaddr *ea);
193 void yasm_x86__ea_print(const yasm_effaddr *ea, FILE *f, int indent_level); 200 void yasm_x86__ea_print(const yasm_effaddr *ea, FILE *f, int indent_level);
194 201
195 void yasm_x86__bc_insn_opersize_override(yasm_bytecode *bc, 202 void yasm_x86__bc_insn_opersize_override(yasm_bytecode *bc,
196 unsigned int opersize); 203 unsigned int opersize);
197 void yasm_x86__bc_insn_addrsize_override(yasm_bytecode *bc, 204 void yasm_x86__bc_insn_addrsize_override(yasm_bytecode *bc,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 int yasm_x86__intnum_tobytes 308 int yasm_x86__intnum_tobytes
302 (yasm_arch *arch, const yasm_intnum *intn, unsigned char *buf, 309 (yasm_arch *arch, const yasm_intnum *intn, unsigned char *buf,
303 size_t destsize, size_t valsize, int shift, const yasm_bytecode *bc, 310 size_t destsize, size_t valsize, int shift, const yasm_bytecode *bc,
304 int warn); 311 int warn);
305 312
306 unsigned int yasm_x86__get_reg_size(uintptr_t reg); 313 unsigned int yasm_x86__get_reg_size(uintptr_t reg);
307 314
308 /*@only@*/ yasm_bytecode *yasm_x86__create_empty_insn(yasm_arch *arch, 315 /*@only@*/ yasm_bytecode *yasm_x86__create_empty_insn(yasm_arch *arch,
309 unsigned long line); 316 unsigned long line);
310 #endif 317 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698