summaryrefslogtreecommitdiff
path: root/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unix.go
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2025-03-09 17:47:56 +0100
committerLibravatar Terin Stock <terinjokes@gmail.com>2025-03-10 01:59:49 +0100
commit3ac1ee16f377d31a0fb80c8dae28b6239ac4229e (patch)
treef61faa581feaaeaba2542b9f2b8234a590684413 /vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unix.go
parent[chore] update URLs to forked source (diff)
downloadgotosocial-3ac1ee16f377d31a0fb80c8dae28b6239ac4229e.tar.xz
[chore] remove vendor
Diffstat (limited to 'vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unix.go')
-rw-r--r--vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unix.go32
1 files changed, 0 insertions, 32 deletions
diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unix.go b/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unix.go
deleted file mode 100644
index 8d0baa712..000000000
--- a/vendor/github.com/tetratelabs/wazero/internal/platform/mmap_unix.go
+++ /dev/null
@@ -1,32 +0,0 @@
-//go:build (linux || darwin || freebsd || netbsd || dragonfly || solaris) && !tinygo
-
-package platform
-
-import (
- "syscall"
-)
-
-const (
- mmapProtAMD64 = syscall.PROT_READ | syscall.PROT_WRITE | syscall.PROT_EXEC
- mmapProtARM64 = syscall.PROT_READ | syscall.PROT_WRITE
-)
-
-func munmapCodeSegment(code []byte) error {
- return syscall.Munmap(code)
-}
-
-// mmapCodeSegmentAMD64 gives all read-write-exec permission to the mmap region
-// to enter the function. Otherwise, segmentation fault exception is raised.
-func mmapCodeSegmentAMD64(size int) ([]byte, error) {
- // The region must be RWX: RW for writing native codes, X for executing the region.
- return mmapCodeSegment(size, mmapProtAMD64)
-}
-
-// mmapCodeSegmentARM64 cannot give all read-write-exec permission to the mmap region.
-// Otherwise, the mmap systemcall would raise an error. Here we give read-write
-// to the region so that we can write contents at call-sites. Callers are responsible to
-// execute MprotectRX on the returned buffer.
-func mmapCodeSegmentARM64(size int) ([]byte, error) {
- // The region must be RW: RW for writing native codes.
- return mmapCodeSegment(size, mmapProtARM64)
-}