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

Side by Side Diff: src/trusted/validator_ragel/unreviewed/validator.h

Issue 11000033: Move validator_x86_XX.rl out of unreviewed. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 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
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 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 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_ 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_
8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_ 8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_
9 9
10 #include "native_client/src/trusted/validator_ragel/unreviewed/decoder.h" 10 #include "native_client/src/trusted/validator_ragel/decoder.h"
11 11
12 EXTERN_C_BEGIN 12 EXTERN_C_BEGIN
13 13
14 enum validation_callback_info { 14 enum validation_callback_info {
Brad Chen 2012/10/05 16:47:21 Looks like the style observations from other files
khim 2012/10/15 16:38:57 http://dev.chromium.org/developers/coding-style Th
Brad Chen 2012/10/16 00:16:55 NaCl source uses CamelCase; please be consistent w
Vlad Shcherbina 2012/10/19 12:55:52 Chromium code search results for query "enum file:
15 /* Anyfield info mask: you can use to parse information about anyfields. */ 15 /* Anyfield info mask: you can use to parse information about anyfields. */
16 ANYFIELD_INFO_MASK = 0x000000ff, 16 ANYFIELD_INFO_MASK = 0x000000ff,
17 /* Immediate sizes (immediates always come at the end of instruction). */ 17 /* Immediate sizes (immediates always come at the end of instruction). */
18 IMMEDIATES_SIZE_MASK = 0x0000000f, 18 IMMEDIATES_SIZE_MASK = 0x0000000f,
19 IMMEDIATE_8BIT = 0x00000001, 19 IMMEDIATE_8BIT = 0x00000001,
20 IMMEDIATE_16BIT = 0x00000002, 20 IMMEDIATE_16BIT = 0x00000002,
21 IMMEDIATE_32BIT = 0x00000004, 21 IMMEDIATE_32BIT = 0x00000004,
22 IMMEDIATE_64BIT = 0x00000008, 22 IMMEDIATE_64BIT = 0x00000008,
23 /* Second 8bit immediate is only used in "extrq/insertq" instructions. */ 23 /* Second 8bit immediate is only used in "extrq/insertq" instructions. */
24 SECOND_IMMEDIATE_8BIT = 0x00000011, 24 SECOND_IMMEDIATE_8BIT = 0x00000011,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 * instruction_start = instruction_end = jump target 100 * instruction_start = instruction_end = jump target
101 * 101 *
102 * Minimal user_callback looks like this: 102 * Minimal user_callback looks like this:
103 * ... 103 * ...
104 * if (validation_info & (VALIDATION_ERRORS_MASK | BAD_JUMP_TARGET)) 104 * if (validation_info & (VALIDATION_ERRORS_MASK | BAD_JUMP_TARGET))
105 * return FALSE; 105 * return FALSE;
106 * else 106 * else
107 * return TRUE; 107 * return TRUE;
108 * ... 108 * ...
109 */ 109 */
110 typedef Bool (*validation_callback_func) (const uint8_t *instruction_start, 110 typedef Bool (*ValidationCallbackFunc) (const uint8_t *instruction_start,
111 const uint8_t *instruction_end, 111 const uint8_t *instruction_end,
112 uint32_t validation_info, 112 uint32_t validation_info,
113 void *callback_data); 113 void *callback_data);
114 114
115 /* 115 /*
116 * Returns whether given piece of code is valid. 116 * Returns whether given piece of code is valid.
117 * It is assumed that size % kBundleSize = 0. 117 * It is assumed that size % kBundleSize = 0.
118 * For every error/warning, user_callback is called. 118 * For every error/warning, user_callback is called.
119 * Alternatively, if CALL_USER_CALLBACK_ON_EACH_INSTRUCTION flag in options is 119 * Alternatively, if CALL_USER_CALLBACK_ON_EACH_INSTRUCTION flag in options is
120 * set, user_callback is called for every instruction. 120 * set, user_callback is called for every instruction.
121 * If PROCESS_CHUNK_AS_A_CONTIGUOUS_STREAM flag in options is set, 121 * If PROCESS_CHUNK_AS_A_CONTIGUOUS_STREAM flag in options is set,
122 * instructions crossing bundle boundaries are not considered erroneous. 122 * instructions crossing bundle boundaries are not considered erroneous.
123 * 123 *
124 * Actually validation result is computed as conjunction of values returned 124 * Actually validation result is computed as conjunction of values returned
125 * by all invocations of user_callback, so custom validation logic can be 125 * by all invocations of user_callback, so custom validation logic can be
126 * placed there. 126 * placed there.
127 */ 127 */
128 Bool ValidateChunkAMD64(const uint8_t *data, size_t size, 128 Bool ValidateChunkAMD64(const uint8_t *data, size_t size,
129 enum validation_options options, 129 enum validation_options options,
130 const NaClCPUFeaturesX86 *cpu_features, 130 const NaClCPUFeaturesX86 *cpu_features,
131 validation_callback_func user_callback, 131 ValidationCallbackFunc user_callback,
132 void *callback_data); 132 void *callback_data);
133 133
134 /* 134 /*
135 * See ValidateChunkAMD64 135 * See ValidateChunkAMD64
136 */ 136 */
137 Bool ValidateChunkIA32(const uint8_t *data, size_t size, 137 Bool ValidateChunkIA32(const uint8_t *data, size_t size,
138 enum validation_options options, 138 enum validation_options options,
139 const NaClCPUFeaturesX86 *cpu_features, 139 const NaClCPUFeaturesX86 *cpu_features,
140 validation_callback_func user_callback, 140 ValidationCallbackFunc user_callback,
141 void *callback_data); 141 void *callback_data);
142 142
143 EXTERN_C_END 143 EXTERN_C_END
144 144
145 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_ */ 145 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698