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

Side by Side Diff: src/trusted/validator_ragel/unreviewed/parse_instruction.rl

Issue 11000033: Move validator_x86_XX.rl out of unreviewed. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years, 2 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 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
Brad Chen 2012/10/05 16:47:21 What is this file for? It's particularly important
khim 2012/10/15 16:38:57 Done.
6 6
7 %%{ 7 %%{
8 machine prefix_actions; 8 machine prefix_actions;
9 9
10 action branch_not_taken { 10 action branch_not_taken {
11 SET_BRANCH_NOT_TAKEN(TRUE); 11 SET_BRANCH_NOT_TAKEN(TRUE);
12 } 12 }
13 action branch_taken { 13 action branch_taken {
14 SET_BRANCH_TAKEN(TRUE); 14 SET_BRANCH_TAKEN(TRUE);
15 } 15 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 %%{ 167 %%{
168 machine operand_actions_common; 168 machine operand_actions_common;
169 169
170 action operands_count_is_0 { SET_OPERANDS_COUNT(0); } 170 action operands_count_is_0 { SET_OPERANDS_COUNT(0); }
171 action operands_count_is_1 { SET_OPERANDS_COUNT(1); } 171 action operands_count_is_1 { SET_OPERANDS_COUNT(1); }
172 action operands_count_is_2 { SET_OPERANDS_COUNT(2); } 172 action operands_count_is_2 { SET_OPERANDS_COUNT(2); }
173 action operands_count_is_3 { SET_OPERANDS_COUNT(3); } 173 action operands_count_is_3 { SET_OPERANDS_COUNT(3); }
174 action operands_count_is_4 { SET_OPERANDS_COUNT(4); } 174 action operands_count_is_4 { SET_OPERANDS_COUNT(4); }
175 action operands_count_is_5 { SET_OPERANDS_COUNT(5); } 175 action operands_count_is_5 { SET_OPERANDS_COUNT(5); }
176 176
177 action operand0_16bit { SET_OPERAND_TYPE(0, OPERAND_SIZE_16_BIT); } 177 action operand0_16bit { SET_OPERAND_TYPE(0, OPERAND_TYPE_16_BIT); }
178 action operand0_8bit { SET_OPERAND_TYPE(0, OPERAND_SIZE_8_BIT); } 178 action operand0_8bit { SET_OPERAND_TYPE(0, OPERAND_TYPE_8_BIT); }
179 action operand0_32bit { SET_OPERAND_TYPE(0, OPERAND_SIZE_32_BIT); } 179 action operand0_32bit { SET_OPERAND_TYPE(0, OPERAND_TYPE_32_BIT); }
180 action operand0_64bit { SET_OPERAND_TYPE(0, OPERAND_SIZE_64_BIT); } 180 action operand0_64bit { SET_OPERAND_TYPE(0, OPERAND_TYPE_64_BIT); }
181 action operand0_128bit { SET_OPERAND_TYPE(0, OPERAND_SIZE_128_BIT); } 181 action operand0_128bit { SET_OPERAND_TYPE(0, OPERAND_TYPE_128_BIT); }
182 action operand0_256bit { SET_OPERAND_TYPE(0, OPERAND_SIZE_256_BIT); } 182 action operand0_256bit { SET_OPERAND_TYPE(0, OPERAND_TYPE_256_BIT); }
183 action operand0_creg { SET_OPERAND_TYPE(0, OPERAND_CONTROL_REGISTER); } 183 action operand0_creg { SET_OPERAND_TYPE(0, OPERAND_TYPE_CONTROL_REGISTER); }
184 action operand0_dreg { SET_OPERAND_TYPE(0, OPERAND_DEBUG_REGISTER); } 184 action operand0_dreg { SET_OPERAND_TYPE(0, OPERAND_TYPE_DEBUG_REGISTER); }
185 action operand0_farptr { SET_OPERAND_TYPE(0, OPERAND_FAR_PTR); } 185 action operand0_farptr { SET_OPERAND_TYPE(0, OPERAND_TYPE_FAR_PTR); }
186 action operand0_float32bit { SET_OPERAND_TYPE(0, OPERAND_FLOAT_SIZE_32_BIT); } 186 action operand0_float32bit { SET_OPERAND_TYPE(0, OPERAND_TYPE_FLOAT_32_BIT); }
187 action operand0_float64bit { SET_OPERAND_TYPE(0, OPERAND_FLOAT_SIZE_64_BIT); } 187 action operand0_float64bit { SET_OPERAND_TYPE(0, OPERAND_TYPE_FLOAT_64_BIT); }
188 action operand0_float80bit { SET_OPERAND_TYPE(0, OPERAND_FLOAT_SIZE_80_BIT); } 188 action operand0_float80bit { SET_OPERAND_TYPE(0, OPERAND_TYPE_FLOAT_80_BIT); }
189 action operand0_mmx { SET_OPERAND_TYPE(0, OPERAND_MMX); } 189 action operand0_mmx { SET_OPERAND_TYPE(0, OPERAND_TYPE_MMX); }
190 action operand0_segreg { SET_OPERAND_TYPE(0, OPERAND_SEGMENT_REGISTER); } 190 action operand0_segreg { SET_OPERAND_TYPE(0, OPERAND_TYPE_SEGMENT_REGISTER); }
191 action operand0_selector { SET_OPERAND_TYPE(0, OPERAND_SELECTOR); } 191 action operand0_selector { SET_OPERAND_TYPE(0, OPERAND_TYPE_SELECTOR); }
192 action operand0_x87 { SET_OPERAND_TYPE(0, OPERAND_ST); } 192 action operand0_x87 { SET_OPERAND_TYPE(0, OPERAND_TYPE_ST); }
193 action operand0_x87_16bit { SET_OPERAND_TYPE(0, OPERAND_X87_SIZE_16_BIT); } 193 action operand0_x87_16bit { SET_OPERAND_TYPE(0, OPERAND_TYPE_X87_16_BIT); }
194 action operand0_x87_32bit { SET_OPERAND_TYPE(0, OPERAND_X87_SIZE_32_BIT); } 194 action operand0_x87_32bit { SET_OPERAND_TYPE(0, OPERAND_TYPE_X87_32_BIT); }
195 action operand0_x87_64bit { SET_OPERAND_TYPE(0, OPERAND_X87_SIZE_64_BIT); } 195 action operand0_x87_64bit { SET_OPERAND_TYPE(0, OPERAND_TYPE_X87_64_BIT); }
196 action operand0_x87_bcd { SET_OPERAND_TYPE(0, OPERAND_X87_BCD); } 196 action operand0_x87_bcd { SET_OPERAND_TYPE(0, OPERAND_TYPE_X87_BCD); }
197 action operand0_x87_env { SET_OPERAND_TYPE(0, OPERAND_X87_ENV); } 197 action operand0_x87_env { SET_OPERAND_TYPE(0, OPERAND_TYPE_X87_ENV); }
198 action operand0_x87_mmx_xmm_state { 198 action operand0_x87_mmx_xmm_state {
199 SET_OPERAND_TYPE(0, OPERAND_X87_MMX_MM_STATE); 199 SET_OPERAND_TYPE(0, OPERAND_TYPE_X87_MMX_XMM_STATE);
200 } 200 }
201 action operand0_x87_state { SET_OPERAND_TYPE(0, OPERAND_X87_STATE); } 201 action operand0_x87_state { SET_OPERAND_TYPE(0, OPERAND_TYPE_X87_STATE); }
202 action operand0_xmm { SET_OPERAND_TYPE(0, OPERAND_XMM); } 202 action operand0_xmm { SET_OPERAND_TYPE(0, OPERAND_TYPE_XMM); }
203 action operand0_ymm { SET_OPERAND_TYPE(0, OPERAND_YMM); } 203 action operand0_ymm { SET_OPERAND_TYPE(0, OPERAND_TYPE_YMM); }
204 204
205 action operand1_8bit { SET_OPERAND_TYPE(1, OPERAND_SIZE_8_BIT); } 205 action operand1_8bit { SET_OPERAND_TYPE(1, OPERAND_TYPE_8_BIT); }
206 action operand1_16bit { SET_OPERAND_TYPE(1, OPERAND_SIZE_16_BIT); } 206 action operand1_16bit { SET_OPERAND_TYPE(1, OPERAND_TYPE_16_BIT); }
207 action operand1_32bit { SET_OPERAND_TYPE(1, OPERAND_SIZE_32_BIT); } 207 action operand1_32bit { SET_OPERAND_TYPE(1, OPERAND_TYPE_32_BIT); }
208 action operand1_64bit { SET_OPERAND_TYPE(1, OPERAND_SIZE_64_BIT); } 208 action operand1_64bit { SET_OPERAND_TYPE(1, OPERAND_TYPE_64_BIT); }
209 action operand1_128bit { SET_OPERAND_TYPE(1, OPERAND_SIZE_128_BIT); } 209 action operand1_128bit { SET_OPERAND_TYPE(1, OPERAND_TYPE_128_BIT); }
210 action operand1_256bit { SET_OPERAND_TYPE(1, OPERAND_SIZE_256_BIT); } 210 action operand1_256bit { SET_OPERAND_TYPE(1, OPERAND_TYPE_256_BIT); }
211 action operand1_creg { SET_OPERAND_TYPE(1, OPERAND_CONTROL_REGISTER); } 211 action operand1_creg { SET_OPERAND_TYPE(1, OPERAND_TYPE_CONTROL_REGISTER); }
212 action operand1_dreg { SET_OPERAND_TYPE(1, OPERAND_DEBUG_REGISTER); } 212 action operand1_dreg { SET_OPERAND_TYPE(1, OPERAND_TYPE_DEBUG_REGISTER); }
213 action operand1_farptr { SET_OPERAND_TYPE(1, OPERAND_FAR_PTR); } 213 action operand1_farptr { SET_OPERAND_TYPE(1, OPERAND_TYPE_FAR_PTR); }
214 action operand1_float32bit { SET_OPERAND_TYPE(1, OPERAND_FLOAT_SIZE_32_BIT); } 214 action operand1_float32bit { SET_OPERAND_TYPE(1, OPERAND_TYPE_FLOAT_32_BIT); }
215 action operand1_float64bit { SET_OPERAND_TYPE(1, OPERAND_FLOAT_SIZE_64_BIT); } 215 action operand1_float64bit { SET_OPERAND_TYPE(1, OPERAND_TYPE_FLOAT_64_BIT); }
216 action operand1_mmx { SET_OPERAND_TYPE(1, OPERAND_MMX); } 216 action operand1_mmx { SET_OPERAND_TYPE(1, OPERAND_TYPE_MMX); }
217 action operand1_segreg { SET_OPERAND_TYPE(1, OPERAND_SEGMENT_REGISTER); } 217 action operand1_segreg { SET_OPERAND_TYPE(1, OPERAND_TYPE_SEGMENT_REGISTER); }
218 action operand1_x87 { SET_OPERAND_TYPE(1, OPERAND_ST); } 218 action operand1_x87 { SET_OPERAND_TYPE(1, OPERAND_TYPE_ST); }
219 action operand1_xmm { SET_OPERAND_TYPE(1, OPERAND_XMM); } 219 action operand1_xmm { SET_OPERAND_TYPE(1, OPERAND_TYPE_XMM); }
220 action operand1_ymm { SET_OPERAND_TYPE(1, OPERAND_YMM); } 220 action operand1_ymm { SET_OPERAND_TYPE(1, OPERAND_TYPE_YMM); }
221 221
222 action operand2_8bit { SET_OPERAND_TYPE(2, OPERAND_SIZE_8_BIT); } 222 action operand2_8bit { SET_OPERAND_TYPE(2, OPERAND_TYPE_8_BIT); }
223 action operand2_16bit { SET_OPERAND_TYPE(2, OPERAND_SIZE_16_BIT); } 223 action operand2_16bit { SET_OPERAND_TYPE(2, OPERAND_TYPE_16_BIT); }
224 action operand2_32bit { SET_OPERAND_TYPE(2, OPERAND_SIZE_32_BIT); } 224 action operand2_32bit { SET_OPERAND_TYPE(2, OPERAND_TYPE_32_BIT); }
225 action operand2_64bit { SET_OPERAND_TYPE(2, OPERAND_SIZE_64_BIT); } 225 action operand2_64bit { SET_OPERAND_TYPE(2, OPERAND_TYPE_64_BIT); }
226 action operand2_128bit { SET_OPERAND_TYPE(2, OPERAND_SIZE_128_BIT); } 226 action operand2_128bit { SET_OPERAND_TYPE(2, OPERAND_TYPE_128_BIT); }
227 action operand2_256bit { SET_OPERAND_TYPE(2, OPERAND_SIZE_256_BIT); } 227 action operand2_256bit { SET_OPERAND_TYPE(2, OPERAND_TYPE_256_BIT); }
228 action operand2_float32bit { SET_OPERAND_TYPE(2, OPERAND_FLOAT_SIZE_32_BIT); } 228 action operand2_float32bit { SET_OPERAND_TYPE(2, OPERAND_TYPE_FLOAT_32_BIT); }
229 action operand2_float64bit { SET_OPERAND_TYPE(2, OPERAND_FLOAT_SIZE_64_BIT); } 229 action operand2_float64bit { SET_OPERAND_TYPE(2, OPERAND_TYPE_FLOAT_64_BIT); }
230 action operand2_xmm { SET_OPERAND_TYPE(2, OPERAND_XMM); } 230 action operand2_xmm { SET_OPERAND_TYPE(2, OPERAND_TYPE_XMM); }
231 action operand2_ymm { SET_OPERAND_TYPE(2, OPERAND_YMM); } 231 action operand2_ymm { SET_OPERAND_TYPE(2, OPERAND_TYPE_YMM); }
232 232
233 action operand3_8bit { SET_OPERAND_TYPE(3, OPERAND_SIZE_8_BIT); } 233 action operand3_8bit { SET_OPERAND_TYPE(3, OPERAND_TYPE_8_BIT); }
234 action operand3_128bit { SET_OPERAND_TYPE(3, OPERAND_SIZE_128_BIT); } 234 action operand3_128bit { SET_OPERAND_TYPE(3, OPERAND_TYPE_128_BIT); }
235 action operand3_256bit { SET_OPERAND_TYPE(3, OPERAND_SIZE_256_BIT); } 235 action operand3_256bit { SET_OPERAND_TYPE(3, OPERAND_TYPE_256_BIT); }
236 action operand3_float32bit { SET_OPERAND_TYPE(3, OPERAND_FLOAT_SIZE_32_BIT); } 236 action operand3_float32bit { SET_OPERAND_TYPE(3, OPERAND_TYPE_FLOAT_32_BIT); }
237 action operand3_float64bit { SET_OPERAND_TYPE(3, OPERAND_FLOAT_SIZE_64_BIT); } 237 action operand3_float64bit { SET_OPERAND_TYPE(3, OPERAND_TYPE_FLOAT_64_BIT); }
238 action operand3_xmm { SET_OPERAND_TYPE(3, OPERAND_XMM); } 238 action operand3_xmm { SET_OPERAND_TYPE(3, OPERAND_TYPE_XMM); }
239 action operand3_ymm { SET_OPERAND_TYPE(3, OPERAND_YMM); } 239 action operand3_ymm { SET_OPERAND_TYPE(3, OPERAND_TYPE_YMM); }
240 240
241 action operand4_2bit { SET_OPERAND_TYPE(4, OPERAND_SIZE_2_BIT); } 241 action operand4_2bit { SET_OPERAND_TYPE(4, OPERAND_TYPE_2_BIT); }
242 242
243 action operand0_ds_rbx { SET_OPERAND_NAME(0, REG_DS_RBX); } 243 action operand0_ds_rbx { SET_OPERAND_NAME(0, REG_DS_RBX); }
244 action operand0_ds_rsi { SET_OPERAND_NAME(0, REG_DS_RSI); } 244 action operand0_ds_rsi { SET_OPERAND_NAME(0, REG_DS_RSI); }
245 action operand0_es_rdi { SET_OPERAND_NAME(0, REG_ES_RDI); } 245 action operand0_es_rdi { SET_OPERAND_NAME(0, REG_ES_RDI); }
246 action operand0_immediate { SET_OPERAND_NAME(0, REG_IMM); } 246 action operand0_immediate { SET_OPERAND_NAME(0, REG_IMM); }
247 action operand0_port_dx { SET_OPERAND_NAME(0, REG_PORT_DX); } 247 action operand0_port_dx { SET_OPERAND_NAME(0, REG_PORT_DX); }
248 action operand0_rax { SET_OPERAND_NAME(0, REG_RAX); } 248 action operand0_rax { SET_OPERAND_NAME(0, REG_RAX); }
249 action operand0_rcx { SET_OPERAND_NAME(0, REG_RCX); } 249 action operand0_rcx { SET_OPERAND_NAME(0, REG_RCX); }
250 action operand0_rdx { SET_OPERAND_NAME(0, REG_RDX); } 250 action operand0_rdx { SET_OPERAND_NAME(0, REG_RDX); }
251 action operand0_rm { SET_OPERAND_NAME(0, REG_RM); } 251 action operand0_rm { SET_OPERAND_NAME(0, REG_RM); }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 SET_OPERAND_NAME(3, RegisterFromIS4(*current_position)); 295 SET_OPERAND_NAME(3, RegisterFromIS4(*current_position));
296 } 296 }
297 }%% 297 }%%
298 298
299 %%{ 299 %%{
300 machine operand_actions_ia32; 300 machine operand_actions_ia32;
301 301
302 include operand_actions_common 302 include operand_actions_common
303 "native_client/src/trusted/validator_ragel/unreviewed/parse_instruction.rl"; 303 "native_client/src/trusted/validator_ragel/unreviewed/parse_instruction.rl";
304 304
305 action operand0_regsize { SET_OPERAND_TYPE(0, OPERAND_SIZE_32_BIT); } 305 action operand0_regsize { SET_OPERAND_TYPE(0, OPERAND_TYPE_32_BIT); }
306 action operand1_regsize { SET_OPERAND_TYPE(1, OPERAND_SIZE_32_BIT); } 306 action operand1_regsize { SET_OPERAND_TYPE(1, OPERAND_TYPE_32_BIT); }
307 action operand2_regsize { SET_OPERAND_TYPE(2, OPERAND_SIZE_32_BIT); } 307 action operand2_regsize { SET_OPERAND_TYPE(2, OPERAND_TYPE_32_BIT); }
308 308
309 action operand0_absolute_disp { 309 action operand0_absolute_disp {
310 SET_OPERAND_NAME(0, REG_RM); 310 SET_OPERAND_NAME(0, REG_RM);
311 SET_MODRM_BASE(NO_REG); 311 SET_MODRM_BASE(NO_REG);
312 SET_MODRM_INDEX(NO_REG); 312 SET_MODRM_INDEX(NO_REG);
313 SET_MODRM_SCALE(0); 313 SET_MODRM_SCALE(0);
314 } 314 }
315 action operand0_from_modrm_reg { 315 action operand0_from_modrm_reg {
316 SET_OPERAND_NAME(0, RegFromModRM(*current_position)); 316 SET_OPERAND_NAME(0, RegFromModRM(*current_position));
317 } 317 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 SET_OPERAND_NAME(3, RMFromModRM(*current_position)); 355 SET_OPERAND_NAME(3, RMFromModRM(*current_position));
356 } 356 }
357 }%% 357 }%%
358 358
359 %%{ 359 %%{
360 machine operand_actions_amd64; 360 machine operand_actions_amd64;
361 361
362 include operand_actions_common 362 include operand_actions_common
363 "native_client/src/trusted/validator_ragel/unreviewed/parse_instruction.rl"; 363 "native_client/src/trusted/validator_ragel/unreviewed/parse_instruction.rl";
364 364
365 action operand0_regsize { SET_OPERAND_TYPE(0, OPERAND_SIZE_64_BIT); } 365 action operand0_regsize { SET_OPERAND_TYPE(0, OPERAND_TYPE_64_BIT); }
366 action operand1_regsize { SET_OPERAND_TYPE(1, OPERAND_SIZE_64_BIT); } 366 action operand1_regsize { SET_OPERAND_TYPE(1, OPERAND_TYPE_64_BIT); }
367 action operand2_regsize { SET_OPERAND_TYPE(2, OPERAND_SIZE_64_BIT); } 367 action operand2_regsize { SET_OPERAND_TYPE(2, OPERAND_TYPE_64_BIT); }
368 368
369 action operand0_absolute_disp { 369 action operand0_absolute_disp {
370 SET_OPERAND_NAME(0, REG_RM); 370 SET_OPERAND_NAME(0, REG_RM);
371 SET_MODRM_BASE(NO_REG); 371 SET_MODRM_BASE(NO_REG);
372 SET_MODRM_INDEX(REG_RIZ); 372 SET_MODRM_INDEX(REG_RIZ);
373 SET_MODRM_SCALE(0); 373 SET_MODRM_SCALE(0);
374 } 374 }
375 action operand0_from_modrm_reg { 375 action operand0_from_modrm_reg {
376 SET_OPERAND_NAME(0, RegFromModRM(*current_position) | 376 SET_OPERAND_NAME(0, RegFromModRM(*current_position) |
377 RegisterExtentionFromREX(GET_REX_PREFIX()) | 377 RegisterExtentionFromREX(GET_REX_PREFIX()) |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 action rel8_operand_end { } 878 action rel8_operand_end { }
879 action rel16_operand_begin { } 879 action rel16_operand_begin { }
880 action rel16_operand_end { } 880 action rel16_operand_end { }
881 action rel32_operand_begin { } 881 action rel32_operand_begin { }
882 action rel32_operand_end { } 882 action rel32_operand_end { }
883 883
884 rel8 = any >rel8_operand_begin @rel8_operand_end; 884 rel8 = any >rel8_operand_begin @rel8_operand_end;
885 rel16 = any{2} @~rel16_operand_begin @rel16_operand_end; 885 rel16 = any{2} @~rel16_operand_begin @rel16_operand_end;
886 rel32 = any{4} @~rel32_operand_begin @rel32_operand_end; 886 rel32 = any{4} @~rel32_operand_begin @rel32_operand_end;
887 }%% 887 }%%
888
889 %%{
890 machine decoder;
891
892 decoder = (one_instruction
893 @{
894 process_instruction(instruction_start, current_position+1, &instruction,
895 userdata);
896 instruction_start = current_position + 1;
897 SET_DISP_TYPE(DISPNONE);
898 SET_IMM_TYPE(IMMNONE);
899 SET_IMM2_TYPE(IMMNONE);
900 SET_REX_PREFIX(FALSE);
901 SET_DATA16_PREFIX(FALSE);
902 SET_LOCK_PREFIX(FALSE);
903 SET_REPNZ_PREFIX(FALSE);
904 SET_REPZ_PREFIX(FALSE);
905 SET_BRANCH_NOT_TAKEN(FALSE);
906 SET_BRANCH_TAKEN(FALSE);
907 /* Top three bis of VEX2 are inverted: see AMD/Intel manual. */
908 SET_VEX_PREFIX2(0xe0);
909 SET_VEX_PREFIX3(0x00);
910 })*
911 $!{ process_error(current_position, userdata);
912 result = FALSE;
913 goto error_detected;
914 };
915 }%%
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698