remove [64] cleanup TODO
[trinity.git] / syscalls / mprotect.c
blob890c4c8a8847b7972d4756cdf8cc1b83fa3a9584
1 /*
2 * sys_mprotect(unsigned long start, size_t len, unsigned long prot)
3 */
4 #include <asm/mman.h>
5 #include "utils.h" // page_size
6 #include "arch.h"
7 #include "maps.h"
8 #include "random.h"
9 #include "sanitise.h"
10 #include "shm.h"
12 static void sanitise_mprotect(int childno)
14 (void) common_set_mmap_ptr_len(childno);
18 * If we successfully did an mprotect, update our record of the mappings prot bits.
20 static void post_mprotect(int childno)
22 struct map *map = (struct map *) shm->scratch[childno];
24 if (shm->retval[childno] != 0)
25 map->prot = shm->a3[childno];
27 shm->scratch[childno] = 0;
30 struct syscallentry syscall_mprotect = {
31 .name = "mprotect",
32 .num_args = 3,
33 .arg1name = "start",
34 .arg1type = ARG_MMAP,
35 .arg2name = "len",
36 .arg3name = "prot",
37 .arg3type = ARG_LIST,
38 .arg3list = {
39 .num = 6,
40 .values = { PROT_READ, PROT_WRITE, PROT_EXEC, PROT_SEM, PROT_GROWSDOWN, PROT_GROWSUP },
42 .sanitise = sanitise_mprotect,
43 .group = GROUP_VM,
44 .post = post_mprotect,