| OLD | NEW |
| (Empty) |
| 1 /* | |
| 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 | |
| 4 * found in the LICENSE file. | |
| 5 */ | |
| 6 | |
| 7 /* Defines code to detect trailing halts in a code segment, and how many | |
| 8 * can be trimmed from the code segment without effecting the validator. | |
| 9 */ | |
| 10 | |
| 11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_HALT_TRIM_H__ | |
| 12 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_HALT_TRIM_H__ | |
| 13 | |
| 14 #include "native_client/src/trusted/validator/types_memory_model.h" | |
| 15 | |
| 16 EXTERN_C_BEGIN | |
| 17 | |
| 18 /* Takes a code memory segment, and returns the (safe) size to | |
| 19 * use for validation. It does this by checking for trailing halt | |
| 20 * instructions, and removes excess halts from the code segment memory. | |
| 21 * This function assumes the code segment will be mapped to an aligned base | |
| 22 * address. | |
| 23 * | |
| 24 * Parameters are: | |
| 25 * mbase - The beging of the memory segment to decode. | |
| 26 * sz - The number of bytes in the memory segment. | |
| 27 * alignment - The blocksize alignment used for the code segment. | |
| 28 * Returns: | |
| 29 * The number of bytes in the trimmed memory segment. | |
| 30 */ | |
| 31 NaClMemorySize NCHaltTrimSize(uint8_t* mbase, NaClMemorySize sz, | |
| 32 uint8_t alignment); | |
| 33 | |
| 34 EXTERN_C_END | |
| 35 | |
| 36 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_HALT_TRIM_H__ */ | |
| OLD | NEW |