OLD | NEW |
---|---|
(Empty) | |
1 /* | |
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 | |
4 * found in the LICENSE file. | |
5 */ | |
6 | |
7 #ifndef MINSFI_PRIV_H | |
8 #define MINSFI_PRIV_H | |
9 | |
10 #include <stdbool.h> | |
11 #include <stdint.h> | |
12 #include <stdlib.h> | |
13 #include <unistd.h> | |
14 | |
15 typedef struct { | |
16 uint32_t ptr_size; /* size of sandboxed pointers in bits */ | |
17 uint32_t dataseg_offset; | |
18 uint32_t dataseg_size; | |
19 const char *dataseg_template; | |
20 } manifest; | |
jvoung (off chromium)
2014/09/05 00:31:59
If we're following NaCl style, I think most of the
dbrazdil
2014/09/05 19:41:37
Done.
| |
21 | |
22 typedef struct { | |
23 uint32_t offset; | |
24 uint32_t length; | |
25 } region; | |
26 | |
27 typedef struct { | |
28 region dataseg; | |
29 region heap; | |
30 region stack; | |
31 } layout; | |
32 | |
33 /* | |
34 * Computes the boundaries of the individual regions of the sandbox's address | |
35 * subspace and stores them into the given minsfi_layout data structure. | |
36 * Returns FALSE if a layout cannot be created for the given parameters. | |
37 */ | |
38 bool generate_layout(manifest *sb, uint32_t page_size, layout *mem); | |
jvoung (off chromium)
2014/09/05 00:31:59
Could this be "const manifest *sb" ?
Similar belo
dbrazdil
2014/09/05 19:41:37
Done.
| |
39 | |
40 /* | |
41 * This function initializes the address subspace of the sandbox. Protection of | |
42 * the pages allocated to the data segment, heap and stack is set to read/write, | |
43 * the rest is no-access. The data segment template is copied into the sandbox. | |
44 * | |
45 * The function returns the base address of the address subspace if successful | |
46 * and NULL otherwise. | |
47 */ | |
48 char *init_sandbox(manifest *sb); | |
49 | |
50 /* | |
51 * Unmaps a memory region given by the provided base and the declared pointer | |
52 * size of the sandbox. The function returns FALSE if munmap() fails. | |
53 */ | |
54 bool destroy_sandbox(char *base, manifest *sb); | |
55 | |
56 #endif // MINSFI_PRIV_H | |
OLD | NEW |