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

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

Issue 10883051: Add documentation for the dynamic code modifications. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years, 3 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/unreviewed/decoder.h"
11 11
12 EXTERN_C_BEGIN 12 EXTERN_C_BEGIN
13 13
14 enum validation_callback_info { 14 enum validation_callback_info {
15 /* validation_error & IMMEDIATES_INFO will give you immediates size. */ 15 /* Anyfield info mask: you can use to parse information about anyfields. */
16 IMMEDIATES_SIZE = 0x0000000f, 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 IMMEDIATE_8BIT = 0x00000001, 19 IMMEDIATE_8BIT = 0x00000001,
19 IMMEDIATE_16BIT = 0x00000002, 20 IMMEDIATE_16BIT = 0x00000002,
20 IMMEDIATE_32BIT = 0x00000004, 21 IMMEDIATE_32BIT = 0x00000004,
21 IMMEDIATE_64BIT = 0x00000008, 22 IMMEDIATE_64BIT = 0x00000008,
22 /* Second 8bit immediate is only used in "extrq/insertq" instructions. */ 23 /* Second 8bit immediate is only used in "extrq/insertq" instructions. */
23 SECOND_IMMEDIATE_8BIT = 0x00000011, 24 SECOND_IMMEDIATE_8BIT = 0x00000011,
24 /* Second 16bit immediate is only used in "enter" instruction. */ 25 /* Second 16bit immediate is only used in "enter" instruction. */
25 SECOND_IMMEDIATE_16BIT = 0x00000012, 26 SECOND_IMMEDIATE_16BIT = 0x00000012,
26 /* Displacement sizes (displacements come at the end - before immediates). */ 27 /* Displacement sizes (displacements come at the end - before immediates). */
28 DISPLACEMENT_SIZE_MASK = 0x00000060,
27 DISPLACEMENT_8BIT = 0x00000021, 29 DISPLACEMENT_8BIT = 0x00000021,
28 DISPLACEMENT_16BIT = 0x00000042, 30 DISPLACEMENT_16BIT = 0x00000042,
29 DISPLACEMENT_32BIT = 0x00000064, 31 DISPLACEMENT_32BIT = 0x00000064,
30 /* Relative size (relative fields always come at the end if instriction). */ 32 /* Relative size (relative fields always come at the end if instriction). */
31 RELATIVE_8BIT = 0x00000081, 33 RELATIVE_8BIT = 0x00000081,
32 RELATIVE_16BIT = 0x00000082, 34 RELATIVE_16BIT = 0x00000082,
33 RELATIVE_32BIT = 0x00000084, 35 RELATIVE_32BIT = 0x00000084,
34 /* Not a normal immediate: only two bits can be changed. */ 36 /* Not a normal immediate: only two bits can be changed. */
35 IMMEDIATE_2BIT = 0x20000010, 37 IMMEDIATE_2BIT = 0x20000010,
36 /* Last restricted register. */ 38 /* Last restricted register. */
37 RESTRICTED_REGISTER_MASK = 0x00001f00, 39 RESTRICTED_REGISTER_MASK = 0x00001f00,
38 RESTRICTED_REGISTER_SHIFT = 8, 40 RESTRICTED_REGISTER_SHIFT = 8,
39 /* Was restricted from previous instruction used in the current one? */ 41 /* Was restricted from previous instruction used in the current one? */
40 RESTRICTED_REGISTER_USED = 0x00002000, 42 RESTRICTED_REGISTER_USED = 0x00002000,
41 /* Mask to select all validation errors. */ 43 /* Mask to select all validation errors. */
42 VALIDATION_ERRORS = 0x03ffc000, 44 VALIDATION_ERRORS_MASK = 0x03ffc000,
43 /* Unrecognized instruction: fatal error, processing stops here. */ 45 /* Unrecognized instruction: fatal error, processing stops here. */
44 UNRECOGNIZED_INSTRUCTION = 0x00004000, 46 UNRECOGNIZED_INSTRUCTION = 0x00004000,
45 /* Direct jump to unaligned address outside of given region. */ 47 /* Direct jump to unaligned address outside of given region. */
46 DIRECT_JUMP_OUT_OF_RANGE = 0x00008000, 48 DIRECT_JUMP_OUT_OF_RANGE = 0x00008000,
47 /* Instruction is not allowed on current CPU. */ 49 /* Instruction is not allowed on current CPU. */
48 CPUID_UNSUPPORTED_INSTRUCTION = 0x00010000, 50 CPUID_UNSUPPORTED_INSTRUCTION = 0x00010000,
49 /* Base register can be one of: %r15, %rbp, %rip, %rsp. */ 51 /* Base register can be one of: %r15, %rbp, %rip, %rsp. */
50 FORBIDDEN_BASE_REGISTER = 0x00020000, 52 FORBIDDEN_BASE_REGISTER = 0x00020000,
51 /* Index must be restricted if present. */ 53 /* Index must be restricted if present. */
52 UNRESTRICTED_INDEX_REGISTER = 0x00040000, 54 UNRESTRICTED_INDEX_REGISTER = 0x00040000,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 109
108 Bool ValidateChunkIA32(const uint8_t *data, size_t size, 110 Bool ValidateChunkIA32(const uint8_t *data, size_t size,
109 enum validation_options options, 111 enum validation_options options,
110 const NaClCPUFeaturesX86 *cpu_features, 112 const NaClCPUFeaturesX86 *cpu_features,
111 validation_callback_func user_callback, 113 validation_callback_func user_callback,
112 void *callback_data); 114 void *callback_data);
113 115
114 EXTERN_C_END 116 EXTERN_C_END
115 117
116 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_ */ 118 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_ */
OLDNEW
« no previous file with comments | « src/trusted/validator_ragel/unreviewed/sample3.svg ('k') | src/trusted/validator_ragel/unreviewed/validator_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698