OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2014 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_INCLUDE_MINSFI_PRIV_H_ | 7 #ifndef NATIVE_CLIENT_SRC_INCLUDE_MINSFI_PRIV_H_ |
8 #define NATIVE_CLIENT_SRC_INCLUDE_MINSFI_PRIV_H_ | 8 #define NATIVE_CLIENT_SRC_INCLUDE_MINSFI_PRIV_H_ |
9 | 9 |
10 #include <stdbool.h> | 10 #include <stdbool.h> |
11 #include <stdlib.h> | 11 #include <stdlib.h> |
12 #include <stdint.h> | 12 #include <stdint.h> |
13 #include <unistd.h> | 13 #include <unistd.h> |
14 | 14 |
15 /* Definition of the untrusted pointer type */ | |
jvoung (off chromium)
2014/09/10 17:04:29
It seems more like this is analogous to uintptr_t
dbrazdil
2014/09/10 18:49:47
Done.
| |
16 typedef uint32_t sfiptr_t; | |
17 | |
15 typedef struct { | 18 typedef struct { |
16 uint32_t ptr_size; /* size of sandboxed pointers in bits */ | 19 uint32_t ptr_size; /* size of sandboxed pointers in bits */ |
17 uint32_t dataseg_offset; | 20 uint32_t dataseg_offset; |
jvoung (off chromium)
2014/09/10 17:04:29
should this be an sfiptr_t also?
dbrazdil
2014/09/10 18:49:47
I thought about that and I see how it would make s
| |
18 uint32_t dataseg_size; | 21 uint32_t dataseg_size; |
19 const char *dataseg_template; | 22 const char *dataseg_template; |
20 } MinsfiManifest; | 23 } MinsfiManifest; |
21 | 24 |
22 typedef struct { | 25 typedef struct { |
23 uint32_t offset; | 26 sfiptr_t offset; |
24 uint32_t length; | 27 uint32_t length; |
25 } MinsfiMemoryRegion; | 28 } MinsfiMemoryRegion; |
26 | 29 |
27 typedef struct { | 30 typedef struct { |
28 MinsfiMemoryRegion dataseg; | 31 MinsfiMemoryRegion dataseg; |
29 MinsfiMemoryRegion heap; | 32 MinsfiMemoryRegion heap; |
30 MinsfiMemoryRegion stack; | 33 MinsfiMemoryRegion stack; |
31 } MinsfiMemoryLayout; | 34 } MinsfiMemoryLayout; |
32 | 35 |
33 typedef struct { | 36 typedef struct { |
34 char *mem_base; | 37 char *mem_base; |
35 uint64_t mem_alloc_size; | 38 uint64_t mem_alloc_size; |
36 uint32_t ptr_mask; | 39 sfiptr_t ptr_mask; |
37 MinsfiMemoryLayout mem_layout; | 40 MinsfiMemoryLayout mem_layout; |
38 } MinsfiSandbox; | 41 } MinsfiSandbox; |
39 | 42 |
40 /* | 43 /* |
41 * Computes the boundaries of the individual regions of the sandbox's address | 44 * Computes the boundaries of the individual regions of the sandbox's address |
42 * subspace and stores them into the given minsfi_layout data structure. | 45 * subspace and stores them into the given minsfi_layout data structure. |
43 * Returns FALSE if a layout cannot be created for the given parameters. | 46 * Returns FALSE if a layout cannot be created for the given parameters. |
44 */ | 47 */ |
45 bool MinsfiGenerateMemoryLayout(const MinsfiManifest *manifest, | 48 bool MinsfiGenerateMemoryLayout(const MinsfiManifest *manifest, |
46 uint32_t page_size, MinsfiMemoryLayout *layout); | 49 uint32_t page_size, MinsfiMemoryLayout *layout); |
(...skipping 20 matching lines...) Expand all Loading... | |
67 */ | 70 */ |
68 const MinsfiSandbox *MinsfiGetActiveSandbox(void); | 71 const MinsfiSandbox *MinsfiGetActiveSandbox(void); |
69 | 72 |
70 /* | 73 /* |
71 * Sets the sandbox which all trampolines will refer to. Internally copies the | 74 * Sets the sandbox which all trampolines will refer to. Internally copies the |
72 * data structure to its own storage. | 75 * data structure to its own storage. |
73 */ | 76 */ |
74 void MinsfiSetActiveSandbox(const MinsfiSandbox *sb); | 77 void MinsfiSetActiveSandbox(const MinsfiSandbox *sb); |
75 | 78 |
76 #endif // NATIVE_CLIENT_SRC_INCLUDE_MINSFI_PRIV_H_ | 79 #endif // NATIVE_CLIENT_SRC_INCLUDE_MINSFI_PRIV_H_ |
OLD | NEW |