7 runtime_SysAlloc(uintptr n)
12 p = runtime_mmap(nil, n, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, -1, 0);
13 if (p == MAP_FAILED) {
15 printf("mmap: access denied\n");
16 printf("If you're running SELinux, enable execmem for this process.\n");
18 printf("mmap: errno=%d\n", errno);
26 runtime_SysUnused(void *v, uintptr n)
30 // TODO(rsc): call madvise MADV_DONTNEED
34 runtime_SysFree(void *v, uintptr n)
41 runtime_SysMemInit(void)
43 // Code generators assume that references to addresses
44 // on the first page will fault. Map the page explicitly with
45 // no permissions, to head off possible bugs like the system
46 // allocating that page as the virtual address space fills.
47 // Ignore any error, since other systems might be smart
48 // enough to never allow anything there.
49 runtime_mmap(nil, 4096, PROT_NONE, MAP_FIXED|MAP_ANON|MAP_PRIVATE, -1, 0);