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 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVAL_REG_SFI_ADDRESS_SETS_H__ | |
8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVAL_REG_SFI_ADDRESS_SETS_H__ | |
9 | |
10 /* | |
11 * address_sets.h - Implements a bit set of addresses that is used by branch | |
12 * validation to check if branches are safe. | |
13 */ | |
14 | |
15 #include "native_client/src/trusted/validator/types_memory_model.h" | |
16 | |
17 struct NaClValidatorState; | |
18 | |
19 /* Models a set of addresses using an an array of possible addresses, | |
20 * where the last 3 bits are unioned together using a bit mask. This cuts | |
21 * down on the memory footprint of the address table. | |
22 */ | |
23 typedef uint8_t* NaClAddressSet; | |
24 | |
25 /* Return true if the corresponding address is in the given address set. */ | |
26 uint8_t NaClAddressSetContains(NaClAddressSet set, | |
27 NaClPcAddress address, | |
28 struct NaClValidatorState* state); | |
29 | |
30 /* Adds the given address to the given address set. */ | |
31 void NaClAddressSetAdd(NaClAddressSet set, NaClPcAddress address, | |
32 struct NaClValidatorState* state); | |
33 | |
34 /* Create an address set for the range 0..Size. */ | |
35 NaClAddressSet NaClAddressSetCreate(NaClMemorySize size); | |
36 | |
37 /* frees the memory of the address set back to the system. */ | |
38 void NaClAddressSetDestroy(NaClAddressSet set); | |
39 | |
40 /* Returns the array size to use for the given memory size. */ | |
41 size_t NaClAddressSetArraySize(NaClMemorySize size); | |
42 | |
43 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVAL_REG_SFI_ADDRESS_SETS_H_
_ */ | |
OLD | NEW |