OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 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 | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * be found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /* | 7 /* |
8 * Defines the notion of a code segment. | 8 * Defines the notion of a code segment. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NC_SEGMENT_H_ | 11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NC_SEGMENT_H_ |
12 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NC_SEGMENT_H_ | 12 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NC_SEGMENT_H_ |
13 | 13 |
14 #include "native_client/src/trusted/validator_x86/nc_inst_state.h" | 14 #include "native_client/src/trusted/validator_x86/nc_inst_state.h" |
15 | 15 |
| 16 EXTERN_C_BEGIN |
| 17 |
16 /* Model of a code segment. */ | 18 /* Model of a code segment. */ |
17 typedef struct NaClSegment { | 19 typedef struct NaClSegment { |
18 /* Points the the beginning of the sequence of bytes in the code segment. */ | 20 /* Points the the beginning of the sequence of bytes in the code segment. */ |
19 uint8_t* mbase; | 21 uint8_t* mbase; |
20 /* Defines the virtual pc value associated with the beginning | 22 /* Defines the virtual pc value associated with the beginning |
21 * of the code segment. | 23 * of the code segment. |
22 */ | 24 */ |
23 NaClPcAddress vbase; | 25 NaClPcAddress vbase; |
24 /* Defines the maximum+1 (virtual) pc value. Used to define | 26 /* Defines the maximum+1 (virtual) pc value. Used to define |
25 * when the end of the segment is reached. Corresponds to | 27 * when the end of the segment is reached. Corresponds to |
26 * vbase + size; | 28 * vbase + size; |
27 */ | 29 */ |
28 NaClPcAddress vlimit; | 30 NaClPcAddress vlimit; |
29 /* The number of bytes in the code segment. */ | 31 /* The number of bytes in the code segment. */ |
30 NaClMemorySize size; | 32 NaClMemorySize size; |
31 } NaClSegment; | 33 } NaClSegment; |
32 | 34 |
33 /* Initializes the given code segment with the given values. */ | 35 /* Initializes the given code segment with the given values. */ |
34 void NaClSegmentInitialize( | 36 void NaClSegmentInitialize( |
35 uint8_t* mbase, | 37 uint8_t* mbase, |
36 NaClPcAddress vbase, | 38 NaClPcAddress vbase, |
37 NaClMemorySize size, | 39 NaClMemorySize size, |
38 NaClSegment* segment); | 40 NaClSegment* segment); |
39 | 41 |
| 42 EXTERN_C_END |
| 43 |
40 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NC_SEGMENT_H_ */ | 44 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NC_SEGMENT_H_ */ |
OLD | NEW |