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

Side by Side Diff: src/trusted/validator/x86/decoder/generator/ncdecode_tablegen.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 generator routines for building x86 instruction set.
9 */
10
11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_GENERATOR_NCDECODE_TABLE GEN_H__
12 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_GENERATOR_NCDECODE_TABLE GEN_H__
13
14 #ifndef NACL_TRUSTED_BUT_NOT_TCB
15 #error("This file is not meant for use in the TCB")
16 #endif
17
18 #include "native_client/src/trusted/validator/x86/decoder/generator/modeled_nacl _inst.h"
19
20 struct NaClSymbolTable;
21
22 /* Report the given fatal error, and then quit. */
23 void NaClFatal(const char* s);
24
25 /* Possible run modes for instructions. */
26 typedef enum {
27 X86_32, /* Model x86-32 bit instructions. */
28 X86_64, /* Model x86-64-bit instructions. */
29 /* Special end of list marker, denoting the number
30 * of run modes;
31 */
32 NaClRunModeSize
33 } NaClRunMode;
34
35 /* Defines the run mode files that should be generated. */
36 extern NaClRunMode NACL_FLAGS_run_mode;
37
38 /* Change the current opcode prefix to the given value. */
39 void NaClDefInstPrefix(const NaClInstPrefix prefix);
40
41 /* Resets the default opcode prefix to the value of the last
42 * call to NaClDefDefaultInstPrefix.
43 */
44 void NaClResetToDefaultInstPrefix(void);
45
46 /* Same as NaClDefInstChoices, but you can explicitly define the
47 * prefix associated with the opcode.
48 */
49 void NaClDefPrefixInstChoices(const NaClInstPrefix prefix,
50 const uint8_t opcode,
51 const int count);
52
53 /* Same as NaClDefPrefixInstChoices, but extends the opcode with
54 * the modrm opcode in the modrm byte (must be in [0..7]).
55 */
56 void NaClDefPrefixInstMrmChoices(const NaClInstPrefix prefix,
57 const uint8_t opcode,
58 const uint8_t modrm_opcode,
59 const int count);
60
61 /* Same as NaClDefInstChoices_32_64, but you can explicitly define the
62 * prefix associated with the opcode.
63 */
64 void NaClDefPrefixInstChoices_32_64(const NaClInstPrefix prefix,
65 const uint8_t opcode,
66 const int count_32,
67 const int count_64);
68
69 /* Same as NaClDefPrefixInstChoices_32_64, but extends the opcode with
70 * the modrm opcode in the modrm byte (must be in [0..7]).
71 */
72 void NaClDefPrefixInstMrmChoices_32_64(const NaClInstPrefix prefix,
73 const uint8_t opcode,
74 const uint8_t modrm_opcode,
75 const int count_32,
76 const int count_64);
77
78 /* By default, sanity checks are applied as each defining
79 * call is made. When this is called, these sanity checks
80 * are turned off until the explicit call to NaClApplySanityChecks.
81 */
82 void NaClDelaySanityChecks(void);
83
84 void NaClApplySanityChecks(void);
85
86 /* Define the next opcode (instruction), initializing with
87 * no operands.
88 */
89 void NaClDefInst(
90 const uint8_t opcode,
91 const NaClInstType insttype,
92 NaClIFlags flags,
93 const NaClMnemonic name);
94
95 /* Returns the current instruction being defined.
96 * ***WARNING***: If you call any function within this header file
97 * that modifies the current instruction will invalidate the contents
98 * returned by this function.
99 */
100 NaClModeledInst* NaClGetDefInst(void);
101
102 /* Define an opcode extension for the current instruction, which is
103 * a value between 0 and 7, that appears in the modrm byte of the
104 * instruction.
105 */
106 void NaClDefOpcodeExtension(int opcode);
107
108 /* Defines an opcode extension stored in the ModRm r/m field (must be
109 * in [0..7]).
110 */
111 void NaClDefineOpcodeModRmRmExtension(int value);
112
113 /* Define a register value embedded in the opcode value. */
114 void NaClDefOpcodeRegisterValue(int r);
115
116 /* Add additional instruction flags to the current instruction being
117 * processed.
118 */
119 void NaClAddIFlags(NaClIFlags more_flags);
120
121 /* Remove instruction flags from the current instruction being processed. */
122 void NaClRemoveIFlags(NaClIFlags less_flags);
123
124 /*
125 * Define the next operand of the current opcode to have the given kind
126 * and flags.
127 */
128 void NaClDefOp(NaClOpKind kind, NaClOpFlags flags);
129
130 /* Add additional operand flags to the indexed operand of the current
131 * instruction being processed (index is 0 based).
132 */
133 void NaClAddOpFlags(uint8_t operand_index, NaClOpFlags more_flags);
134
135 /* Add format string to the indexed oeprand of the current instruction
136 * being processed (index is 0 based).
137 *
138 * Note: the passed in string is copied, and hence its contents can
139 * change once this function returns.
140 */
141 void NaClAddOpFormat(uint8_t operand_index, const char* format);
142
143 /* Removes operand flags from the indexed operand of the current
144 * instruction being processed (index is 0 based).
145 */
146 void NaClRemoveOpFlags(uint8_t operand_index, NaClOpFlags flags);
147
148 /* Returns the set of operand size flags defined for the given instruction. */
149 NaClIFlags NaClOperandSizes(NaClModeledInst* inst);
150
151 /* Defines one byte opcodes. */
152 void NaClDefOneByteInsts(struct NaClSymbolTable* context_st);
153
154 /* Defines two byte opcodes beginning with OF. */
155 void NaClDef0FInsts(struct NaClSymbolTable* context_st);
156
157 /* Defines two byte opcodes beginning with DC. */
158 void NaClDefDCInsts(void);
159
160 /* Defines SSE instructions (i.e. instructions using MMX and XMM registers). */
161 void NaClDefSseInsts(struct NaClSymbolTable* context_st);
162
163 /* Define x87 instructions. */
164 void NaClDefX87Insts(struct NaClSymbolTable* context_st);
165
166 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_GENERATOR_NCDECODE_TA BLEGEN_H__ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698