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

Side by Side Diff: src/trusted/validator_ragel/unreviewed/decoder_test.c

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 */
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
11 11
12 #include "native_client/src/include/elf32.h" 12 #include "native_client/src/include/elf32.h"
13 #include "native_client/src/include/elf64.h" 13 #include "native_client/src/include/elf64.h"
14 #include "native_client/src/shared/platform/nacl_check.h" 14 #include "native_client/src/shared/platform/nacl_check.h"
15 #include "native_client/src/shared/utils/types.h" 15 #include "native_client/src/shared/utils/types.h"
16 #include "native_client/src/trusted/validator_ragel/unreviewed/decoder.h" 16 #include "native_client/src/trusted/validator_ragel/decoder.h"
17 17
18 /* This is a copy of NaClLog from shared/platform/nacl_log.c to avoid 18 /* This is a copy of NaClLog from shared/platform/nacl_log.c to avoid
19 * linking in code in NaCl shared code in the unreviewed/Makefile and be able to 19 * linking in code in NaCl shared code in the unreviewed/Makefile and be able to
20 * use CHECK(). 20 * use CHECK().
21 21
22 * TODO(khim): remove the copy of NaClLog implementation as soon as 22 * TODO(khim): remove the copy of NaClLog implementation as soon as
23 * unreviewed/Makefile is eliminated. 23 * unreviewed/Makefile is eliminated.
Brad Chen 2012/10/04 17:26:04 Will this change be in this CL or in a subsequent
khim 2012/10/05 08:22:53 It'll be in subsequent CL. Or maybe (most probably
24 */ 24 */
25 void NaClLog(int detail_level, char const *fmt, ...) { 25 void NaClLog(int detail_level, char const *fmt, ...) {
26 va_list ap; 26 va_list ap;
27 27
28 UNREFERENCED_PARAMETER(detail_level); 28 UNREFERENCED_PARAMETER(detail_level);
29 va_start(ap, fmt); 29 va_start(ap, fmt);
30 vfprintf(stderr, fmt, ap); 30 vfprintf(stderr, fmt, ap);
31 exit(1); 31 exit(1);
32 } 32 }
33 33
34 static void CheckBounds(unsigned char *data, size_t data_size, 34 static void CheckBounds(unsigned char *data, size_t data_size,
Brad Chen 2012/10/04 17:26:04 I don't understand what this function is for. Plea
khim 2012/10/05 08:22:53 It's used when we read the ELF file. But as I've s
35 void *ptr, size_t inside_size) { 35 void *ptr, size_t inside_size) {
36 CHECK(data <= (unsigned char *) ptr); 36 CHECK(data <= (unsigned char *) ptr);
37 CHECK((unsigned char *) ptr + inside_size <= data + data_size); 37 CHECK((unsigned char *) ptr + inside_size <= data + data_size);
38 } 38 }
39 39
40 void ReadImage(const char *filename, uint8_t **result, size_t *result_size) { 40 void ReadImage(const char *filename, uint8_t **result, size_t *result_size) {
Brad Chen 2012/10/04 17:26:04 As a reader it's a bit frustrating to have a proce
41 FILE *fp; 41 FILE *fp;
42 uint8_t *data; 42 uint8_t *data;
43 size_t file_size; 43 size_t file_size;
44 size_t got; 44 size_t got;
45 45
46 fp = fopen(filename, "rb"); 46 fp = fopen(filename, "rb");
47 if (fp == NULL) { 47 if (fp == NULL) {
48 fprintf(stderr, "Failed to open input file: %s\n", filename); 48 fprintf(stderr, "Failed to open input file: %s\n", filename);
49 exit(1); 49 exit(1);
50 } 50 }
(...skipping 19 matching lines...) Expand all
70 *result_size = file_size; 70 *result_size = file_size;
71 } 71 }
72 72
73 struct DecodeState { 73 struct DecodeState {
74 uint8_t width; 74 uint8_t width;
75 const uint8_t *fwait; /* Set to true if fwait is detetected. */ 75 const uint8_t *fwait; /* Set to true if fwait is detetected. */
76 const uint8_t *offset; 76 const uint8_t *offset;
77 int ia32_mode; 77 int ia32_mode;
78 }; 78 };
79 79
80 void ProcessInstruction(const uint8_t *begin, const uint8_t *end, 80 void ProcessInstruction(const uint8_t *begin, const uint8_t *end,
Brad Chen 2012/10/04 17:26:04 This procedure is way too long. Please factor it i
Brad Chen 2012/10/22 21:29:05 Looks to me like you didn't take care of this requ
81 struct instruction *instruction, void *userdata) { 81 struct Instruction *instruction, void *userdata) {
82 const char *instruction_name = instruction->name; 82 const char *instruction_name = instruction->name;
83 unsigned char operands_count = instruction->operands_count; 83 unsigned char operands_count = instruction->operands_count;
84 unsigned char rex_prefix = instruction->prefix.rex; 84 unsigned char rex_prefix = instruction->prefix.rex;
85 enum register_name rm_index = instruction->rm.index; 85 enum OperandName rm_index = instruction->rm.index;
86 enum register_name rm_base = instruction->rm.base; 86 enum OperandName rm_base = instruction->rm.base;
87 #ifdef _MSC_VER 87 #ifdef _MSC_VER
88 Bool data16_prefix = instruction->prefix.data16; 88 Bool data16_prefix = instruction->prefix.data16;
Brad Chen 2012/10/04 17:26:04 Again, it is really awful that you have to declare
khim 2012/10/05 08:22:53 Done.
89 #else 89 #else
90 _Bool data16_prefix = instruction->prefix.data16; 90 _Bool data16_prefix = instruction->prefix.data16;
91 #endif 91 #endif
92 const uint8_t *p; 92 const uint8_t *p;
93 char delimeter = ' '; 93 char delimeter = ' ';
94 int print_rip = FALSE; 94 int print_rip = FALSE;
95 int rex_bits = 0; 95 int rex_bits = 0;
96 int maybe_rex_bits = 0; 96 int maybe_rex_bits = 0;
97 int show_name_suffix = FALSE; 97 int show_name_suffix = FALSE;
98 int empty_rex_prefix_ok = FALSE; 98 int empty_rex_prefix_ok = FALSE;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 if (operands_count > 0) { 236 if (operands_count > 0) {
237 char rexw_counted = FALSE; 237 char rexw_counted = FALSE;
238 show_name_suffix = TRUE; 238 show_name_suffix = TRUE;
239 for (i=operands_count-1; i>=0; --i) { 239 for (i=operands_count-1; i>=0; --i) {
240 if (instruction->operands[i].name == JMP_TO) { 240 if (instruction->operands[i].name == JMP_TO) {
241 /* Most control flow instructions never use suffixes, but "call" and 241 /* Most control flow instructions never use suffixes, but "call" and
242 "jmp" do... unless byte offset is used. */ 242 "jmp" do... unless byte offset is used. */
243 if ((!strcmp(instruction_name, "call")) || 243 if ((!strcmp(instruction_name, "call")) ||
244 (!strcmp(instruction_name, "jmp"))) { 244 (!strcmp(instruction_name, "jmp"))) {
245 switch (instruction->operands[i].type) { 245 switch (instruction->operands[i].type) {
246 case OPERAND_SIZE_8_BIT: show_name_suffix = FALSE; break; 246 case OPERAND_TYPE_8_BIT: show_name_suffix = FALSE; break;
247 case OPERAND_SIZE_16_BIT: show_name_suffix = 'w'; break; 247 case OPERAND_TYPE_16_BIT: show_name_suffix = 'w'; break;
248 case OPERAND_SIZE_32_BIT: 248 case OPERAND_TYPE_32_BIT:
249 if (((struct DecodeState *)userdata)->ia32_mode) { 249 if (((struct DecodeState *)userdata)->ia32_mode) {
250 show_name_suffix = FALSE; 250 show_name_suffix = FALSE;
251 } else { 251 } else {
252 show_name_suffix = 'q'; 252 show_name_suffix = 'q';
253 rex_bits += (rex_prefix & 0x08) >> 3; 253 rex_bits += (rex_prefix & 0x08) >> 3;
254 rexw_counted = TRUE; 254 rexw_counted = TRUE;
255 } 255 }
256 break; 256 break;
257 case OPERAND_SIZE_2_BIT: 257 case OPERAND_TYPE_2_BIT:
258 case OPERAND_SIZE_64_BIT: 258 case OPERAND_TYPE_64_BIT:
259 case OPERAND_SIZE_128_BIT: 259 case OPERAND_TYPE_128_BIT:
260 case OPERAND_SIZE_256_BIT: 260 case OPERAND_TYPE_256_BIT:
261 case OPERAND_FLOAT_SIZE_16_BIT: 261 case OPERAND_TYPE_FLOAT_32_BIT:
262 case OPERAND_FLOAT_SIZE_32_BIT: 262 case OPERAND_TYPE_FLOAT_64_BIT:
263 case OPERAND_FLOAT_SIZE_64_BIT: 263 case OPERAND_TYPE_FLOAT_80_BIT:
264 case OPERAND_FLOAT_SIZE_80_BIT: 264 case OPERAND_TYPE_X87_16_BIT:
265 case OPERAND_X87_SIZE_16_BIT: 265 case OPERAND_TYPE_X87_32_BIT:
266 case OPERAND_X87_SIZE_32_BIT: 266 case OPERAND_TYPE_X87_64_BIT:
267 case OPERAND_X87_SIZE_64_BIT: 267 case OPERAND_TYPE_X87_BCD:
268 case OPERAND_X87_BCD: 268 case OPERAND_TYPE_X87_ENV:
269 case OPERAND_X87_ENV: 269 case OPERAND_TYPE_X87_STATE:
270 case OPERAND_X87_STATE: 270 case OPERAND_TYPE_X87_MMX_XMM_STATE:
271 case OPERAND_X87_MMX_MM_STATE: 271 case OPERAND_TYPE_ST:
272 case OPERAND_ST: 272 case OPERAND_TYPE_SELECTOR:
273 case OPERAND_SELECTOR: 273 case OPERAND_TYPE_FAR_PTR:
274 case OPERAND_FAR_PTR: 274 case OPERAND_TYPE_SEGMENT_REGISTER:
275 case OPERAND_SEGMENT_REGISTER: 275 case OPERAND_TYPE_CONTROL_REGISTER:
276 case OPERAND_CONTROL_REGISTER: 276 case OPERAND_TYPE_DEBUG_REGISTER:
277 case OPERAND_DEBUG_REGISTER: 277 case OPERAND_TYPE_MMX:
278 case OPERAND_MMX: 278 case OPERAND_TYPE_XMM:
279 case OPERAND_XMM: 279 case OPERAND_TYPE_YMM:
280 case OPERAND_YMM:
281 assert(FALSE); 280 assert(FALSE);
282 } 281 }
283 } else { 282 } else {
284 show_name_suffix = FALSE; 283 show_name_suffix = FALSE;
285 } 284 }
286 } else if ((instruction->operands[i].name == REG_IMM) || 285 } else if ((instruction->operands[i].name == REG_IMM) ||
287 (instruction->operands[i].name == REG_IMM2) || 286 (instruction->operands[i].name == REG_IMM2) ||
288 (instruction->operands[i].name == REG_RM) || 287 (instruction->operands[i].name == REG_RM) ||
289 (instruction->operands[i].name == REG_PORT_DX) || 288 (instruction->operands[i].name == REG_PORT_DX) ||
290 (instruction->operands[i].name == REG_ES_RDI) || 289 (instruction->operands[i].name == REG_ES_RDI) ||
291 (instruction->operands[i].name == REG_DS_RSI)) { 290 (instruction->operands[i].name == REG_DS_RSI)) {
292 if (show_name_suffix) { 291 if (show_name_suffix) {
293 switch (instruction->operands[i].type) { 292 switch (instruction->operands[i].type) {
294 case OPERAND_SIZE_8_BIT: show_name_suffix = 'b'; break; 293 case OPERAND_TYPE_8_BIT: show_name_suffix = 'b'; break;
295 case OPERAND_SIZE_16_BIT: show_name_suffix = 'w'; break; 294 case OPERAND_TYPE_16_BIT: show_name_suffix = 'w'; break;
296 case OPERAND_SIZE_32_BIT: show_name_suffix = 'l'; break; 295 case OPERAND_TYPE_32_BIT: show_name_suffix = 'l'; break;
297 case OPERAND_SIZE_64_BIT: show_name_suffix = 'q'; break; 296 case OPERAND_TYPE_64_BIT: show_name_suffix = 'q'; break;
298 case OPERAND_FLOAT_SIZE_32_BIT: show_name_suffix = 's'; break; 297 case OPERAND_TYPE_FLOAT_32_BIT: show_name_suffix = 's'; break;
299 case OPERAND_FLOAT_SIZE_64_BIT: show_name_suffix = 'l'; break; 298 case OPERAND_TYPE_FLOAT_64_BIT: show_name_suffix = 'l'; break;
300 case OPERAND_FLOAT_SIZE_80_BIT:show_name_suffix = 't'; break; 299 case OPERAND_TYPE_FLOAT_80_BIT:show_name_suffix = 't'; break;
301 case OPERAND_X87_SIZE_32_BIT: show_name_suffix = 'l'; break; 300 case OPERAND_TYPE_X87_32_BIT: show_name_suffix = 'l'; break;
302 case OPERAND_X87_SIZE_64_BIT: show_name_suffix = 'L'; break; 301 case OPERAND_TYPE_X87_64_BIT: show_name_suffix = 'L'; break;
303 case OPERAND_SIZE_2_BIT: 302 case OPERAND_TYPE_2_BIT:
304 case OPERAND_X87_SIZE_16_BIT: 303 case OPERAND_TYPE_X87_16_BIT:
305 case OPERAND_X87_BCD: 304 case OPERAND_TYPE_X87_BCD:
306 case OPERAND_X87_ENV: 305 case OPERAND_TYPE_X87_ENV:
307 case OPERAND_X87_STATE: 306 case OPERAND_TYPE_X87_STATE:
308 case OPERAND_X87_MMX_MM_STATE: 307 case OPERAND_TYPE_X87_MMX_XMM_STATE:
309 case OPERAND_SIZE_128_BIT: 308 case OPERAND_TYPE_128_BIT:
310 case OPERAND_SIZE_256_BIT: 309 case OPERAND_TYPE_256_BIT:
311 case OPERAND_FAR_PTR: 310 case OPERAND_TYPE_FAR_PTR:
312 case OPERAND_MMX: 311 case OPERAND_TYPE_MMX:
313 case OPERAND_XMM: 312 case OPERAND_TYPE_XMM:
314 case OPERAND_YMM: 313 case OPERAND_TYPE_YMM:
315 case OPERAND_SELECTOR: show_name_suffix = FALSE; break; 314 case OPERAND_TYPE_SELECTOR: show_name_suffix = FALSE; break;
316 case OPERAND_FLOAT_SIZE_16_BIT: 315 case OPERAND_TYPE_ST:
317 case OPERAND_ST: 316 case OPERAND_TYPE_SEGMENT_REGISTER:
318 case OPERAND_SEGMENT_REGISTER: 317 case OPERAND_TYPE_CONTROL_REGISTER:
319 case OPERAND_CONTROL_REGISTER: 318 case OPERAND_TYPE_DEBUG_REGISTER:
320 case OPERAND_DEBUG_REGISTER:
321 assert(FALSE); 319 assert(FALSE);
322 } 320 }
323 } 321 }
324 } else { 322 } else {
325 /* "Empty" rex prefix (0x40) is used to select "sil"/"dil"/"spl"/"bpl". 323 /* "Empty" rex prefix (0x40) is used to select "sil"/"dil"/"spl"/"bpl".
326 */ 324 */
327 if (instruction->operands[i].type == OPERAND_SIZE_8_BIT && 325 if (instruction->operands[i].type == OPERAND_TYPE_8_BIT &&
328 instruction->operands[i].name <= REG_R15) { 326 instruction->operands[i].name <= REG_R15) {
329 empty_rex_prefix_ok = TRUE; 327 empty_rex_prefix_ok = TRUE;
330 } 328 }
331 /* First argument of "rcl"/"rcr"/"rol"/"ror"/"sar/""shl"/"shr" 329 /* First argument of "rcl"/"rcr"/"rol"/"ror"/"sar/""shl"/"shr"
332 can not be used to determine size of command. */ 330 can not be used to determine size of command. */
333 if (((i != 1) || (strcmp(instruction_name, "rcl") && 331 if (((i != 1) || (strcmp(instruction_name, "rcl") &&
334 strcmp(instruction_name, "rcr") && 332 strcmp(instruction_name, "rcr") &&
335 strcmp(instruction_name, "rol") && 333 strcmp(instruction_name, "rol") &&
336 strcmp(instruction_name, "ror") && 334 strcmp(instruction_name, "ror") &&
337 strcmp(instruction_name, "sal") && 335 strcmp(instruction_name, "sal") &&
338 strcmp(instruction_name, "sar") && 336 strcmp(instruction_name, "sar") &&
339 strcmp(instruction_name, "shl") && 337 strcmp(instruction_name, "shl") &&
340 strcmp(instruction_name, "shr"))) && 338 strcmp(instruction_name, "shr"))) &&
341 /* Second argument of "crc32" can not be used to determine size of 339 /* Second argument of "crc32" can not be used to determine size of
342 command. */ 340 command. */
343 ((i != 0) || strcmp(instruction_name, "crc32"))) { 341 ((i != 0) || strcmp(instruction_name, "crc32"))) {
344 show_name_suffix = FALSE; 342 show_name_suffix = FALSE;
345 } 343 }
346 /* First argument of "crc32" can be used for that but objdump uses 344 /* First argument of "crc32" can be used for that but objdump uses
347 suffix anyway. */ 345 suffix anyway. */
348 if ((i == 1) && (!strcmp(instruction_name, "crc32"))) { 346 if ((i == 1) && (!strcmp(instruction_name, "crc32"))) {
349 switch (instruction->operands[i].type) { 347 switch (instruction->operands[i].type) {
350 case OPERAND_SIZE_8_BIT: show_name_suffix = 'b'; break; 348 case OPERAND_TYPE_8_BIT: show_name_suffix = 'b'; break;
351 case OPERAND_SIZE_16_BIT: show_name_suffix = 'w'; break; 349 case OPERAND_TYPE_16_BIT: show_name_suffix = 'w'; break;
352 case OPERAND_SIZE_32_BIT: show_name_suffix = 'l'; break; 350 case OPERAND_TYPE_32_BIT: show_name_suffix = 'l'; break;
353 case OPERAND_SIZE_64_BIT: show_name_suffix = 'q'; break; 351 case OPERAND_TYPE_64_BIT: show_name_suffix = 'q'; break;
354 case OPERAND_SIZE_2_BIT: 352 case OPERAND_TYPE_2_BIT:
355 case OPERAND_SIZE_128_BIT: 353 case OPERAND_TYPE_128_BIT:
356 case OPERAND_SIZE_256_BIT: 354 case OPERAND_TYPE_256_BIT:
357 case OPERAND_FLOAT_SIZE_16_BIT: 355 case OPERAND_TYPE_FLOAT_32_BIT:
358 case OPERAND_FLOAT_SIZE_32_BIT: 356 case OPERAND_TYPE_FLOAT_64_BIT:
359 case OPERAND_FLOAT_SIZE_64_BIT: 357 case OPERAND_TYPE_FLOAT_80_BIT:
360 case OPERAND_FLOAT_SIZE_80_BIT: 358 case OPERAND_TYPE_X87_16_BIT:
361 case OPERAND_X87_SIZE_16_BIT: 359 case OPERAND_TYPE_X87_32_BIT:
362 case OPERAND_X87_SIZE_32_BIT: 360 case OPERAND_TYPE_X87_64_BIT:
363 case OPERAND_X87_SIZE_64_BIT: 361 case OPERAND_TYPE_X87_BCD:
364 case OPERAND_X87_BCD: 362 case OPERAND_TYPE_X87_ENV:
365 case OPERAND_X87_ENV: 363 case OPERAND_TYPE_X87_STATE:
366 case OPERAND_X87_STATE: 364 case OPERAND_TYPE_X87_MMX_XMM_STATE:
367 case OPERAND_X87_MMX_MM_STATE: 365 case OPERAND_TYPE_ST:
368 case OPERAND_ST: 366 case OPERAND_TYPE_SELECTOR:
369 case OPERAND_SELECTOR: 367 case OPERAND_TYPE_FAR_PTR:
370 case OPERAND_FAR_PTR: 368 case OPERAND_TYPE_SEGMENT_REGISTER:
371 case OPERAND_SEGMENT_REGISTER: 369 case OPERAND_TYPE_CONTROL_REGISTER:
372 case OPERAND_CONTROL_REGISTER: 370 case OPERAND_TYPE_DEBUG_REGISTER:
373 case OPERAND_DEBUG_REGISTER: 371 case OPERAND_TYPE_MMX:
374 case OPERAND_MMX: 372 case OPERAND_TYPE_XMM:
375 case OPERAND_XMM: 373 case OPERAND_TYPE_YMM:
376 case OPERAND_YMM:
377 assert(FALSE); 374 assert(FALSE);
378 } 375 }
379 } 376 }
380 } 377 }
381 if ((instruction->operands[i].name >= REG_R8) && 378 if ((instruction->operands[i].name >= REG_R8) &&
382 (instruction->operands[i].name <= REG_R15) && 379 (instruction->operands[i].name <= REG_R15) &&
383 (instruction->operands[i].type != OPERAND_MMX)) { 380 (instruction->operands[i].type != OPERAND_TYPE_MMX)) {
384 if (!((struct DecodeState *)userdata)->ia32_mode) { 381 if (!((struct DecodeState *)userdata)->ia32_mode) {
385 ++rex_bits; 382 ++rex_bits;
386 /* HACK: objdump mistakenly allows "lock" with "mov %crX,%rXX" only in 383 /* HACK: objdump mistakenly allows "lock" with "mov %crX,%rXX" only in
387 32bit mode. It's perfectly valid in 64bit mode, too, so instead of 384 32bit mode. It's perfectly valid in 64bit mode, too, so instead of
388 changing the decoder we fix it here. */ 385 changing the decoder we fix it here. */
389 if (instruction->operands[i].type == OPERAND_CONTROL_REGISTER) { 386 if (instruction->operands[i].type == OPERAND_TYPE_CONTROL_REGISTER) {
390 if ((*begin == 0xf0) && !(instruction->prefix.lock)) { 387 if ((*begin == 0xf0) && !(instruction->prefix.lock)) {
391 print_name("lock "); 388 print_name("lock ");
392 if (!(rex_prefix & 0x04)) { 389 if (!(rex_prefix & 0x04)) {
393 instruction->operands[i].name -= 8; 390 instruction->operands[i].name -= 8;
394 --rex_bits; 391 --rex_bits;
395 } 392 }
396 } 393 }
397 } 394 }
398 } 395 }
399 } else if (instruction->operands[i].name == REG_RM) { 396 } else if (instruction->operands[i].name == REG_RM) {
400 if ((rm_base >= REG_R8) && 397 if ((rm_base >= REG_R8) &&
401 (rm_base <= REG_R15)) { 398 (rm_base <= REG_R15)) {
402 ++rex_bits; 399 ++rex_bits;
403 } else if ((rm_base == NO_REG) || 400 } else if ((rm_base == NO_REG) ||
404 (rm_base == REG_RIP)) { 401 (rm_base == REG_RIP)) {
405 if (strcmp(instruction_name, "movabs")) 402 if (strcmp(instruction_name, "movabs"))
406 ++maybe_rex_bits; 403 ++maybe_rex_bits;
407 } 404 }
408 if ((rm_index >= REG_R8) && 405 if ((rm_index >= REG_R8) &&
409 (rm_index <= REG_R15)) { 406 (rm_index <= REG_R15)) {
410 ++rex_bits; 407 ++rex_bits;
411 } 408 }
412 } 409 }
413 if ((instruction->operands[i].type == OPERAND_SIZE_64_BIT) && 410 if ((instruction->operands[i].type == OPERAND_TYPE_64_BIT) &&
Brad Chen 2012/10/22 21:29:05 The disappearance of this next large block of code
414 !rexw_counted) { 411 !rexw_counted) {
415 if (strcmp(instruction_name, "callq") && 412 if (strcmp(instruction_name, "callq") &&
Brad Chen 2012/10/04 17:26:04 Please break this if statement out into its own fu
416 strcmp(instruction_name, "cmpxchg8b") && 413 strcmp(instruction_name, "cmpxchg8b") &&
417 strcmp(instruction_name, "cvtpi2ps") && 414 strcmp(instruction_name, "cvtpi2ps") &&
418 strcmp(instruction_name, "cvtpi2pd") && 415 strcmp(instruction_name, "cvtpi2pd") &&
419 (strcmp(instruction_name, "extractps") || 416 (strcmp(instruction_name, "extractps") ||
420 instruction->operands[i].name != REG_RM) && 417 instruction->operands[i].name != REG_RM) &&
421 strcmp(instruction_name, "jmpq") && 418 strcmp(instruction_name, "jmpq") &&
422 strcmp(instruction_name, "monitor") && 419 strcmp(instruction_name, "monitor") &&
423 strcmp(instruction_name, "movntq") && 420 strcmp(instruction_name, "movntq") &&
424 strcmp(instruction_name, "movhpd") && 421 strcmp(instruction_name, "movhpd") &&
425 strcmp(instruction_name, "movhps") && 422 strcmp(instruction_name, "movhps") &&
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 strcmp(instruction_name, "punpcklqdq") && 540 strcmp(instruction_name, "punpcklqdq") &&
544 strcmp(instruction_name, "punpcklwd") && 541 strcmp(instruction_name, "punpcklwd") &&
545 strcmp(instruction_name, "push") && 542 strcmp(instruction_name, "push") &&
546 strcmp(instruction_name, "pxor") && 543 strcmp(instruction_name, "pxor") &&
547 strcmp(instruction_name, "unpckhpd") && 544 strcmp(instruction_name, "unpckhpd") &&
548 strcmp(instruction_name, "unpcklpd")) { 545 strcmp(instruction_name, "unpcklpd")) {
549 ++rex_bits; 546 ++rex_bits;
550 rexw_counted = TRUE; 547 rexw_counted = TRUE;
551 } 548 }
552 if ((operands_count == 2) && 549 if ((operands_count == 2) &&
553 ((instruction->operands[1-i].type == OPERAND_CONTROL_REGISTER) || 550 ((instruction->operands[1-i].type == OPERAND_TYPE_CONTROL_REGISTER) ||
554 (instruction->operands[1-i].type == OPERAND_DEBUG_REGISTER))) { 551 (instruction->operands[1-i].type == OPERAND_TYPE_DEBUG_REGISTER))) {
555 --rex_bits; 552 --rex_bits;
556 } 553 }
557 } 554 }
558 if ((instruction->operands[i].type == OPERAND_SIZE_128_BIT) && 555 if ((instruction->operands[i].type == OPERAND_TYPE_128_BIT) &&
559 !rexw_counted) { 556 !rexw_counted) {
560 if (!strcmp(instruction_name, "cmpxchg16b")) { 557 if (!strcmp(instruction_name, "cmpxchg16b")) {
561 ++rex_bits; 558 ++rex_bits;
562 rexw_counted = TRUE; 559 rexw_counted = TRUE;
563 } 560 }
564 } 561 }
565 } 562 }
566 } 563 }
567 if ((!strcmp(instruction_name, "cvtsi2sd") || 564 if ((!strcmp(instruction_name, "cvtsi2sd") ||
568 !strcmp(instruction_name, "cvtsi2ss")) && 565 !strcmp(instruction_name, "cvtsi2ss")) &&
569 instruction->operands[1].name == REG_RM) { 566 instruction->operands[1].name == REG_RM) {
570 if (instruction->operands[1].type == OPERAND_SIZE_32_BIT) { 567 if (instruction->operands[1].type == OPERAND_TYPE_32_BIT) {
571 show_name_suffix = 'l'; 568 show_name_suffix = 'l';
572 } else { 569 } else {
573 show_name_suffix = 'q'; 570 show_name_suffix = 'q';
574 } 571 }
575 } 572 }
576 if ((!strcmp(instruction_name, "vcvtpd2dq") || 573 if ((!strcmp(instruction_name, "vcvtpd2dq") ||
577 !strcmp(instruction_name, "vcvtpd2ps") || 574 !strcmp(instruction_name, "vcvtpd2ps") ||
578 !strcmp(instruction_name, "vcvttpd2dq") || 575 !strcmp(instruction_name, "vcvttpd2dq") ||
579 !strcmp(instruction_name, "vcvttpd2ps")) && 576 !strcmp(instruction_name, "vcvttpd2ps")) &&
580 instruction->operands[1].name == REG_RM) { 577 instruction->operands[1].name == REG_RM) {
581 if (instruction->operands[1].type == OPERAND_SIZE_128_BIT) { 578 if (instruction->operands[1].type == OPERAND_TYPE_128_BIT) {
582 show_name_suffix = 'x'; 579 show_name_suffix = 'x';
583 } else { 580 } else {
584 show_name_suffix = 'y'; 581 show_name_suffix = 'y';
585 } 582 }
586 } 583 }
587 if ((!strcmp(instruction_name, "vcvtsi2sd") || 584 if ((!strcmp(instruction_name, "vcvtsi2sd") ||
588 !strcmp(instruction_name, "vcvtsi2ss")) && 585 !strcmp(instruction_name, "vcvtsi2ss")) &&
589 instruction->operands[2].name == REG_RM) { 586 instruction->operands[2].name == REG_RM) {
590 if (instruction->operands[2].type == OPERAND_SIZE_32_BIT) { 587 if (instruction->operands[2].type == OPERAND_TYPE_32_BIT) {
591 show_name_suffix = 'l'; 588 show_name_suffix = 'l';
592 } else { 589 } else {
593 show_name_suffix = 'q'; 590 show_name_suffix = 'q';
594 } 591 }
595 } 592 }
596 if (instruction->prefix.lock && (begin[0] == 0xf0)) { 593 if (instruction->prefix.lock && (begin[0] == 0xf0)) {
597 print_name("lock "); 594 print_name("lock ");
598 } 595 }
599 if (instruction->prefix.repnz && (begin[0] == 0xf2)) { 596 if (instruction->prefix.repnz && (begin[0] == 0xf2)) {
600 print_name("repnz "); 597 print_name("repnz ");
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 /* "callq","cmpxchg8b"/"jmpq" already include suffix in the nanme. */ 794 /* "callq","cmpxchg8b"/"jmpq" already include suffix in the nanme. */
798 if ((!strcmp(instruction_name, "callq")) || 795 if ((!strcmp(instruction_name, "callq")) ||
799 (!strcmp(instruction_name, "cmpxchg8b")) || 796 (!strcmp(instruction_name, "cmpxchg8b")) ||
800 (!strcmp(instruction_name, "jmpq"))) { 797 (!strcmp(instruction_name, "jmpq"))) {
801 show_name_suffix = FALSE; 798 show_name_suffix = FALSE;
802 } 799 }
803 } 800 }
804 if (rex_prefix & 0x08) { 801 if (rex_prefix & 0x08) {
805 /* rex.W is not shown for relative jumps with rel32 operand, but are 802 /* rex.W is not shown for relative jumps with rel32 operand, but are
806 shown for relative jumps with rel8 operands. */ 803 shown for relative jumps with rel8 operands. */
807 if ((instruction->operands[0].type == OPERAND_SIZE_32_BIT) && 804 if ((instruction->operands[0].type == OPERAND_TYPE_32_BIT) &&
808 (!strcmp(instruction_name, "ja") || 805 (!strcmp(instruction_name, "ja") ||
809 !strcmp(instruction_name, "jae") || 806 !strcmp(instruction_name, "jae") ||
810 !strcmp(instruction_name, "jb") || 807 !strcmp(instruction_name, "jb") ||
811 !strcmp(instruction_name, "jbe") || 808 !strcmp(instruction_name, "jbe") ||
812 !strcmp(instruction_name, "je") || 809 !strcmp(instruction_name, "je") ||
813 !strcmp(instruction_name, "jg") || 810 !strcmp(instruction_name, "jg") ||
814 !strcmp(instruction_name, "jge") || 811 !strcmp(instruction_name, "jge") ||
815 !strcmp(instruction_name, "jl") || 812 !strcmp(instruction_name, "jl") ||
816 !strcmp(instruction_name, "jle") || 813 !strcmp(instruction_name, "jle") ||
817 !strcmp(instruction_name, "jne") || 814 !strcmp(instruction_name, "jne") ||
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 if (show_name_suffix) { 879 if (show_name_suffix) {
883 if (show_name_suffix == 'L') { 880 if (show_name_suffix == 'L') {
884 print_name("ll"); 881 print_name("ll");
885 } else { 882 } else {
886 printf("%c", show_name_suffix); 883 printf("%c", show_name_suffix);
887 ++shown_name; 884 ++shown_name;
888 } 885 }
889 } 886 }
890 if (!strcmp(instruction_name, "mov")) { 887 if (!strcmp(instruction_name, "mov")) {
891 if ((instruction->operands[1].name == REG_IMM) && 888 if ((instruction->operands[1].name == REG_IMM) &&
892 (instruction->operands[1].type == OPERAND_SIZE_64_BIT)) { 889 (instruction->operands[1].type == OPERAND_TYPE_64_BIT)) {
893 print_name("abs"); 890 print_name("abs");
894 } 891 }
895 } 892 }
896 { 893 {
897 size_t i; 894 size_t i;
898 /* Print branch hint suffixes for conditional jump instructions (Jcc). */ 895 /* Print branch hint suffixes for conditional jump instructions (Jcc). */
899 const char* jcc_jumps[] = { 896 const char* jcc_jumps[] = {
900 "ja", "jae", "jbe", "jb", "je", "jg", "jge", "jle", 897 "ja", "jae", "jbe", "jb", "je", "jg", "jge", "jle",
901 "jl", "jne", "jno", "jnp", "jns", "jo", "jp", "js", 898 "jl", "jne", "jno", "jnp", "jns", "jo", "jp", "js",
902 "jecxz", "jrcxz", "loop", "loope", "loopne", NULL}; 899 "jecxz", "jrcxz", "loop", "loope", "loopne", NULL};
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 (!strcmp(instruction_name, "ljmpq")) || 977 (!strcmp(instruction_name, "ljmpq")) ||
981 (!strcmp(instruction_name, "lcallw")) || 978 (!strcmp(instruction_name, "lcallw")) ||
982 (!strcmp(instruction_name, "lcallq"))) { 979 (!strcmp(instruction_name, "lcallq"))) {
983 printf("*"); 980 printf("*");
984 } 981 }
985 /* Dirty hack: both AMD manual and Intel manual agree that mov from general 982 /* Dirty hack: both AMD manual and Intel manual agree that mov from general
986 purpose register to segment register has signature "mov Ew Sw", but 983 purpose register to segment register has signature "mov Ew Sw", but
987 objdump insist on 32bit/64 bit. This is clearly error in objdump so we 984 objdump insist on 32bit/64 bit. This is clearly error in objdump so we
988 fix it here and not in decoder. */ 985 fix it here and not in decoder. */
989 if ((begin[0] >= 0x48) && (begin[0] <= 0x4f) && (begin[1] == 0x8e) && 986 if ((begin[0] >= 0x48) && (begin[0] <= 0x4f) && (begin[1] == 0x8e) &&
990 (instruction->operands[i].type == OPERAND_SIZE_16_BIT)) { 987 (instruction->operands[i].type == OPERAND_TYPE_16_BIT)) {
991 operand_type = OPERAND_SIZE_64_BIT; 988 operand_type = OPERAND_TYPE_64_BIT;
992 } else if (((begin[0] == 0x8e) || 989 } else if (((begin[0] == 0x8e) ||
993 ((begin[0] >= 0x40) && (begin[0] <= 0x4f) && (begin[1] == 0x8e))) && 990 ((begin[0] >= 0x40) && (begin[0] <= 0x4f) && (begin[1] == 0x8e))) &&
994 (instruction->operands[i].type == OPERAND_SIZE_16_BIT)) { 991 (instruction->operands[i].type == OPERAND_TYPE_16_BIT)) {
995 operand_type = OPERAND_SIZE_32_BIT; 992 operand_type = OPERAND_TYPE_32_BIT;
996 } else { 993 } else {
997 operand_type = instruction->operands[i].type; 994 operand_type = instruction->operands[i].type;
998 } 995 }
999 switch (instruction->operands[i].name) { 996 switch (instruction->operands[i].name) {
1000 case REG_RAX: switch (operand_type) { 997 case REG_RAX: switch (operand_type) {
1001 case OPERAND_SIZE_8_BIT: printf("%%al"); break; 998 case OPERAND_TYPE_8_BIT: printf("%%al"); break;
1002 case OPERAND_SIZE_16_BIT: printf("%%ax"); break; 999 case OPERAND_TYPE_16_BIT: printf("%%ax"); break;
1003 case OPERAND_SIZE_32_BIT: printf("%%eax"); break; 1000 case OPERAND_TYPE_32_BIT: printf("%%eax"); break;
1004 case OPERAND_SIZE_64_BIT: printf("%%rax"); break; 1001 case OPERAND_TYPE_64_BIT: printf("%%rax"); break;
1005 case OPERAND_ST: printf("%%st(0)"); break; 1002 case OPERAND_TYPE_ST: printf("%%st(0)"); break;
1006 case OPERAND_MMX: printf("%%mm0"); break; 1003 case OPERAND_TYPE_MMX: printf("%%mm0"); break;
1007 case OPERAND_FLOAT_SIZE_32_BIT: 1004 case OPERAND_TYPE_FLOAT_32_BIT:
1008 case OPERAND_FLOAT_SIZE_64_BIT: 1005 case OPERAND_TYPE_FLOAT_64_BIT:
1009 case OPERAND_SIZE_128_BIT: 1006 case OPERAND_TYPE_128_BIT:
1010 case OPERAND_XMM: printf("%%xmm0"); break; 1007 case OPERAND_TYPE_XMM: printf("%%xmm0"); break;
1011 case OPERAND_SIZE_256_BIT: 1008 case OPERAND_TYPE_256_BIT:
1012 case OPERAND_YMM: printf("%%ymm0"); break; 1009 case OPERAND_TYPE_YMM: printf("%%ymm0"); break;
1013 case OPERAND_SEGMENT_REGISTER: printf("%%es"); break; 1010 case OPERAND_TYPE_SEGMENT_REGISTER: printf("%%es"); break;
1014 case OPERAND_CONTROL_REGISTER: printf("%%cr0"); break; 1011 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr0"); break;
1015 case OPERAND_DEBUG_REGISTER: printf("%%db0"); break; 1012 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db0"); break;
1016 default: assert(FALSE); 1013 default: assert(FALSE);
1017 } 1014 }
1018 break; 1015 break;
1019 case REG_RCX: switch (operand_type) { 1016 case REG_RCX: switch (operand_type) {
1020 case OPERAND_SIZE_8_BIT: printf("%%cl"); break; 1017 case OPERAND_TYPE_8_BIT: printf("%%cl"); break;
1021 case OPERAND_SIZE_16_BIT: printf("%%cx"); break; 1018 case OPERAND_TYPE_16_BIT: printf("%%cx"); break;
1022 case OPERAND_SIZE_32_BIT: printf("%%ecx"); break; 1019 case OPERAND_TYPE_32_BIT: printf("%%ecx"); break;
1023 case OPERAND_SIZE_64_BIT: printf("%%rcx"); break; 1020 case OPERAND_TYPE_64_BIT: printf("%%rcx"); break;
1024 case OPERAND_ST: printf("%%st(1)"); break; 1021 case OPERAND_TYPE_ST: printf("%%st(1)"); break;
1025 case OPERAND_MMX: printf("%%mm1"); break; 1022 case OPERAND_TYPE_MMX: printf("%%mm1"); break;
1026 case OPERAND_FLOAT_SIZE_32_BIT: 1023 case OPERAND_TYPE_FLOAT_32_BIT:
1027 case OPERAND_FLOAT_SIZE_64_BIT: 1024 case OPERAND_TYPE_FLOAT_64_BIT:
1028 case OPERAND_SIZE_128_BIT: 1025 case OPERAND_TYPE_128_BIT:
1029 case OPERAND_XMM: printf("%%xmm1"); break; 1026 case OPERAND_TYPE_XMM: printf("%%xmm1"); break;
1030 case OPERAND_SIZE_256_BIT: 1027 case OPERAND_TYPE_256_BIT:
1031 case OPERAND_YMM: printf("%%ymm1"); break; 1028 case OPERAND_TYPE_YMM: printf("%%ymm1"); break;
1032 case OPERAND_SEGMENT_REGISTER: printf("%%cs"); break; 1029 case OPERAND_TYPE_SEGMENT_REGISTER: printf("%%cs"); break;
1033 case OPERAND_CONTROL_REGISTER: printf("%%cr1"); break; 1030 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr1"); break;
1034 case OPERAND_DEBUG_REGISTER: printf("%%db1"); break; 1031 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db1"); break;
1035 default: assert(FALSE); 1032 default: assert(FALSE);
1036 } 1033 }
1037 break; 1034 break;
1038 case REG_RDX: switch (operand_type) { 1035 case REG_RDX: switch (operand_type) {
1039 case OPERAND_SIZE_8_BIT: printf("%%dl"); break; 1036 case OPERAND_TYPE_8_BIT: printf("%%dl"); break;
1040 case OPERAND_SIZE_16_BIT: printf("%%dx"); break; 1037 case OPERAND_TYPE_16_BIT: printf("%%dx"); break;
1041 case OPERAND_SIZE_32_BIT: printf("%%edx"); break; 1038 case OPERAND_TYPE_32_BIT: printf("%%edx"); break;
1042 case OPERAND_SIZE_64_BIT: printf("%%rdx"); break; 1039 case OPERAND_TYPE_64_BIT: printf("%%rdx"); break;
1043 case OPERAND_ST: printf("%%st(2)"); break; 1040 case OPERAND_TYPE_ST: printf("%%st(2)"); break;
1044 case OPERAND_MMX: printf("%%mm2"); break; 1041 case OPERAND_TYPE_MMX: printf("%%mm2"); break;
1045 case OPERAND_FLOAT_SIZE_32_BIT: 1042 case OPERAND_TYPE_FLOAT_32_BIT:
1046 case OPERAND_FLOAT_SIZE_64_BIT: 1043 case OPERAND_TYPE_FLOAT_64_BIT:
1047 case OPERAND_SIZE_128_BIT: 1044 case OPERAND_TYPE_128_BIT:
1048 case OPERAND_XMM: printf("%%xmm2"); break; 1045 case OPERAND_TYPE_XMM: printf("%%xmm2"); break;
1049 case OPERAND_SIZE_256_BIT: 1046 case OPERAND_TYPE_256_BIT:
1050 case OPERAND_YMM: printf("%%ymm2"); break; 1047 case OPERAND_TYPE_YMM: printf("%%ymm2"); break;
1051 case OPERAND_SEGMENT_REGISTER: printf("%%ss"); break; 1048 case OPERAND_TYPE_SEGMENT_REGISTER: printf("%%ss"); break;
1052 case OPERAND_CONTROL_REGISTER: printf("%%cr2"); break; 1049 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr2"); break;
1053 case OPERAND_DEBUG_REGISTER: printf("%%db2"); break; 1050 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db2"); break;
1054 default: assert(FALSE); 1051 default: assert(FALSE);
1055 } 1052 }
1056 break; 1053 break;
1057 case REG_RBX: switch (operand_type) { 1054 case REG_RBX: switch (operand_type) {
1058 case OPERAND_SIZE_8_BIT: printf("%%bl"); break; 1055 case OPERAND_TYPE_8_BIT: printf("%%bl"); break;
1059 case OPERAND_SIZE_16_BIT: printf("%%bx"); break; 1056 case OPERAND_TYPE_16_BIT: printf("%%bx"); break;
1060 case OPERAND_SIZE_32_BIT: printf("%%ebx"); break; 1057 case OPERAND_TYPE_32_BIT: printf("%%ebx"); break;
1061 case OPERAND_SIZE_64_BIT: printf("%%rbx"); break; 1058 case OPERAND_TYPE_64_BIT: printf("%%rbx"); break;
1062 case OPERAND_ST: printf("%%st(3)"); break; 1059 case OPERAND_TYPE_ST: printf("%%st(3)"); break;
1063 case OPERAND_MMX: printf("%%mm3"); break; 1060 case OPERAND_TYPE_MMX: printf("%%mm3"); break;
1064 case OPERAND_FLOAT_SIZE_32_BIT: 1061 case OPERAND_TYPE_FLOAT_32_BIT:
1065 case OPERAND_FLOAT_SIZE_64_BIT: 1062 case OPERAND_TYPE_FLOAT_64_BIT:
1066 case OPERAND_SIZE_128_BIT: 1063 case OPERAND_TYPE_128_BIT:
1067 case OPERAND_XMM: printf("%%xmm3"); break; 1064 case OPERAND_TYPE_XMM: printf("%%xmm3"); break;
1068 case OPERAND_SIZE_256_BIT: 1065 case OPERAND_TYPE_256_BIT:
1069 case OPERAND_YMM: printf("%%ymm3"); break; 1066 case OPERAND_TYPE_YMM: printf("%%ymm3"); break;
1070 case OPERAND_SEGMENT_REGISTER: printf("%%ds"); break; 1067 case OPERAND_TYPE_SEGMENT_REGISTER: printf("%%ds"); break;
1071 case OPERAND_CONTROL_REGISTER: printf("%%cr3"); break; 1068 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr3"); break;
1072 case OPERAND_DEBUG_REGISTER: printf("%%db3"); break; 1069 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db3"); break;
1073 default: assert(FALSE); 1070 default: assert(FALSE);
1074 } 1071 }
1075 break; 1072 break;
1076 case REG_RSP: switch (operand_type) { 1073 case REG_RSP: switch (operand_type) {
1077 case OPERAND_SIZE_8_BIT: if (rex_prefix) 1074 case OPERAND_TYPE_8_BIT: if (rex_prefix)
1078 printf("%%spl"); 1075 printf("%%spl");
1079 else 1076 else
1080 printf("%%ah"); 1077 printf("%%ah");
1081 break; 1078 break;
1082 case OPERAND_SIZE_16_BIT: printf("%%sp"); break; 1079 case OPERAND_TYPE_16_BIT: printf("%%sp"); break;
1083 case OPERAND_SIZE_32_BIT: printf("%%esp"); break; 1080 case OPERAND_TYPE_32_BIT: printf("%%esp"); break;
1084 case OPERAND_SIZE_64_BIT: printf("%%rsp"); break; 1081 case OPERAND_TYPE_64_BIT: printf("%%rsp"); break;
1085 case OPERAND_ST: printf("%%st(4)"); break; 1082 case OPERAND_TYPE_ST: printf("%%st(4)"); break;
1086 case OPERAND_MMX: printf("%%mm4"); break; 1083 case OPERAND_TYPE_MMX: printf("%%mm4"); break;
1087 case OPERAND_FLOAT_SIZE_32_BIT: 1084 case OPERAND_TYPE_FLOAT_32_BIT:
1088 case OPERAND_FLOAT_SIZE_64_BIT: 1085 case OPERAND_TYPE_FLOAT_64_BIT:
1089 case OPERAND_SIZE_128_BIT: 1086 case OPERAND_TYPE_128_BIT:
1090 case OPERAND_XMM: printf("%%xmm4"); break; 1087 case OPERAND_TYPE_XMM: printf("%%xmm4"); break;
1091 case OPERAND_SIZE_256_BIT: 1088 case OPERAND_TYPE_256_BIT:
1092 case OPERAND_YMM: printf("%%ymm4"); break; 1089 case OPERAND_TYPE_YMM: printf("%%ymm4"); break;
1093 case OPERAND_SEGMENT_REGISTER: printf("%%fs"); break; 1090 case OPERAND_TYPE_SEGMENT_REGISTER: printf("%%fs"); break;
1094 case OPERAND_CONTROL_REGISTER: printf("%%cr4"); break; 1091 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr4"); break;
1095 case OPERAND_DEBUG_REGISTER: printf("%%db4"); break; 1092 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db4"); break;
1096 default: assert(FALSE); 1093 default: assert(FALSE);
1097 } 1094 }
1098 break; 1095 break;
1099 case REG_RBP: switch (operand_type) { 1096 case REG_RBP: switch (operand_type) {
1100 case OPERAND_SIZE_8_BIT: if (rex_prefix) 1097 case OPERAND_TYPE_8_BIT: if (rex_prefix)
1101 printf("%%bpl"); 1098 printf("%%bpl");
1102 else 1099 else
1103 printf("%%ch"); 1100 printf("%%ch");
1104 break; 1101 break;
1105 case OPERAND_SIZE_16_BIT: printf("%%bp"); break; 1102 case OPERAND_TYPE_16_BIT: printf("%%bp"); break;
1106 case OPERAND_SIZE_32_BIT: printf("%%ebp"); break; 1103 case OPERAND_TYPE_32_BIT: printf("%%ebp"); break;
1107 case OPERAND_SIZE_64_BIT: printf("%%rbp"); break; 1104 case OPERAND_TYPE_64_BIT: printf("%%rbp"); break;
1108 case OPERAND_ST: printf("%%st(5)"); break; 1105 case OPERAND_TYPE_ST: printf("%%st(5)"); break;
1109 case OPERAND_MMX: printf("%%mm5"); break; 1106 case OPERAND_TYPE_MMX: printf("%%mm5"); break;
1110 case OPERAND_FLOAT_SIZE_32_BIT: 1107 case OPERAND_TYPE_FLOAT_32_BIT:
1111 case OPERAND_FLOAT_SIZE_64_BIT: 1108 case OPERAND_TYPE_FLOAT_64_BIT:
1112 case OPERAND_SIZE_128_BIT: 1109 case OPERAND_TYPE_128_BIT:
1113 case OPERAND_XMM: printf("%%xmm5"); break; 1110 case OPERAND_TYPE_XMM: printf("%%xmm5"); break;
1114 case OPERAND_SIZE_256_BIT: 1111 case OPERAND_TYPE_256_BIT:
1115 case OPERAND_YMM: printf("%%ymm5"); break; 1112 case OPERAND_TYPE_YMM: printf("%%ymm5"); break;
1116 case OPERAND_SEGMENT_REGISTER: printf("%%gs"); break; 1113 case OPERAND_TYPE_SEGMENT_REGISTER: printf("%%gs"); break;
1117 case OPERAND_CONTROL_REGISTER: printf("%%cr5"); break; 1114 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr5"); break;
1118 case OPERAND_DEBUG_REGISTER: printf("%%db5"); break; 1115 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db5"); break;
1119 default: assert(FALSE); 1116 default: assert(FALSE);
1120 } 1117 }
1121 break; 1118 break;
1122 case REG_RSI: switch (operand_type) { 1119 case REG_RSI: switch (operand_type) {
1123 case OPERAND_SIZE_8_BIT: if (rex_prefix) 1120 case OPERAND_TYPE_8_BIT: if (rex_prefix)
1124 printf("%%sil"); 1121 printf("%%sil");
1125 else 1122 else
1126 printf("%%dh"); 1123 printf("%%dh");
1127 break; 1124 break;
1128 case OPERAND_SIZE_16_BIT: printf("%%si"); break; 1125 case OPERAND_TYPE_16_BIT: printf("%%si"); break;
1129 case OPERAND_SIZE_32_BIT: printf("%%esi"); break; 1126 case OPERAND_TYPE_32_BIT: printf("%%esi"); break;
1130 case OPERAND_SIZE_64_BIT: printf("%%rsi"); break; 1127 case OPERAND_TYPE_64_BIT: printf("%%rsi"); break;
1131 case OPERAND_ST: printf("%%st(6)"); break; 1128 case OPERAND_TYPE_ST: printf("%%st(6)"); break;
1132 case OPERAND_MMX: printf("%%mm6"); break; 1129 case OPERAND_TYPE_MMX: printf("%%mm6"); break;
1133 case OPERAND_FLOAT_SIZE_32_BIT: 1130 case OPERAND_TYPE_FLOAT_32_BIT:
1134 case OPERAND_FLOAT_SIZE_64_BIT: 1131 case OPERAND_TYPE_FLOAT_64_BIT:
1135 case OPERAND_SIZE_128_BIT: 1132 case OPERAND_TYPE_128_BIT:
1136 case OPERAND_XMM: printf("%%xmm6"); break; 1133 case OPERAND_TYPE_XMM: printf("%%xmm6"); break;
1137 case OPERAND_SIZE_256_BIT: 1134 case OPERAND_TYPE_256_BIT:
1138 case OPERAND_YMM: printf("%%ymm6"); break; 1135 case OPERAND_TYPE_YMM: printf("%%ymm6"); break;
1139 case OPERAND_CONTROL_REGISTER: printf("%%cr6"); break; 1136 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr6"); break;
1140 case OPERAND_DEBUG_REGISTER: printf("%%db6"); break; 1137 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db6"); break;
1141 default: assert(FALSE); 1138 default: assert(FALSE);
1142 } 1139 }
1143 break; 1140 break;
1144 case REG_RDI: switch (operand_type) { 1141 case REG_RDI: switch (operand_type) {
1145 case OPERAND_SIZE_8_BIT: if (rex_prefix) 1142 case OPERAND_TYPE_8_BIT: if (rex_prefix)
1146 printf("%%dil"); 1143 printf("%%dil");
1147 else 1144 else
1148 printf("%%bh"); 1145 printf("%%bh");
1149 break; 1146 break;
1150 case OPERAND_SIZE_16_BIT: printf("%%di"); break; 1147 case OPERAND_TYPE_16_BIT: printf("%%di"); break;
1151 case OPERAND_SIZE_32_BIT: printf("%%edi"); break; 1148 case OPERAND_TYPE_32_BIT: printf("%%edi"); break;
1152 case OPERAND_SIZE_64_BIT: printf("%%rdi"); break; 1149 case OPERAND_TYPE_64_BIT: printf("%%rdi"); break;
1153 case OPERAND_ST: printf("%%st(7)"); break; 1150 case OPERAND_TYPE_ST: printf("%%st(7)"); break;
1154 case OPERAND_MMX: printf("%%mm7"); break; 1151 case OPERAND_TYPE_MMX: printf("%%mm7"); break;
1155 case OPERAND_FLOAT_SIZE_32_BIT: 1152 case OPERAND_TYPE_FLOAT_32_BIT:
1156 case OPERAND_FLOAT_SIZE_64_BIT: 1153 case OPERAND_TYPE_FLOAT_64_BIT:
1157 case OPERAND_SIZE_128_BIT: 1154 case OPERAND_TYPE_128_BIT:
1158 case OPERAND_XMM: printf("%%xmm7"); break; 1155 case OPERAND_TYPE_XMM: printf("%%xmm7"); break;
1159 case OPERAND_SIZE_256_BIT: 1156 case OPERAND_TYPE_256_BIT:
1160 case OPERAND_YMM: printf("%%ymm7"); break; 1157 case OPERAND_TYPE_YMM: printf("%%ymm7"); break;
1161 case OPERAND_CONTROL_REGISTER: printf("%%cr7"); break; 1158 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr7"); break;
1162 case OPERAND_DEBUG_REGISTER: printf("%%db7"); break; 1159 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db7"); break;
1163 default: assert(FALSE); 1160 default: assert(FALSE);
1164 } 1161 }
1165 break; 1162 break;
1166 case REG_R8: switch (operand_type) { 1163 case REG_R8: switch (operand_type) {
1167 case OPERAND_SIZE_8_BIT: printf("%%r8b"); break; 1164 case OPERAND_TYPE_8_BIT: printf("%%r8b"); break;
1168 case OPERAND_SIZE_16_BIT: printf("%%r8w"); break; 1165 case OPERAND_TYPE_16_BIT: printf("%%r8w"); break;
1169 case OPERAND_SIZE_32_BIT: printf("%%r8d"); break; 1166 case OPERAND_TYPE_32_BIT: printf("%%r8d"); break;
1170 case OPERAND_SIZE_64_BIT: printf("%%r8"); break; 1167 case OPERAND_TYPE_64_BIT: printf("%%r8"); break;
1171 case OPERAND_MMX: printf("%%mm0"); break; 1168 case OPERAND_TYPE_MMX: printf("%%mm0"); break;
1172 case OPERAND_FLOAT_SIZE_32_BIT: 1169 case OPERAND_TYPE_FLOAT_32_BIT:
1173 case OPERAND_FLOAT_SIZE_64_BIT: 1170 case OPERAND_TYPE_FLOAT_64_BIT:
1174 case OPERAND_SIZE_128_BIT: 1171 case OPERAND_TYPE_128_BIT:
1175 case OPERAND_XMM: printf("%%xmm8"); break; 1172 case OPERAND_TYPE_XMM: printf("%%xmm8"); break;
1176 case OPERAND_SIZE_256_BIT: 1173 case OPERAND_TYPE_256_BIT:
1177 case OPERAND_YMM: printf("%%ymm8"); break; 1174 case OPERAND_TYPE_YMM: printf("%%ymm8"); break;
1178 case OPERAND_CONTROL_REGISTER: printf("%%cr8"); break; 1175 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr8"); break;
1179 case OPERAND_DEBUG_REGISTER: printf("%%db8"); break; 1176 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db8"); break;
1180 default: assert(FALSE); 1177 default: assert(FALSE);
1181 } 1178 }
1182 break; 1179 break;
1183 case REG_R9: switch (operand_type) { 1180 case REG_R9: switch (operand_type) {
1184 case OPERAND_SIZE_8_BIT: printf("%%r9b"); break; 1181 case OPERAND_TYPE_8_BIT: printf("%%r9b"); break;
1185 case OPERAND_SIZE_16_BIT: printf("%%r9w"); break; 1182 case OPERAND_TYPE_16_BIT: printf("%%r9w"); break;
1186 case OPERAND_SIZE_32_BIT: printf("%%r9d"); break; 1183 case OPERAND_TYPE_32_BIT: printf("%%r9d"); break;
1187 case OPERAND_SIZE_64_BIT: printf("%%r9"); break; 1184 case OPERAND_TYPE_64_BIT: printf("%%r9"); break;
1188 case OPERAND_MMX: printf("%%mm1"); break; 1185 case OPERAND_TYPE_MMX: printf("%%mm1"); break;
1189 case OPERAND_FLOAT_SIZE_32_BIT: 1186 case OPERAND_TYPE_FLOAT_32_BIT:
1190 case OPERAND_FLOAT_SIZE_64_BIT: 1187 case OPERAND_TYPE_FLOAT_64_BIT:
1191 case OPERAND_SIZE_128_BIT: 1188 case OPERAND_TYPE_128_BIT:
1192 case OPERAND_XMM: printf("%%xmm9"); break; 1189 case OPERAND_TYPE_XMM: printf("%%xmm9"); break;
1193 case OPERAND_SIZE_256_BIT: 1190 case OPERAND_TYPE_256_BIT:
1194 case OPERAND_YMM: printf("%%ymm9"); break; 1191 case OPERAND_TYPE_YMM: printf("%%ymm9"); break;
1195 case OPERAND_CONTROL_REGISTER: printf("%%cr9"); break; 1192 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr9"); break;
1196 case OPERAND_DEBUG_REGISTER: printf("%%db9"); break; 1193 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db9"); break;
1197 default: assert(FALSE); 1194 default: assert(FALSE);
1198 } 1195 }
1199 break; 1196 break;
1200 case REG_R10: switch (operand_type) { 1197 case REG_R10: switch (operand_type) {
1201 case OPERAND_SIZE_8_BIT: printf("%%r10b"); break; 1198 case OPERAND_TYPE_8_BIT: printf("%%r10b"); break;
1202 case OPERAND_SIZE_16_BIT: printf("%%r10w"); break; 1199 case OPERAND_TYPE_16_BIT: printf("%%r10w"); break;
1203 case OPERAND_SIZE_32_BIT: printf("%%r10d"); break; 1200 case OPERAND_TYPE_32_BIT: printf("%%r10d"); break;
1204 case OPERAND_SIZE_64_BIT: printf("%%r10"); break; 1201 case OPERAND_TYPE_64_BIT: printf("%%r10"); break;
1205 case OPERAND_MMX: printf("%%mm2"); break; 1202 case OPERAND_TYPE_MMX: printf("%%mm2"); break;
1206 case OPERAND_FLOAT_SIZE_32_BIT: 1203 case OPERAND_TYPE_FLOAT_32_BIT:
1207 case OPERAND_FLOAT_SIZE_64_BIT: 1204 case OPERAND_TYPE_FLOAT_64_BIT:
1208 case OPERAND_SIZE_128_BIT: 1205 case OPERAND_TYPE_128_BIT:
1209 case OPERAND_XMM: printf("%%xmm10"); break; 1206 case OPERAND_TYPE_XMM: printf("%%xmm10"); break;
1210 case OPERAND_SIZE_256_BIT: 1207 case OPERAND_TYPE_256_BIT:
1211 case OPERAND_YMM: printf("%%ymm10"); break; 1208 case OPERAND_TYPE_YMM: printf("%%ymm10"); break;
1212 case OPERAND_CONTROL_REGISTER: printf("%%cr10"); break; 1209 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr10"); break;
1213 case OPERAND_DEBUG_REGISTER: printf("%%db10"); break; 1210 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db10"); break;
1214 default: assert(FALSE); 1211 default: assert(FALSE);
1215 } 1212 }
1216 break; 1213 break;
1217 case REG_R11: switch (operand_type) { 1214 case REG_R11: switch (operand_type) {
1218 case OPERAND_SIZE_8_BIT: printf("%%r11b"); break; 1215 case OPERAND_TYPE_8_BIT: printf("%%r11b"); break;
1219 case OPERAND_SIZE_16_BIT: printf("%%r11w"); break; 1216 case OPERAND_TYPE_16_BIT: printf("%%r11w"); break;
1220 case OPERAND_SIZE_32_BIT: printf("%%r11d"); break; 1217 case OPERAND_TYPE_32_BIT: printf("%%r11d"); break;
1221 case OPERAND_SIZE_64_BIT: printf("%%r11"); break; 1218 case OPERAND_TYPE_64_BIT: printf("%%r11"); break;
1222 case OPERAND_MMX: printf("%%mm3"); break; 1219 case OPERAND_TYPE_MMX: printf("%%mm3"); break;
1223 case OPERAND_FLOAT_SIZE_32_BIT: 1220 case OPERAND_TYPE_FLOAT_32_BIT:
1224 case OPERAND_FLOAT_SIZE_64_BIT: 1221 case OPERAND_TYPE_FLOAT_64_BIT:
1225 case OPERAND_SIZE_128_BIT: 1222 case OPERAND_TYPE_128_BIT:
1226 case OPERAND_XMM: printf("%%xmm11"); break; 1223 case OPERAND_TYPE_XMM: printf("%%xmm11"); break;
1227 case OPERAND_SIZE_256_BIT: 1224 case OPERAND_TYPE_256_BIT:
1228 case OPERAND_YMM: printf("%%ymm11"); break; 1225 case OPERAND_TYPE_YMM: printf("%%ymm11"); break;
1229 case OPERAND_CONTROL_REGISTER: printf("%%cr11"); break; 1226 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr11"); break;
1230 case OPERAND_DEBUG_REGISTER: printf("%%db11"); break; 1227 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db11"); break;
1231 default: assert(FALSE); 1228 default: assert(FALSE);
1232 } 1229 }
1233 break; 1230 break;
1234 case REG_R12: switch (operand_type) { 1231 case REG_R12: switch (operand_type) {
1235 case OPERAND_SIZE_8_BIT: printf("%%r12b"); break; 1232 case OPERAND_TYPE_8_BIT: printf("%%r12b"); break;
1236 case OPERAND_SIZE_16_BIT: printf("%%r12w"); break; 1233 case OPERAND_TYPE_16_BIT: printf("%%r12w"); break;
1237 case OPERAND_SIZE_32_BIT: printf("%%r12d"); break; 1234 case OPERAND_TYPE_32_BIT: printf("%%r12d"); break;
1238 case OPERAND_SIZE_64_BIT: printf("%%r12"); break; 1235 case OPERAND_TYPE_64_BIT: printf("%%r12"); break;
1239 case OPERAND_MMX: printf("%%mm4"); break; 1236 case OPERAND_TYPE_MMX: printf("%%mm4"); break;
1240 case OPERAND_FLOAT_SIZE_32_BIT: 1237 case OPERAND_TYPE_FLOAT_32_BIT:
1241 case OPERAND_FLOAT_SIZE_64_BIT: 1238 case OPERAND_TYPE_FLOAT_64_BIT:
1242 case OPERAND_SIZE_128_BIT: 1239 case OPERAND_TYPE_128_BIT:
1243 case OPERAND_XMM: printf("%%xmm12"); break; 1240 case OPERAND_TYPE_XMM: printf("%%xmm12"); break;
1244 case OPERAND_SIZE_256_BIT: 1241 case OPERAND_TYPE_256_BIT:
1245 case OPERAND_YMM: printf("%%ymm12"); break; 1242 case OPERAND_TYPE_YMM: printf("%%ymm12"); break;
1246 case OPERAND_CONTROL_REGISTER: printf("%%cr12"); break; 1243 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr12"); break;
1247 case OPERAND_DEBUG_REGISTER: printf("%%db12"); break; 1244 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db12"); break;
1248 default: assert(FALSE); 1245 default: assert(FALSE);
1249 } 1246 }
1250 break; 1247 break;
1251 case REG_R13: switch (operand_type) { 1248 case REG_R13: switch (operand_type) {
1252 case OPERAND_SIZE_8_BIT: printf("%%r13b"); break; 1249 case OPERAND_TYPE_8_BIT: printf("%%r13b"); break;
1253 case OPERAND_SIZE_16_BIT: printf("%%r13w"); break; 1250 case OPERAND_TYPE_16_BIT: printf("%%r13w"); break;
1254 case OPERAND_SIZE_32_BIT: printf("%%r13d"); break; 1251 case OPERAND_TYPE_32_BIT: printf("%%r13d"); break;
1255 case OPERAND_SIZE_64_BIT: printf("%%r13"); break; 1252 case OPERAND_TYPE_64_BIT: printf("%%r13"); break;
1256 case OPERAND_MMX: printf("%%mm5"); break; 1253 case OPERAND_TYPE_MMX: printf("%%mm5"); break;
1257 case OPERAND_FLOAT_SIZE_32_BIT: 1254 case OPERAND_TYPE_FLOAT_32_BIT:
1258 case OPERAND_FLOAT_SIZE_64_BIT: 1255 case OPERAND_TYPE_FLOAT_64_BIT:
1259 case OPERAND_SIZE_128_BIT: 1256 case OPERAND_TYPE_128_BIT:
1260 case OPERAND_XMM: printf("%%xmm13"); break; 1257 case OPERAND_TYPE_XMM: printf("%%xmm13"); break;
1261 case OPERAND_SIZE_256_BIT: 1258 case OPERAND_TYPE_256_BIT:
1262 case OPERAND_YMM: printf("%%ymm13"); break; 1259 case OPERAND_TYPE_YMM: printf("%%ymm13"); break;
1263 case OPERAND_CONTROL_REGISTER: printf("%%cr13"); break; 1260 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr13"); break;
1264 case OPERAND_DEBUG_REGISTER: printf("%%db13"); break; 1261 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db13"); break;
1265 default: assert(FALSE); 1262 default: assert(FALSE);
1266 } 1263 }
1267 break; 1264 break;
1268 case REG_R14: switch (operand_type) { 1265 case REG_R14: switch (operand_type) {
1269 case OPERAND_SIZE_8_BIT: printf("%%r14b"); break; 1266 case OPERAND_TYPE_8_BIT: printf("%%r14b"); break;
1270 case OPERAND_SIZE_16_BIT: printf("%%r14w"); break; 1267 case OPERAND_TYPE_16_BIT: printf("%%r14w"); break;
1271 case OPERAND_SIZE_32_BIT: printf("%%r14d"); break; 1268 case OPERAND_TYPE_32_BIT: printf("%%r14d"); break;
1272 case OPERAND_SIZE_64_BIT: printf("%%r14"); break; 1269 case OPERAND_TYPE_64_BIT: printf("%%r14"); break;
1273 case OPERAND_MMX: printf("%%mm6"); break; 1270 case OPERAND_TYPE_MMX: printf("%%mm6"); break;
1274 case OPERAND_FLOAT_SIZE_32_BIT: 1271 case OPERAND_TYPE_FLOAT_32_BIT:
1275 case OPERAND_FLOAT_SIZE_64_BIT: 1272 case OPERAND_TYPE_FLOAT_64_BIT:
1276 case OPERAND_SIZE_128_BIT: 1273 case OPERAND_TYPE_128_BIT:
1277 case OPERAND_XMM: printf("%%xmm14"); break; 1274 case OPERAND_TYPE_XMM: printf("%%xmm14"); break;
1278 case OPERAND_SIZE_256_BIT: 1275 case OPERAND_TYPE_256_BIT:
1279 case OPERAND_YMM: printf("%%ymm14"); break; 1276 case OPERAND_TYPE_YMM: printf("%%ymm14"); break;
1280 case OPERAND_CONTROL_REGISTER: printf("%%cr14"); break; 1277 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr14"); break;
1281 case OPERAND_DEBUG_REGISTER: printf("%%db14"); break; 1278 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db14"); break;
1282 default: assert(FALSE); 1279 default: assert(FALSE);
1283 } 1280 }
1284 break; 1281 break;
1285 case REG_R15: switch (operand_type) { 1282 case REG_R15: switch (operand_type) {
1286 case OPERAND_SIZE_8_BIT: printf("%%r15b"); break; 1283 case OPERAND_TYPE_8_BIT: printf("%%r15b"); break;
1287 case OPERAND_SIZE_16_BIT: printf("%%r15w"); break; 1284 case OPERAND_TYPE_16_BIT: printf("%%r15w"); break;
1288 case OPERAND_SIZE_32_BIT: printf("%%r15d"); break; 1285 case OPERAND_TYPE_32_BIT: printf("%%r15d"); break;
1289 case OPERAND_SIZE_64_BIT: printf("%%r15"); break; 1286 case OPERAND_TYPE_64_BIT: printf("%%r15"); break;
1290 case OPERAND_MMX: printf("%%mm7"); break; 1287 case OPERAND_TYPE_MMX: printf("%%mm7"); break;
1291 case OPERAND_FLOAT_SIZE_32_BIT: 1288 case OPERAND_TYPE_FLOAT_32_BIT:
1292 case OPERAND_FLOAT_SIZE_64_BIT: 1289 case OPERAND_TYPE_FLOAT_64_BIT:
1293 case OPERAND_SIZE_128_BIT: 1290 case OPERAND_TYPE_128_BIT:
1294 case OPERAND_XMM: printf("%%xmm15"); break; 1291 case OPERAND_TYPE_XMM: printf("%%xmm15"); break;
1295 case OPERAND_SIZE_256_BIT: 1292 case OPERAND_TYPE_256_BIT:
1296 case OPERAND_YMM: printf("%%ymm15"); break; 1293 case OPERAND_TYPE_YMM: printf("%%ymm15"); break;
1297 case OPERAND_CONTROL_REGISTER: printf("%%cr15"); break; 1294 case OPERAND_TYPE_CONTROL_REGISTER: printf("%%cr15"); break;
1298 case OPERAND_DEBUG_REGISTER: printf("%%db15"); break; 1295 case OPERAND_TYPE_DEBUG_REGISTER: printf("%%db15"); break;
1299 default: assert(FALSE); 1296 default: assert(FALSE);
1300 } 1297 }
1301 break; 1298 break;
1302 case REG_ST: 1299 case REG_ST:
1303 assert(operand_type == OPERAND_ST); 1300 assert(operand_type == OPERAND_TYPE_ST);
1304 printf("%%st"); 1301 printf("%%st");
1305 break; 1302 break;
1306 case REG_RM: { 1303 case REG_RM: {
1307 if (instruction->rm.disp_type != DISPNONE) { 1304 if (instruction->rm.disp_type != DISPNONE) {
1308 if ((instruction->rm.disp_type == DISP64) || 1305 if ((instruction->rm.disp_type == DISP64) ||
1309 (instruction->rm.offset >= 0)) 1306 (instruction->rm.offset >= 0))
1310 printf("0x%"NACL_PRIx64, instruction->rm.offset); 1307 printf("0x%"NACL_PRIx64, instruction->rm.offset);
1311 else 1308 else
1312 printf("-0x%"NACL_PRIx64, -instruction->rm.offset); 1309 printf("-0x%"NACL_PRIx64, -instruction->rm.offset);
1313 } 1310 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 } else { 1485 } else {
1489 printf("%%es:(%%rdi)"); 1486 printf("%%es:(%%rdi)");
1490 } 1487 }
1491 break; 1488 break;
1492 case REG_DS_RSI: if (((struct DecodeState *)userdata)->ia32_mode) { 1489 case REG_DS_RSI: if (((struct DecodeState *)userdata)->ia32_mode) {
1493 printf("%%ds:(%%esi)"); 1490 printf("%%ds:(%%esi)");
1494 } else { 1491 } else {
1495 printf("%%ds:(%%rsi)"); 1492 printf("%%ds:(%%rsi)");
1496 } 1493 }
1497 break; 1494 break;
1498 case JMP_TO: if (instruction->operands[0].type == OPERAND_SIZE_16_BIT) 1495 case JMP_TO: if (instruction->operands[0].type == OPERAND_TYPE_16_BIT)
1499 printf("0x%lx", (long)((end + instruction->rm.offset - 1496 printf("0x%lx", (long)((end + instruction->rm.offset -
1500 (((struct DecodeState *)userdata)->offset)) & 0xffff)); 1497 (((struct DecodeState *)userdata)->offset)) & 0xffff));
1501 else 1498 else
1502 printf("0x%lx", (long)(end + instruction->rm.offset - 1499 printf("0x%lx", (long)(end + instruction->rm.offset -
1503 (((struct DecodeState *)userdata)->offset))); 1500 (((struct DecodeState *)userdata)->offset)));
1504 break; 1501 break;
1505 case REG_RIP: 1502 case REG_RIP:
1506 case REG_RIZ: 1503 case REG_RIZ:
1507 case NO_REG: 1504 case NO_REG:
1508 assert(FALSE); 1505 assert(FALSE);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 for (index = initial_index; index < argc; ++index) { 1654 for (index = initial_index; index < argc; ++index) {
1658 const char *filename = argv[index]; 1655 const char *filename = argv[index];
1659 int rc = DecodeFile(filename, repeat_count); 1656 int rc = DecodeFile(filename, repeat_count);
1660 if (!rc) { 1657 if (!rc) {
1661 printf("file '%s' can not be fully decoded\n", filename); 1658 printf("file '%s' can not be fully decoded\n", filename);
1662 return 1; 1659 return 1;
1663 } 1660 }
1664 } 1661 }
1665 return 0; 1662 return 0;
1666 } 1663 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698