blob: ed5c40a4dcc786b5cc1aaf516b390704d774096a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// Separated from linux which has support for huge pages.
//go:build darwin || freebsd
package platform
import "syscall"
func mmapCodeSegment(size, prot int) ([]byte, error) {
return syscall.Mmap(
-1,
0,
size,
prot,
// Anonymous as this is not an actual file, but a memory,
// Private as this is in-process memory region.
syscall.MAP_ANON|syscall.MAP_PRIVATE,
)
}
|