threads: remove dead code (#2176)
Signed-off-by: Nuno Cruces <ncruces@users.noreply.github.com>
This commit is contained in:
@@ -14,18 +14,6 @@ const (
|
||||
|
||||
const MmapSupported = true
|
||||
|
||||
func mmapMemory(size int) ([]byte, error) {
|
||||
return syscall.Mmap(
|
||||
-1,
|
||||
0,
|
||||
size,
|
||||
syscall.PROT_READ|syscall.PROT_WRITE,
|
||||
// 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,
|
||||
)
|
||||
}
|
||||
|
||||
func munmapCodeSegment(code []byte) error {
|
||||
return syscall.Munmap(code)
|
||||
}
|
||||
|
||||
@@ -23,10 +23,6 @@ func mmapCodeSegmentARM64(size int) ([]byte, error) {
|
||||
panic(errUnsupported)
|
||||
}
|
||||
|
||||
func mmapMemory(size int) ([]byte, error) {
|
||||
panic(errUnsupported)
|
||||
}
|
||||
|
||||
func MprotectRX(b []byte) (err error) {
|
||||
panic(errUnsupported)
|
||||
}
|
||||
|
||||
@@ -58,15 +58,6 @@ func virtualProtect(address, size, newprotect uintptr, oldprotect *uint32) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func mmapMemory(size int) ([]byte, error) {
|
||||
p, err := allocateMemory(uintptr(size), windows_PAGE_READWRITE)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return unsafe.Slice((*byte)(unsafe.Pointer(p)), size), nil
|
||||
}
|
||||
|
||||
func mmapCodeSegmentAMD64(size int) ([]byte, error) {
|
||||
p, err := allocateMemory(uintptr(size), windows_PAGE_EXECUTE_READWRITE)
|
||||
if err != nil {
|
||||
|
||||
@@ -36,16 +36,6 @@ func MmapCodeSegment(size int) ([]byte, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// MmapMemory allocates a buffer of the given size using mmap. A large size can be allocated at once
|
||||
// without raising process memory usage, and physical pages will be allocated on access after calls to
|
||||
// Grow.
|
||||
func MmapMemory(size int) ([]byte, error) {
|
||||
if size == 0 {
|
||||
panic("BUG: MmapMemory with zero length")
|
||||
}
|
||||
return mmapMemory(size)
|
||||
}
|
||||
|
||||
// RemapCodeSegment reallocates the memory mapping of an existing code segment
|
||||
// to increase its size. The previous code mapping is unmapped and must not be
|
||||
// reused after the function returns.
|
||||
|
||||
Reference in New Issue
Block a user