OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 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 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 #include <errno.h> | 7 #include <errno.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "native_client/src/untrusted/irt/irt.h" | 10 #include "native_client/src/untrusted/irt/irt.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 if ((uint32_t) rv > 0xffff0000u) | 38 if ((uint32_t) rv > 0xffff0000u) |
39 return -(int32_t) rv; | 39 return -(int32_t) rv; |
40 *addr = (void *) (uintptr_t) rv; | 40 *addr = (void *) (uintptr_t) rv; |
41 return 0; | 41 return 0; |
42 } | 42 } |
43 | 43 |
44 static int nacl_irt_munmap(void *addr, size_t len) { | 44 static int nacl_irt_munmap(void *addr, size_t len) { |
45 return -NACL_SYSCALL(munmap)(addr, len); | 45 return -NACL_SYSCALL(munmap)(addr, len); |
46 } | 46 } |
47 | 47 |
| 48 static int nacl_irt_mprotect(void *addr, size_t len, int prot) { |
| 49 return -NACL_SYSCALL(mprotect)(addr, len, prot); |
| 50 } |
| 51 |
48 const struct nacl_irt_memory nacl_irt_memory = { | 52 const struct nacl_irt_memory nacl_irt_memory = { |
49 nacl_irt_sysbrk, | 53 nacl_irt_sysbrk, |
50 nacl_irt_mmap, | 54 nacl_irt_mmap, |
51 nacl_irt_munmap, | 55 nacl_irt_munmap, |
| 56 nacl_irt_mprotect, |
52 }; | 57 }; |
OLD | NEW |