| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | |
| 3 * Use of this source code is governed by a BSD-style license that can be | |
| 4 * found in the LICENSE file. | |
| 5 */ | |
| 6 | |
| 7 /* | |
| 8 * API for a set of generated decoder tables to use with NaClInstIter. | |
| 9 * Allows both full and partial parsing, depending on what is defined | |
| 10 * in the generated decoder tables. | |
| 11 */ | |
| 12 | |
| 13 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_NC_DECODE_TABLES_H__ | |
| 14 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_NC_DECODE_TABLES_H__ | |
| 15 | |
| 16 #include "native_client/src/include/portability.h" | |
| 17 #include "native_client/src/trusted/validator/x86/decoder/gen/ncopcode_prefix.h" | |
| 18 #include "native_client/src/trusted/validator/x86/decoder/nc_decode_tables_types
.h" | |
| 19 #include "native_client/src/trusted/validator/x86/x86_insts.h" | |
| 20 | |
| 21 EXTERN_C_BEGIN | |
| 22 | |
| 23 struct NaClOp; | |
| 24 struct NaClInst; | |
| 25 struct NaClInstNode; | |
| 26 | |
| 27 /* The array used to look up instructions, based on matched prefix selector, | |
| 28 * the the corresponding (first) opcode byte. | |
| 29 */ | |
| 30 typedef NaClOpcodeArrayOffset | |
| 31 NaclInstTableType[NaClInstPrefixEnumSize][NCDTABLESIZE]; | |
| 32 | |
| 33 /* Defines the values used to look up an instruction in | |
| 34 * the opcode lookup table. | |
| 35 */ | |
| 36 typedef struct NaClPrefixOpcodeSelector { | |
| 37 /* The starting offset in the opcode lookup table where | |
| 38 * corresponding instructions are stored. | |
| 39 */ | |
| 40 NaClPrefixOpcodeArrayOffset table_offset; | |
| 41 /* The smallest opcode for which there is a table entry. */ | |
| 42 uint8_t first_opcode; | |
| 43 /* The largest opcode for which there is a table entry. */ | |
| 44 uint8_t last_opcode; | |
| 45 } NaClPrefixOpcodeSelector; | |
| 46 | |
| 47 /* Decoder tables used to decode instructions. */ | |
| 48 typedef struct NaClDecodeTables { | |
| 49 /* The table of operands. */ | |
| 50 const struct NaClOp* operands_table; | |
| 51 /* The table of instructions. */ | |
| 52 const struct NaClInst* opcodes_table; | |
| 53 /* The table of instructions defined for prefix/opcode entries. */ | |
| 54 const NaClOpcodeArrayOffset* opcode_entries; | |
| 55 /* The table of prefix/opcode selectors. */ | |
| 56 const NaClPrefixOpcodeSelector* opcode_selectors; | |
| 57 /* The definition of the undefined instruction. */ | |
| 58 const struct NaClInst* undefined; | |
| 59 /* The look up table that returns the corresponding prefix mask | |
| 60 * for the byte value, or zero if the byte doesn't define a valid | |
| 61 * prefix byte. | |
| 62 */ | |
| 63 const uint32_t* prefix_mask; | |
| 64 /* The trie of hard coded instructions. */ | |
| 65 const struct NaClInstNode* hard_coded; | |
| 66 } NaClDecodeTables; | |
| 67 | |
| 68 EXTERN_C_END | |
| 69 | |
| 70 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_NC_DECODE_TABLES_H__ *
/ | |
| OLD | NEW |