OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 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 | 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_X86_NCVALIDATE_H__ | 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ |
8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ | 8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ |
9 | 9 |
10 /* Defines the API to the native client validation code. | 10 /* Defines the API to the native client validation code. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 * bundle_size - The number of bytes in a code bundle. | 89 * bundle_size - The number of bytes in a code bundle. |
90 */ | 90 */ |
91 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidator, | 91 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidator, |
92 NACL_TARGET_ARCH, | 92 NACL_TARGET_ARCH, |
93 NACL_TARGET_SUBARCH)( | 93 NACL_TARGET_SUBARCH)( |
94 NaClApplyValidationKind kind, | 94 NaClApplyValidationKind kind, |
95 uintptr_t guest_addr, | 95 uintptr_t guest_addr, |
96 uint8_t *data, | 96 uint8_t *data, |
97 size_t size, | 97 size_t size, |
98 int bundle_size, | 98 int bundle_size, |
99 Bool local_cpu); | 99 Bool local_cpu |
| 100 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm |
| 101 , uint8_t thumb |
| 102 #endif |
| 103 ); |
100 | 104 |
101 /* Applies the validator, as used in a command-line tool to report issues. | 105 /* Applies the validator, as used in a command-line tool to report issues. |
102 * Note: This is intentionally separated from ApplyValidator, since it need | 106 * Note: This is intentionally separated from ApplyValidator, since it need |
103 * not be performance critical. | 107 * not be performance critical. |
104 * Parameters are: | 108 * Parameters are: |
105 * kind - The way the validator should be applied. | 109 * kind - The way the validator should be applied. |
106 * local_cpu: True if local cpu rules should be applied. | 110 * local_cpu: True if local cpu rules should be applied. |
107 * Otherwise, assume no cpu specific rules. | 111 * Otherwise, assume no cpu specific rules. |
108 * guest_addr - The virtual pc to assume with the beginning address of the | 112 * guest_addr - The virtual pc to assume with the beginning address of the |
109 * code segment. Typically, this is the corresponding addresss that | 113 * code segment. Typically, this is the corresponding addresss that |
110 * will be used by objdump. | 114 * will be used by objdump. |
111 * data - The contents of the code segment to be validated. | 115 * data - The contents of the code segment to be validated. |
112 * size - The size of the code segment to be validated. | 116 * size - The size of the code segment to be validated. |
113 * bundle_size - The number of bytes in a code bundle. | 117 * bundle_size - The number of bytes in a code bundle. |
114 */ | 118 */ |
115 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidatorVerbosely, | 119 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidatorVerbosely, |
116 NACL_TARGET_ARCH, | 120 NACL_TARGET_ARCH, |
117 NACL_TARGET_SUBARCH)( | 121 NACL_TARGET_SUBARCH)( |
118 NaClApplyValidationKind kind, | 122 NaClApplyValidationKind kind, |
119 uintptr_t guest_addr, | 123 uintptr_t guest_addr, |
120 uint8_t *data, | 124 uint8_t *data, |
121 size_t size, | 125 size_t size, |
122 int bundle_size, | 126 int bundle_size, |
123 Bool local_cpu); | 127 Bool local_cpu |
| 128 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm |
| 129 , uint8_t thumb |
| 130 #endif |
| 131 ); |
124 | 132 |
125 /* Applies validator to new code segment, assuming that it was updated | 133 /* Applies validator to new code segment, assuming that it was updated |
126 * from the previously validated old code segment. Assumes that instruction | 134 * from the previously validated old code segment. Assumes that instruction |
127 * sizes are the same. Only allows changes in branches that don't change | 135 * sizes are the same. Only allows changes in branches that don't change |
128 * instruction sizes. | 136 * instruction sizes. |
129 * Parameters are: | 137 * Parameters are: |
130 * guest_addr - The virtual pc to assume with the beginning address of the | 138 * guest_addr - The virtual pc to assume with the beginning address of the |
131 * code segment. Typically, this is the corresponding addresss that | 139 * code segment. Typically, this is the corresponding addresss that |
132 * will be used by objdump. | 140 * will be used by objdump. |
133 * data_old - The contents of the original code segment. | 141 * data_old - The contents of the original code segment. |
134 * data_new - The contents of the new code segment that should be validated. | 142 * data_new - The contents of the new code segment that should be validated. |
135 * size - The size of the passed code segments. | 143 * size - The size of the passed code segments. |
136 * bundle_size - The number of bytes in a code bundle. | 144 * bundle_size - The number of bytes in a code bundle. |
137 */ | 145 */ |
138 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidatorCodeReplacement, | 146 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidatorCodeReplacement, |
139 NACL_TARGET_ARCH, | 147 NACL_TARGET_ARCH, |
140 NACL_TARGET_SUBARCH)( | 148 NACL_TARGET_SUBARCH)( |
141 uintptr_t guest_addr, | 149 uintptr_t guest_addr, |
142 uint8_t *data_old, | 150 uint8_t *data_old, |
143 uint8_t *data_new, | 151 uint8_t *data_new, |
144 size_t size, | 152 size_t size, |
145 int bundle_size); | 153 int bundle_size |
| 154 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm |
| 155 , uint8_t thumb |
| 156 #endif |
| 157 ); |
146 | 158 |
147 /* Runs the validator to copy code from an existing code segment to a new | 159 /* Runs the validator to copy code from an existing code segment to a new |
148 * code segment. | 160 * code segment. |
149 * | 161 * |
150 * Note: Current implementations uses the instruction decoders, which may | 162 * Note: Current implementations uses the instruction decoders, which may |
151 * require that the code segment match native client rules. | 163 * require that the code segment match native client rules. |
152 * | 164 * |
153 * Parameters are: | 165 * Parameters are: |
154 * guest_addr - The virtual pc to assume with the beginning address of the | 166 * guest_addr - The virtual pc to assume with the beginning address of the |
155 * code segment. Typically, this is the corresponding addresss that | 167 * code segment. Typically, this is the corresponding addresss that |
156 * will be used by objdump. | 168 * will be used by objdump. |
157 * data_old - The contents of the original code segment. | 169 * data_old - The contents of the original code segment. |
158 * data_new - The addres of the new code segment for which the original | 170 * data_new - The addres of the new code segment for which the original |
159 * code segment should be copied into. | 171 * code segment should be copied into. |
160 * size - The size of the passed code segments. | 172 * size - The size of the passed code segments. |
161 * bundle_size - The number of bytes in a code bundle. | 173 * bundle_size - The number of bytes in a code bundle. |
162 */ | 174 */ |
163 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidatorCopy, | 175 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidatorCopy, |
164 NACL_TARGET_ARCH, | 176 NACL_TARGET_ARCH, |
165 NACL_TARGET_SUBARCH)( | 177 NACL_TARGET_SUBARCH)( |
166 uintptr_t guest_addr, | 178 uintptr_t guest_addr, |
167 uint8_t *data_old, | 179 uint8_t *data_old, |
168 uint8_t *data_new, | 180 uint8_t *data_new, |
169 size_t size, | 181 size_t size, |
170 int bundle_size); | 182 int bundle_size |
| 183 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm |
| 184 , uint8_t thumb |
| 185 #endif |
| 186 ); |
171 | 187 |
172 EXTERN_C_END | 188 EXTERN_C_END |
173 | 189 |
174 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ */ | 190 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ */ |
OLD | NEW |