| Index: src/trusted/validator_ragel/decoder_x86_64.rl
|
| ===================================================================
|
| --- src/trusted/validator_ragel/decoder_x86_64.rl (revision 11020)
|
| +++ src/trusted/validator_ragel/decoder_x86_64.rl (working copy)
|
| @@ -21,15 +21,12 @@
|
|
|
| #include "native_client/src/include/elf32.h"
|
| #include "native_client/src/shared/utils/types.h"
|
| -#include "native_client/src/trusted/validator_ragel/unreviewed/decoder_internal.h"
|
| +#include "native_client/src/trusted/validator_ragel/decoder_internal.h"
|
|
|
| -/*
|
| - * These prefixes are only useful in AMD64 mode, but they will "cleaned up" by
|
| - * decoder's cleanup procedure in IA32 mode anyway. That's why we define them
|
| - * twice: "real" version here and "do-nothing" in decoder_x86_32.rl.
|
| - */
|
| -#define SET_REX_PREFIX(P) instruction.prefix.rex = (P)
|
| -#define SET_VEX_PREFIX2(P) vex_prefix2 = (P)
|
| +#define GET_REX_PREFIX() instruction.prefix.rex
|
| +#define SET_REX_PREFIX(PREFIX_BYTE) instruction.prefix.rex = (PREFIX_BYTE)
|
| +#define GET_VEX_PREFIX2() vex_prefix2
|
| +#define SET_VEX_PREFIX2(PREFIX_BYTE) vex_prefix2 = (PREFIX_BYTE)
|
| #define CLEAR_SPURIOUS_REX_B() \
|
| instruction.prefix.rex_b_spurious = FALSE
|
| #define SET_SPURIOUS_REX_B() \
|
| @@ -96,9 +93,9 @@
|
| process_instruction(instruction_begin, current_position + 1, &instruction,
|
| userdata);
|
| instruction_begin = current_position + 1;
|
| - SET_DISP_TYPE(DISPNONE);
|
| - SET_IMM_TYPE(IMMNONE);
|
| - SET_IMM2_TYPE(IMMNONE);
|
| + SET_DISPLACEMENT_FORMAT(DISPNONE);
|
| + SET_IMMEDIATE_FORMAT(IMMNONE);
|
| + SET_SECOND_IMMEDIATE_FORMAT(IMMNONE);
|
| SET_REX_PREFIX(FALSE);
|
| SET_DATA16_PREFIX(FALSE);
|
| SET_LOCK_PREFIX(FALSE);
|
| @@ -129,6 +126,10 @@
|
| $!report_fatal_error;
|
| }%%
|
|
|
| +/*
|
| + * The "write data" statement causes Ragel to emit the constant static data
|
| + * needed by the ragel machine.
|
| + */
|
| %% write data;
|
|
|
| int DecodeChunkAMD64(const uint8_t *data, size_t size,
|
| @@ -153,7 +154,15 @@
|
|
|
| memset(&instruction, 0, sizeof instruction);
|
|
|
| + /*
|
| + * The "write init" statement causes Ragel to emit initialization code.
|
| + * This should be executed once before the ragel machine is started.
|
| + */
|
| %% write init;
|
| + /*
|
| + * The "write exec" statement causes Ragel to emit the ragel machine's
|
| + * execution code.
|
| + */
|
| %% write exec;
|
|
|
| error_detected:
|
|
|