mirror of https://github.com/ergochat/ergo.git
add forgotten x/sys vendor files
This commit is contained in:
parent
7202f56322
commit
69b4d93079
|
@ -0,0 +1,34 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build aix
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
const cacheLineSize = 128
|
||||||
|
|
||||||
|
const (
|
||||||
|
// getsystemcfg constants
|
||||||
|
_SC_IMPL = 2
|
||||||
|
_IMPL_POWER8 = 0x10000
|
||||||
|
_IMPL_POWER9 = 0x20000
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
impl := getsystemcfg(_SC_IMPL)
|
||||||
|
if impl&_IMPL_POWER8 != 0 {
|
||||||
|
PPC64.IsPOWER8 = true
|
||||||
|
}
|
||||||
|
if impl&_IMPL_POWER9 != 0 {
|
||||||
|
PPC64.IsPOWER9 = true
|
||||||
|
}
|
||||||
|
|
||||||
|
Initialized = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func getsystemcfg(label int) (n uint64) {
|
||||||
|
r0, _ := callgetsystemcfg(label)
|
||||||
|
n = uint64(r0)
|
||||||
|
return
|
||||||
|
}
|
|
@ -0,0 +1,144 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
import "runtime"
|
||||||
|
|
||||||
|
const cacheLineSize = 64
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
switch runtime.GOOS {
|
||||||
|
case "android", "darwin", "netbsd":
|
||||||
|
// Android and iOS don't seem to allow reading these registers.
|
||||||
|
//
|
||||||
|
// NetBSD:
|
||||||
|
// ID_AA64ISAR0_EL1 is a privileged register and cannot be read from EL0.
|
||||||
|
// It can be read via sysctl(3). Example for future implementers:
|
||||||
|
// https://nxr.netbsd.org/xref/src/usr.sbin/cpuctl/arch/aarch64.c
|
||||||
|
//
|
||||||
|
// Fake the minimal features expected by
|
||||||
|
// TestARM64minimalFeatures.
|
||||||
|
ARM64.HasASIMD = true
|
||||||
|
ARM64.HasFP = true
|
||||||
|
case "linux":
|
||||||
|
doinit()
|
||||||
|
default:
|
||||||
|
readARM64Registers()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func readARM64Registers() {
|
||||||
|
Initialized = true
|
||||||
|
|
||||||
|
// ID_AA64ISAR0_EL1
|
||||||
|
isar0 := getisar0()
|
||||||
|
|
||||||
|
switch extractBits(isar0, 4, 7) {
|
||||||
|
case 1:
|
||||||
|
ARM64.HasAES = true
|
||||||
|
case 2:
|
||||||
|
ARM64.HasAES = true
|
||||||
|
ARM64.HasPMULL = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch extractBits(isar0, 8, 11) {
|
||||||
|
case 1:
|
||||||
|
ARM64.HasSHA1 = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch extractBits(isar0, 12, 15) {
|
||||||
|
case 1:
|
||||||
|
ARM64.HasSHA2 = true
|
||||||
|
case 2:
|
||||||
|
ARM64.HasSHA2 = true
|
||||||
|
ARM64.HasSHA512 = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch extractBits(isar0, 16, 19) {
|
||||||
|
case 1:
|
||||||
|
ARM64.HasCRC32 = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch extractBits(isar0, 20, 23) {
|
||||||
|
case 2:
|
||||||
|
ARM64.HasATOMICS = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch extractBits(isar0, 28, 31) {
|
||||||
|
case 1:
|
||||||
|
ARM64.HasASIMDRDM = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch extractBits(isar0, 32, 35) {
|
||||||
|
case 1:
|
||||||
|
ARM64.HasSHA3 = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch extractBits(isar0, 36, 39) {
|
||||||
|
case 1:
|
||||||
|
ARM64.HasSM3 = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch extractBits(isar0, 40, 43) {
|
||||||
|
case 1:
|
||||||
|
ARM64.HasSM4 = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch extractBits(isar0, 44, 47) {
|
||||||
|
case 1:
|
||||||
|
ARM64.HasASIMDDP = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// ID_AA64ISAR1_EL1
|
||||||
|
isar1 := getisar1()
|
||||||
|
|
||||||
|
switch extractBits(isar1, 0, 3) {
|
||||||
|
case 1:
|
||||||
|
ARM64.HasDCPOP = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch extractBits(isar1, 12, 15) {
|
||||||
|
case 1:
|
||||||
|
ARM64.HasJSCVT = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch extractBits(isar1, 16, 19) {
|
||||||
|
case 1:
|
||||||
|
ARM64.HasFCMA = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch extractBits(isar1, 20, 23) {
|
||||||
|
case 1:
|
||||||
|
ARM64.HasLRCPC = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// ID_AA64PFR0_EL1
|
||||||
|
pfr0 := getpfr0()
|
||||||
|
|
||||||
|
switch extractBits(pfr0, 16, 19) {
|
||||||
|
case 0:
|
||||||
|
ARM64.HasFP = true
|
||||||
|
case 1:
|
||||||
|
ARM64.HasFP = true
|
||||||
|
ARM64.HasFPHP = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch extractBits(pfr0, 20, 23) {
|
||||||
|
case 0:
|
||||||
|
ARM64.HasASIMD = true
|
||||||
|
case 1:
|
||||||
|
ARM64.HasASIMD = true
|
||||||
|
ARM64.HasASIMDHP = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch extractBits(pfr0, 32, 35) {
|
||||||
|
case 1:
|
||||||
|
ARM64.HasSVE = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func extractBits(data uint64, start, end uint) uint {
|
||||||
|
return (uint)(data>>start) & ((1 << (end - start + 1)) - 1)
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !gccgo
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
// func getisar0() uint64
|
||||||
|
TEXT ·getisar0(SB),NOSPLIT,$0-8
|
||||||
|
// get Instruction Set Attributes 0 into x0
|
||||||
|
// mrs x0, ID_AA64ISAR0_EL1 = d5380600
|
||||||
|
WORD $0xd5380600
|
||||||
|
MOVD R0, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
|
// func getisar1() uint64
|
||||||
|
TEXT ·getisar1(SB),NOSPLIT,$0-8
|
||||||
|
// get Instruction Set Attributes 1 into x0
|
||||||
|
// mrs x0, ID_AA64ISAR1_EL1 = d5380620
|
||||||
|
WORD $0xd5380620
|
||||||
|
MOVD R0, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
|
// func getpfr0() uint64
|
||||||
|
TEXT ·getpfr0(SB),NOSPLIT,$0-8
|
||||||
|
// get Processor Feature Register 0 into x0
|
||||||
|
// mrs x0, ID_AA64PFR0_EL1 = d5380400
|
||||||
|
WORD $0xd5380400
|
||||||
|
MOVD R0, ret+0(FP)
|
||||||
|
RET
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !gccgo
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
func getisar0() uint64
|
||||||
|
func getisar1() uint64
|
||||||
|
func getpfr0() uint64
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build gccgo
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
func getisar0() uint64 { return 0 }
|
||||||
|
func getisar1() uint64 { return 0 }
|
||||||
|
func getpfr0() uint64 { return 0 }
|
|
@ -0,0 +1,43 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build 386 amd64 amd64p32
|
||||||
|
// +build gccgo
|
||||||
|
|
||||||
|
#include <cpuid.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
// Need to wrap __get_cpuid_count because it's declared as static.
|
||||||
|
int
|
||||||
|
gccgoGetCpuidCount(uint32_t leaf, uint32_t subleaf,
|
||||||
|
uint32_t *eax, uint32_t *ebx,
|
||||||
|
uint32_t *ecx, uint32_t *edx)
|
||||||
|
{
|
||||||
|
return __get_cpuid_count(leaf, subleaf, eax, ebx, ecx, edx);
|
||||||
|
}
|
||||||
|
|
||||||
|
// xgetbv reads the contents of an XCR (Extended Control Register)
|
||||||
|
// specified in the ECX register into registers EDX:EAX.
|
||||||
|
// Currently, the only supported value for XCR is 0.
|
||||||
|
//
|
||||||
|
// TODO: Replace with a better alternative:
|
||||||
|
//
|
||||||
|
// #include <xsaveintrin.h>
|
||||||
|
//
|
||||||
|
// #pragma GCC target("xsave")
|
||||||
|
//
|
||||||
|
// void gccgoXgetbv(uint32_t *eax, uint32_t *edx) {
|
||||||
|
// unsigned long long x = _xgetbv(0);
|
||||||
|
// *eax = x & 0xffffffff;
|
||||||
|
// *edx = (x >> 32) & 0xffffffff;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Note that _xgetbv is defined starting with GCC 8.
|
||||||
|
void
|
||||||
|
gccgoXgetbv(uint32_t *eax, uint32_t *edx)
|
||||||
|
{
|
||||||
|
__asm(" xorl %%ecx, %%ecx\n"
|
||||||
|
" xgetbv"
|
||||||
|
: "=a"(*eax), "=d"(*edx));
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build 386 amd64 amd64p32
|
||||||
|
// +build gccgo
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
//extern gccgoGetCpuidCount
|
||||||
|
func gccgoGetCpuidCount(eaxArg, ecxArg uint32, eax, ebx, ecx, edx *uint32)
|
||||||
|
|
||||||
|
func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) {
|
||||||
|
var a, b, c, d uint32
|
||||||
|
gccgoGetCpuidCount(eaxArg, ecxArg, &a, &b, &c, &d)
|
||||||
|
return a, b, c, d
|
||||||
|
}
|
||||||
|
|
||||||
|
//extern gccgoXgetbv
|
||||||
|
func gccgoXgetbv(eax, edx *uint32)
|
||||||
|
|
||||||
|
func xgetbv() (eax, edx uint32) {
|
||||||
|
var a, d uint32
|
||||||
|
gccgoXgetbv(&a, &d)
|
||||||
|
return a, d
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2020 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build mips64 mips64le
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
// HWCAP bits. These are exposed by the Linux kernel 5.4.
|
||||||
|
const (
|
||||||
|
// CPU features
|
||||||
|
hwcap_MIPS_MSA = 1 << 1
|
||||||
|
)
|
||||||
|
|
||||||
|
func doinit() {
|
||||||
|
// HWCAP feature bits
|
||||||
|
MIPS64X.HasMSA = isSet(hwCap, hwcap_MIPS_MSA)
|
||||||
|
}
|
||||||
|
|
||||||
|
func isSet(hwc uint, value uint) bool {
|
||||||
|
return hwc&value != 0
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io/ioutil"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
_AT_HWCAP = 16
|
||||||
|
_AT_HWCAP2 = 26
|
||||||
|
|
||||||
|
procAuxv = "/proc/self/auxv"
|
||||||
|
|
||||||
|
uintSize = int(32 << (^uint(0) >> 63))
|
||||||
|
)
|
||||||
|
|
||||||
|
// For those platforms don't have a 'cpuid' equivalent we use HWCAP/HWCAP2
|
||||||
|
// These are initialized in cpu_$GOARCH.go
|
||||||
|
// and should not be changed after they are initialized.
|
||||||
|
var hwCap uint
|
||||||
|
var hwCap2 uint
|
||||||
|
|
||||||
|
func readHWCAP() error {
|
||||||
|
buf, err := ioutil.ReadFile(procAuxv)
|
||||||
|
if err != nil {
|
||||||
|
// e.g. on android /proc/self/auxv is not accessible, so silently
|
||||||
|
// ignore the error and leave Initialized = false. On some
|
||||||
|
// architectures (e.g. arm64) doinit() implements a fallback
|
||||||
|
// readout and will set Initialized = true again.
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
bo := hostByteOrder()
|
||||||
|
for len(buf) >= 2*(uintSize/8) {
|
||||||
|
var tag, val uint
|
||||||
|
switch uintSize {
|
||||||
|
case 32:
|
||||||
|
tag = uint(bo.Uint32(buf[0:]))
|
||||||
|
val = uint(bo.Uint32(buf[4:]))
|
||||||
|
buf = buf[8:]
|
||||||
|
case 64:
|
||||||
|
tag = uint(bo.Uint64(buf[0:]))
|
||||||
|
val = uint(bo.Uint64(buf[8:]))
|
||||||
|
buf = buf[16:]
|
||||||
|
}
|
||||||
|
switch tag {
|
||||||
|
case _AT_HWCAP:
|
||||||
|
hwCap = val
|
||||||
|
case _AT_HWCAP2:
|
||||||
|
hwCap2 = val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright 2020 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Recreate a getsystemcfg syscall handler instead of
|
||||||
|
// using the one provided by x/sys/unix to avoid having
|
||||||
|
// the dependency between them. (See golang.org/issue/32102)
|
||||||
|
// Morever, this file will be used during the building of
|
||||||
|
// gccgo's libgo and thus must not used a CGo method.
|
||||||
|
|
||||||
|
// +build aix
|
||||||
|
// +build gccgo
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
//extern getsystemcfg
|
||||||
|
func gccgoGetsystemcfg(label uint32) (r uint64)
|
||||||
|
|
||||||
|
func callgetsystemcfg(label int) (r1 uintptr, e1 syscall.Errno) {
|
||||||
|
r1 = uintptr(gccgoGetsystemcfg(uint32(label)))
|
||||||
|
e1 = syscall.GetErrno()
|
||||||
|
return
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright 2020 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Package unsafeheader contains header declarations for the Go runtime's
|
||||||
|
// slice and string implementations.
|
||||||
|
//
|
||||||
|
// This package allows x/sys to use types equivalent to
|
||||||
|
// reflect.SliceHeader and reflect.StringHeader without introducing
|
||||||
|
// a dependency on the (relatively heavy) "reflect" package.
|
||||||
|
package unsafeheader
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Slice is the runtime representation of a slice.
|
||||||
|
// It cannot be used safely or portably and its representation may change in a later release.
|
||||||
|
type Slice struct {
|
||||||
|
Data unsafe.Pointer
|
||||||
|
Len int
|
||||||
|
Cap int
|
||||||
|
}
|
||||||
|
|
||||||
|
// String is the runtime representation of a string.
|
||||||
|
// It cannot be used safely or portably and its representation may change in a later release.
|
||||||
|
type String struct {
|
||||||
|
Data unsafe.Pointer
|
||||||
|
Len int
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2020 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
|
||||||
|
// them here for backwards compatibility.
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
const (
|
||||||
|
DLT_HHDLC = 0x79
|
||||||
|
IPV6_MIN_MEMBERSHIPS = 0x1f
|
||||||
|
IP_MAX_SOURCE_FILTER = 0x400
|
||||||
|
IP_MIN_MEMBERSHIPS = 0x1f
|
||||||
|
RT_CACHING_CONTEXT = 0x1
|
||||||
|
RT_NORTREF = 0x2
|
||||||
|
)
|
|
@ -0,0 +1,57 @@
|
||||||
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// illumos system calls not present on Solaris.
|
||||||
|
|
||||||
|
// +build amd64,illumos
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
func bytes2iovec(bs [][]byte) []Iovec {
|
||||||
|
iovecs := make([]Iovec, len(bs))
|
||||||
|
for i, b := range bs {
|
||||||
|
iovecs[i].SetLen(len(b))
|
||||||
|
if len(b) > 0 {
|
||||||
|
// somehow Iovec.Base on illumos is (*int8), not (*byte)
|
||||||
|
iovecs[i].Base = (*int8)(unsafe.Pointer(&b[0]))
|
||||||
|
} else {
|
||||||
|
iovecs[i].Base = (*int8)(unsafe.Pointer(&_zero))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return iovecs
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys readv(fd int, iovs []Iovec) (n int, err error)
|
||||||
|
|
||||||
|
func Readv(fd int, iovs [][]byte) (n int, err error) {
|
||||||
|
iovecs := bytes2iovec(iovs)
|
||||||
|
n, err = readv(fd, iovecs)
|
||||||
|
return n, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys preadv(fd int, iovs []Iovec, off int64) (n int, err error)
|
||||||
|
|
||||||
|
func Preadv(fd int, iovs [][]byte, off int64) (n int, err error) {
|
||||||
|
iovecs := bytes2iovec(iovs)
|
||||||
|
n, err = preadv(fd, iovecs, off)
|
||||||
|
return n, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys writev(fd int, iovs []Iovec) (n int, err error)
|
||||||
|
|
||||||
|
func Writev(fd int, iovs [][]byte) (n int, err error) {
|
||||||
|
iovecs := bytes2iovec(iovs)
|
||||||
|
n, err = writev(fd, iovecs)
|
||||||
|
return n, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys pwritev(fd int, iovs []Iovec, off int64) (n int, err error)
|
||||||
|
|
||||||
|
func Pwritev(fd int, iovs [][]byte, off int64) (n int, err error) {
|
||||||
|
iovecs := bytes2iovec(iovs)
|
||||||
|
n, err = pwritev(fd, iovecs, off)
|
||||||
|
return n, err
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,41 @@
|
||||||
|
// Code generated by linux/mkall.go generatePtracePair("arm", "arm64"). DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build linux
|
||||||
|
// +build arm arm64
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// PtraceRegsArm is the registers used by arm binaries.
|
||||||
|
type PtraceRegsArm struct {
|
||||||
|
Uregs [18]uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceGetRegsArm fetches the registers used by arm binaries.
|
||||||
|
func PtraceGetRegsArm(pid int, regsout *PtraceRegsArm) error {
|
||||||
|
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceSetRegsArm sets the registers used by arm binaries.
|
||||||
|
func PtraceSetRegsArm(pid int, regs *PtraceRegsArm) error {
|
||||||
|
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceRegsArm64 is the registers used by arm64 binaries.
|
||||||
|
type PtraceRegsArm64 struct {
|
||||||
|
Regs [31]uint64
|
||||||
|
Sp uint64
|
||||||
|
Pc uint64
|
||||||
|
Pstate uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceGetRegsArm64 fetches the registers used by arm64 binaries.
|
||||||
|
func PtraceGetRegsArm64(pid int, regsout *PtraceRegsArm64) error {
|
||||||
|
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceSetRegsArm64 sets the registers used by arm64 binaries.
|
||||||
|
func PtraceSetRegsArm64(pid int, regs *PtraceRegsArm64) error {
|
||||||
|
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Code generated by linux/mkall.go generatePtraceRegSet("arm64"). DO NOT EDIT.
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// PtraceGetRegSetArm64 fetches the registers used by arm64 binaries.
|
||||||
|
func PtraceGetRegSetArm64(pid, addr int, regsout *PtraceRegsArm64) error {
|
||||||
|
iovec := Iovec{(*byte)(unsafe.Pointer(regsout)), uint64(unsafe.Sizeof(*regsout))}
|
||||||
|
return ptrace(PTRACE_GETREGSET, pid, uintptr(addr), uintptr(unsafe.Pointer(&iovec)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceSetRegSetArm64 sets the registers used by arm64 binaries.
|
||||||
|
func PtraceSetRegSetArm64(pid, addr int, regs *PtraceRegsArm64) error {
|
||||||
|
iovec := Iovec{(*byte)(unsafe.Pointer(regs)), uint64(unsafe.Sizeof(*regs))}
|
||||||
|
return ptrace(PTRACE_SETREGSET, pid, uintptr(addr), uintptr(unsafe.Pointer(&iovec)))
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
// Code generated by linux/mkall.go generatePtracePair("mips", "mips64"). DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build linux
|
||||||
|
// +build mips mips64
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// PtraceRegsMips is the registers used by mips binaries.
|
||||||
|
type PtraceRegsMips struct {
|
||||||
|
Regs [32]uint64
|
||||||
|
Lo uint64
|
||||||
|
Hi uint64
|
||||||
|
Epc uint64
|
||||||
|
Badvaddr uint64
|
||||||
|
Status uint64
|
||||||
|
Cause uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceGetRegsMips fetches the registers used by mips binaries.
|
||||||
|
func PtraceGetRegsMips(pid int, regsout *PtraceRegsMips) error {
|
||||||
|
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceSetRegsMips sets the registers used by mips binaries.
|
||||||
|
func PtraceSetRegsMips(pid int, regs *PtraceRegsMips) error {
|
||||||
|
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceRegsMips64 is the registers used by mips64 binaries.
|
||||||
|
type PtraceRegsMips64 struct {
|
||||||
|
Regs [32]uint64
|
||||||
|
Lo uint64
|
||||||
|
Hi uint64
|
||||||
|
Epc uint64
|
||||||
|
Badvaddr uint64
|
||||||
|
Status uint64
|
||||||
|
Cause uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceGetRegsMips64 fetches the registers used by mips64 binaries.
|
||||||
|
func PtraceGetRegsMips64(pid int, regsout *PtraceRegsMips64) error {
|
||||||
|
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceSetRegsMips64 sets the registers used by mips64 binaries.
|
||||||
|
func PtraceSetRegsMips64(pid int, regs *PtraceRegsMips64) error {
|
||||||
|
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
// Code generated by linux/mkall.go generatePtracePair("mipsle", "mips64le"). DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build linux
|
||||||
|
// +build mipsle mips64le
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// PtraceRegsMipsle is the registers used by mipsle binaries.
|
||||||
|
type PtraceRegsMipsle struct {
|
||||||
|
Regs [32]uint64
|
||||||
|
Lo uint64
|
||||||
|
Hi uint64
|
||||||
|
Epc uint64
|
||||||
|
Badvaddr uint64
|
||||||
|
Status uint64
|
||||||
|
Cause uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceGetRegsMipsle fetches the registers used by mipsle binaries.
|
||||||
|
func PtraceGetRegsMipsle(pid int, regsout *PtraceRegsMipsle) error {
|
||||||
|
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceSetRegsMipsle sets the registers used by mipsle binaries.
|
||||||
|
func PtraceSetRegsMipsle(pid int, regs *PtraceRegsMipsle) error {
|
||||||
|
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceRegsMips64le is the registers used by mips64le binaries.
|
||||||
|
type PtraceRegsMips64le struct {
|
||||||
|
Regs [32]uint64
|
||||||
|
Lo uint64
|
||||||
|
Hi uint64
|
||||||
|
Epc uint64
|
||||||
|
Badvaddr uint64
|
||||||
|
Status uint64
|
||||||
|
Cause uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceGetRegsMips64le fetches the registers used by mips64le binaries.
|
||||||
|
func PtraceGetRegsMips64le(pid int, regsout *PtraceRegsMips64le) error {
|
||||||
|
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceSetRegsMips64le sets the registers used by mips64le binaries.
|
||||||
|
func PtraceSetRegsMips64le(pid int, regs *PtraceRegsMips64le) error {
|
||||||
|
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
// Code generated by linux/mkall.go generatePtracePair("386", "amd64"). DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build linux
|
||||||
|
// +build 386 amd64
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// PtraceRegs386 is the registers used by 386 binaries.
|
||||||
|
type PtraceRegs386 struct {
|
||||||
|
Ebx int32
|
||||||
|
Ecx int32
|
||||||
|
Edx int32
|
||||||
|
Esi int32
|
||||||
|
Edi int32
|
||||||
|
Ebp int32
|
||||||
|
Eax int32
|
||||||
|
Xds int32
|
||||||
|
Xes int32
|
||||||
|
Xfs int32
|
||||||
|
Xgs int32
|
||||||
|
Orig_eax int32
|
||||||
|
Eip int32
|
||||||
|
Xcs int32
|
||||||
|
Eflags int32
|
||||||
|
Esp int32
|
||||||
|
Xss int32
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceGetRegs386 fetches the registers used by 386 binaries.
|
||||||
|
func PtraceGetRegs386(pid int, regsout *PtraceRegs386) error {
|
||||||
|
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceSetRegs386 sets the registers used by 386 binaries.
|
||||||
|
func PtraceSetRegs386(pid int, regs *PtraceRegs386) error {
|
||||||
|
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceRegsAmd64 is the registers used by amd64 binaries.
|
||||||
|
type PtraceRegsAmd64 struct {
|
||||||
|
R15 uint64
|
||||||
|
R14 uint64
|
||||||
|
R13 uint64
|
||||||
|
R12 uint64
|
||||||
|
Rbp uint64
|
||||||
|
Rbx uint64
|
||||||
|
R11 uint64
|
||||||
|
R10 uint64
|
||||||
|
R9 uint64
|
||||||
|
R8 uint64
|
||||||
|
Rax uint64
|
||||||
|
Rcx uint64
|
||||||
|
Rdx uint64
|
||||||
|
Rsi uint64
|
||||||
|
Rdi uint64
|
||||||
|
Orig_rax uint64
|
||||||
|
Rip uint64
|
||||||
|
Cs uint64
|
||||||
|
Eflags uint64
|
||||||
|
Rsp uint64
|
||||||
|
Ss uint64
|
||||||
|
Fs_base uint64
|
||||||
|
Gs_base uint64
|
||||||
|
Ds uint64
|
||||||
|
Es uint64
|
||||||
|
Fs uint64
|
||||||
|
Gs uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceGetRegsAmd64 fetches the registers used by amd64 binaries.
|
||||||
|
func PtraceGetRegsAmd64(pid int, regsout *PtraceRegsAmd64) error {
|
||||||
|
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// PtraceSetRegsAmd64 sets the registers used by amd64 binaries.
|
||||||
|
func PtraceSetRegsAmd64(pid int, regs *PtraceRegsAmd64) error {
|
||||||
|
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
// go run mksyscall_solaris.go -illumos -tags illumos,amd64 syscall_illumos.go
|
||||||
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build illumos,amd64
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic libc_readv readv "libc.so"
|
||||||
|
//go:cgo_import_dynamic libc_preadv preadv "libc.so"
|
||||||
|
//go:cgo_import_dynamic libc_writev writev "libc.so"
|
||||||
|
//go:cgo_import_dynamic libc_pwritev pwritev "libc.so"
|
||||||
|
|
||||||
|
//go:linkname procreadv libc_readv
|
||||||
|
//go:linkname procpreadv libc_preadv
|
||||||
|
//go:linkname procwritev libc_writev
|
||||||
|
//go:linkname procpwritev libc_pwritev
|
||||||
|
|
||||||
|
var (
|
||||||
|
procreadv,
|
||||||
|
procpreadv,
|
||||||
|
procwritev,
|
||||||
|
procpwritev syscallFunc
|
||||||
|
)
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func readv(fd int, iovs []Iovec) (n int, err error) {
|
||||||
|
var _p0 *Iovec
|
||||||
|
if len(iovs) > 0 {
|
||||||
|
_p0 = &iovs[0]
|
||||||
|
}
|
||||||
|
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procreadv)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), 0, 0, 0)
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func preadv(fd int, iovs []Iovec, off int64) (n int, err error) {
|
||||||
|
var _p0 *Iovec
|
||||||
|
if len(iovs) > 0 {
|
||||||
|
_p0 = &iovs[0]
|
||||||
|
}
|
||||||
|
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpreadv)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), uintptr(off), 0, 0)
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func writev(fd int, iovs []Iovec) (n int, err error) {
|
||||||
|
var _p0 *Iovec
|
||||||
|
if len(iovs) > 0 {
|
||||||
|
_p0 = &iovs[0]
|
||||||
|
}
|
||||||
|
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwritev)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), 0, 0, 0)
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func pwritev(fd int, iovs []Iovec, off int64) (n int, err error) {
|
||||||
|
var _p0 *Iovec
|
||||||
|
if len(iovs) > 0 {
|
||||||
|
_p0 = &iovs[0]
|
||||||
|
}
|
||||||
|
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpwritev)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), uintptr(off), 0, 0)
|
||||||
|
n = int(r0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue