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

Side by Side Diff: src/trusted/validator/x86/decoder/ncop_exps.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) 2012 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 * ncop-exps.h - Models x86 instructions using a vector containing
9 * operand trees flattened using a pre-order walk.
10 */
11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_NCOP_EXPS_H_
12 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_NCOP_EXPS_H_
13
14 #include "native_client/src/trusted/validator/x86/decoder/gen/ncop_expr_node_fla g.h"
15 #include "native_client/src/trusted/validator/x86/decoder/gen/ncop_expr_node_kin d.h"
16 #include "native_client/src/trusted/validator/x86/decoder/ncopcode_desc.h"
17
18 EXTERN_C_BEGIN
19
20 /* Defines the state used to match an instruction, while walking
21 * instructions using the NaClInstIter.
22 */
23 struct NaClInstState;
24
25 /* Returns the number of kids an ExprNodeKind has. */
26 int NaClExpKindRank(NaClExpKind kind);
27
28 /* Defines a bit set of ExprNodeFlags. */
29 typedef uint32_t NaClExpFlags;
30
31 /* Converts an NaClExpFlag enum to the corresponding bit in a NaClExpFlags
32 * bit set.
33 */
34 #define NACL_EFLAG(x) (((NaClExpFlags) 1) << (x))
35
36 /* Models the empty set of NaClExpFlags. */
37 #define NACL_EMPTY_EFLAGS ((NaClExpFlags) 0)
38
39 /* Print out the set of defined expr flags. */
40 void NaClPrintExpFlags(struct Gio* file, NaClExpFlags flags);
41
42 /* Defines a node in the vector of expressions, corresponding to the flattened
43 * (preorder) tree.
44 */
45 typedef struct NaClExp {
46 /* A value associated with the kind. */
47 uint64_t value;
48 /* The type of node. */
49 NaClExpKind kind;
50 /* The set of flags associated with the node. */
51 NaClExpFlags flags;
52 } NaClExp;
53
54 /* Maximum number of nodes allowed in the flattened (preorder) tree. */
55 #define NACL_MAX_EXPS 30
56
57 /* Defines the vector of expression nodes, corresponding to the flattened
58 * (preorder) tree that defines the instruction expression.
59 */
60 typedef struct NaClExpVector {
61 Bool is_defined; /* TRUE iff vector has been built. */
62 uint32_t number_expr_nodes;
63 NaClExp node[NACL_MAX_EXPS];
64 } NaClExpVector;
65
66 /* Returns the number of elements in the given vector, that the subtree
67 * rooted at the given node covers.
68 */
69 int NaClExpWidth(NaClExpVector* vector, int node);
70
71 /* Given the given index of the node in the vector, return the index of the
72 * given (zero based) kid of the node.
73 */
74 int NaClGetExpKidIndex(NaClExpVector* vector, int node, int kid);
75
76 /* Given an index in the vector, return the index to its parent.
77 * Note: index must be > 0. Returns -1 if no parent defined.
78 */
79 int NaClGetExpParentIndex(NaClExpVector* vector, int node);
80
81 /* Returns true if the index points to a constant that is negative. */
82 Bool NaClIsExpNegativeConstant(NaClExpVector* vector, int index);
83
84 /* Returns the index of the i-th occurrence of the given kind of node,
85 * or -1 if no such node exists.
86 */
87 int NaClGetNthExpKind(NaClExpVector* vector, NaClExpKind kind, int n);
88
89 /* Returns the register in the given node. */
90 NaClOpKind NaClGetExpRegister(NaClExp* node);
91
92 /* Returns the register in the given indexed node. */
93 NaClOpKind NaClGetExpVectorRegister(NaClExpVector* vector, int node);
94
95 /* Print out the contents of the given vector of nodes to the given file. */
96 void NaClExpVectorPrint(struct Gio* file, struct NaClInstState* state);
97
98 /* Print out the disassembled instruction in the given instruction state. */
99 void NaClInstStateInstPrint(struct Gio* file, struct NaClInstState* state);
100
101 /* Same functionality as NaClInstStateInstPrint(), but puts the
102 * result in a string. This function is to be used for comparing output on
103 * an instruction-at-a-time granularity. Do not use this fct except
104 * for testing purposes.
105 */
106 char* NaClInstStateInstructionToString(struct NaClInstState* state);
107
108 /* Generates the lower case name of the corresponding register into the
109 * given character buffer. Returns the number of characters added to the buffer.
110 * Returns zero if there is no corresponding (valid) register name for the reg
111 * argument.
112 */
113 size_t NaClOpRegName(NaClOpKind reg, char* buffer, size_t buffer_size);
114
115 EXTERN_C_END
116
117 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_DECODER_NCOP_EXPS_H_ */
OLDNEW
« no previous file with comments | « src/trusted/validator/x86/decoder/ncop_expr_node_kind.enum ('k') | src/trusted/validator/x86/decoder/ncop_exps.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698