OLD | NEW |
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/decoder.h" | 10 #include "native_client/src/trusted/validator_ragel/decoder.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 RELATIVE_16BIT = 0x00000082, | 57 RELATIVE_16BIT = 0x00000082, |
58 RELATIVE_32BIT = 0x00000084, | 58 RELATIVE_32BIT = 0x00000084, |
59 /* Not a normal immediate: only two bits can be changed. */ | 59 /* Not a normal immediate: only two bits can be changed. */ |
60 IMMEDIATE_2BIT = 0x20000010, | 60 IMMEDIATE_2BIT = 0x20000010, |
61 /* Last restricted register. */ | 61 /* Last restricted register. */ |
62 RESTRICTED_REGISTER_MASK = 0x00001f00, | 62 RESTRICTED_REGISTER_MASK = 0x00001f00, |
63 RESTRICTED_REGISTER_SHIFT = 8, | 63 RESTRICTED_REGISTER_SHIFT = 8, |
64 /* Was restricted_register from previous instruction used in this one? */ | 64 /* Was restricted_register from previous instruction used in this one? */ |
65 RESTRICTED_REGISTER_USED = 0x00002000, | 65 RESTRICTED_REGISTER_USED = 0x00002000, |
66 /* Mask to select all validation errors. */ | 66 /* Mask to select all validation errors. */ |
67 VALIDATION_ERRORS_MASK = 0x01ffc000, | 67 VALIDATION_ERRORS_MASK = 0x05ffc000, |
68 /* Unrecognized instruction: fatal error, processing stops here. */ | 68 /* Unrecognized instruction: fatal error, processing stops here. */ |
69 UNRECOGNIZED_INSTRUCTION = 0x00004000, | 69 UNRECOGNIZED_INSTRUCTION = 0x00004000, |
70 /* Direct jump to unaligned address outside of given region. */ | 70 /* Direct jump to unaligned address outside of given region. */ |
71 DIRECT_JUMP_OUT_OF_RANGE = 0x00008000, | 71 DIRECT_JUMP_OUT_OF_RANGE = 0x00008000, |
72 /* Instruction is not allowed on current CPU. */ | 72 /* Instruction is not allowed on current CPU. */ |
73 CPUID_UNSUPPORTED_INSTRUCTION = 0x00010000, | 73 CPUID_UNSUPPORTED_INSTRUCTION = 0x00010000, |
74 /* Base register can be one of: %r15, %rbp, %rip, %rsp. */ | 74 /* Base register can be one of: %r15, %rbp, %rip, %rsp. */ |
75 FORBIDDEN_BASE_REGISTER = 0x00020000, | 75 FORBIDDEN_BASE_REGISTER = 0x00020000, |
76 /* Index must be restricted if present. */ | 76 /* Index must be restricted if present. */ |
77 UNRESTRICTED_INDEX_REGISTER = 0x00040000, | 77 UNRESTRICTED_INDEX_REGISTER = 0x00040000, |
(...skipping 10 matching lines...) Expand all Loading... |
88 /* Operations with %r15 are forbidden. */ | 88 /* Operations with %r15 are forbidden. */ |
89 R15_MODIFIED = 0x00400000, | 89 R15_MODIFIED = 0x00400000, |
90 /* Operations with %xBP are forbidden. */ | 90 /* Operations with %xBP are forbidden. */ |
91 /* This includes %bpl for compatibility with old validator. */ | 91 /* This includes %bpl for compatibility with old validator. */ |
92 BP_MODIFIED = 0x00800000, | 92 BP_MODIFIED = 0x00800000, |
93 /* Operations with %xSP are forbidden. */ | 93 /* Operations with %xSP are forbidden. */ |
94 /* This includes %spl for compatibility with old validator. */ | 94 /* This includes %spl for compatibility with old validator. */ |
95 SP_MODIFIED = 0x01000000, | 95 SP_MODIFIED = 0x01000000, |
96 /* Bad call alignment: "call" must end at the end of the bundle. */ | 96 /* Bad call alignment: "call" must end at the end of the bundle. */ |
97 BAD_CALL_ALIGNMENT = 0x02000000, | 97 BAD_CALL_ALIGNMENT = 0x02000000, |
| 98 /* The instruction should be either forbidden or rewritten. */ |
| 99 UNSUPPORTED_INSTRUCTION = 0x04000000, |
98 /* Instruction is modifiable by nacl_dyncode_modify. */ | 100 /* Instruction is modifiable by nacl_dyncode_modify. */ |
99 MODIFIABLE_INSTRUCTION = 0x08000000, | 101 MODIFIABLE_INSTRUCTION = 0x08000000, |
100 /* Special instruction. Uses different, non-standard validation rules. */ | 102 /* Special instruction. Uses different, non-standard validation rules. */ |
101 SPECIAL_INSTRUCTION = 0x10000000, | 103 SPECIAL_INSTRUCTION = 0x10000000, |
102 /* Some 3DNow! instructions use immediate byte as opcode extensions. */ | 104 /* Some 3DNow! instructions use immediate byte as opcode extensions. */ |
103 LAST_BYTE_IS_NOT_IMMEDIATE = 0x20000000, | 105 LAST_BYTE_IS_NOT_IMMEDIATE = 0x20000000, |
104 /* Bad jump target. Note: in this case ptr points to jump target! */ | 106 /* Bad jump target. Note: in this case ptr points to jump target! */ |
105 BAD_JUMP_TARGET = 0x40000000 | 107 BAD_JUMP_TARGET = 0x40000000 |
106 }; | 108 }; |
107 | 109 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 Bool ValidateChunkIA32(const uint8_t codeblock[], | 206 Bool ValidateChunkIA32(const uint8_t codeblock[], |
205 size_t size, | 207 size_t size, |
206 uint32_t options, | 208 uint32_t options, |
207 const NaClCPUFeaturesX86 *cpu_features, | 209 const NaClCPUFeaturesX86 *cpu_features, |
208 ValidationCallbackFunc user_callback, | 210 ValidationCallbackFunc user_callback, |
209 void *callback_data); | 211 void *callback_data); |
210 | 212 |
211 EXTERN_C_END | 213 EXTERN_C_END |
212 | 214 |
213 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_ */ | 215 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_ */ |
OLD | NEW |