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

Side by Side Diff: src/trusted/validator/x86/decoder/generator/nc_compress.h

Issue 625923004: Delete old x86 validator. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: rebase master Created 6 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
(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 to compressing tables of modeled instructions.
9 */
10
11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_GENERATOR_NC_COMPRESS_H_ _
12 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_GENERATOR_NC_COMPRESS_H_ _
13
14 #include "native_client/src/trusted/validator/x86/decoder/generator/ncdecode_tab legen.h"
15 #include "native_client/src/trusted/validator/x86/decoder/nc_decode_tables.h"
16
17 /* Define the maximum number of instruction operands (over
18 * all instructions) we will allow. Note: before compression,
19 * there should a little less than 3000 operands. Hence,
20 * 10000 is a (very) safe value to use as a limit, and should
21 * not need to be changed. Also, the table generator will
22 * complain (and then fail) if this number is exceeded. If that
23 * happens, update this constant as is appropriate.
24 */
25 #define NACL_MAX_OPERANDS_TOTAL 10000
26
27 /* Define the maximum number of instructions we will allow.
28 * Note: before compression there should be less than 3000
29 * instructions. Hence, 10000 is a (very) safe value to use
30 * as a limit, and should not need to be changed. Also, the
31 * table generator will complain (and then fail) if this number
32 * is exceeded. If that happens, update this constant as
33 * is appropriate.
34 */
35 #define NACL_MAX_INSTRUCTIONS_TOTAL 10000
36
37 /* Define the maximum number of prefix/opcode entries that
38 * we will allow. Note: before compression there are
39 * 256 * NaClInstPrefixEnumSize(19) = 4864 entries.
40 * Hence, 100000 is a (very) safe value to use as a limit,
41 * and should not need to be changed. Also, the
42 * table generator will complain (and then fail) if this number
43 * is exceeded. If that happens, update this constant as
44 * is appropriate.
45 */
46 #define NACL_MAX_PREFIX_OPCODE_ENTRIES 10000
47
48 /* The type for the array used to look up instructions, based on matched
49 * prefix selector and the corresponding (first) opcode byte.
50 */
51 typedef NaClModeledInst*
52 NaclModeledInstTableType[NCDTABLESIZE][NaClInstPrefixEnumSize];
53
54 /* The type for the array of compressed instructions. */
55 typedef NaClModeledInst*
56 NaclCompressedTableType[NACL_MAX_INSTRUCTIONS_TOTAL];
57
58 /* The type for the array of opcode lookup entries. */
59 typedef NaClPrefixOpcodeArrayOffset
60 NaClCompressedOpcodeLookupType[NACL_MAX_PREFIX_OPCODE_ENTRIES];
61
62 /* Models the arrays used in table generation, and the corresponding
63 * tables used to model the compressed data.
64 */
65 typedef struct NaClInstTables {
66 /* The lookup table of posssible instructions, based on opcode and
67 * prefix selector.
68 */
69 NaClModeledInst* inst_table[NCDTABLESIZE][NaClInstPrefixEnumSize];
70 /* The root of the hard coded instructions. */
71 NaClModeledInstNode* inst_node_root;
72 /* The array of modeled set of operands defined for instructions. */
73 NaClOp operands[NACL_MAX_OPERANDS_TOTAL];
74 /* The number of operands in nacl_operands. */
75 size_t operands_size;
76 /* The instruction that models an undefined instruction. */
77 NaClModeledInst* undefined_inst;
78 /* The generated array of compressed operands. */
79 NaClOp ops_compressed[NACL_MAX_OPERANDS_TOTAL];
80 /* The number of compressed operands added to ops_compressed. */
81 size_t ops_compressed_size;
82 /* The generated array of compressed instructions. */
83 NaClModeledInst* inst_compressed[NACL_MAX_INSTRUCTIONS_TOTAL];
84 /* The number of compressed instructions added to inst_compressed. */
85 size_t inst_compressed_size;
86 /* The generated table of opcode lookup indicies. */
87 NaClOpcodeArrayOffset opcode_lookup[NACL_MAX_PREFIX_OPCODE_ENTRIES];
88 /* The size of array opcode_lookup. */
89 size_t opcode_lookup_size;
90 /* The generated table of entry points into opcode_lookup, for each
91 * possible prefix.
92 */
93 NaClPrefixOpcodeArrayOffset opcode_lookup_entry[NaClInstPrefixEnumSize];
94 /* The first non-null opcode value stored in the generated
95 * table opcode_lookup, for each possible prefix.
96 */
97 uint8_t opcode_lookup_first[NaClInstPrefixEnumSize];
98 /* The last non-null opcode vlaue stored in the generated
99 * table opcode_lookupk, for each possible prefix.
100 */
101 uint8_t opcode_lookup_last[NaClInstPrefixEnumSize];
102 } NaClInstTables;
103
104 /* Given the tables passed in, compresses instructions, operands,
105 * and prefix/opcode lookup tables.
106 */
107 void NaClOpCompress(NaClInstTables* inst_tables);
108
109 /* Given the tables passed in, return the index (in the compressed instruction
110 * array) associated with the given instruction.
111 */
112 NaClOpcodeArrayOffset NaClFindInstIndex(NaClInstTables* inst_tables,
113 const NaClModeledInst* inst);
114
115 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_GENERATOR_NC_COMPRESS _H__ */
OLDNEW
« no previous file with comments | « src/trusted/validator/x86/decoder/generator/nacl_regsgen.c ('k') | src/trusted/validator/x86/decoder/generator/nc_compress.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698