mirror of
https://github.com/golang/go
synced 2024-11-18 15:04:44 -07:00
runtime: always load address of libcFunc on Solaris
The linker always uses .plt for externals, so libcFunc is now an actual external symbol instead of a pointer to one. Fixes most of the breakage introduced in previous CL. Change-Id: I64b8c96f93127f2d13b5289b024677fd3ea7dbea Reviewed-on: https://go-review.googlesource.com/8215 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Minux Ma <minux@golang.org>
This commit is contained in:
parent
e481aac0e1
commit
c94f1f791b
@ -89,23 +89,23 @@ func errno() int32 {
|
||||
}
|
||||
|
||||
func fcntl(fd, cmd int32, arg uintptr) int32 {
|
||||
return int32(sysvicall3(libc_fcntl, uintptr(fd), uintptr(cmd), arg))
|
||||
return int32(sysvicall3(&libc_fcntl, uintptr(fd), uintptr(cmd), arg))
|
||||
}
|
||||
|
||||
func port_create() int32 {
|
||||
return int32(sysvicall0(libc_port_create))
|
||||
return int32(sysvicall0(&libc_port_create))
|
||||
}
|
||||
|
||||
func port_associate(port, source int32, object uintptr, events uint32, user uintptr) int32 {
|
||||
return int32(sysvicall5(libc_port_associate, uintptr(port), uintptr(source), object, uintptr(events), user))
|
||||
return int32(sysvicall5(&libc_port_associate, uintptr(port), uintptr(source), object, uintptr(events), user))
|
||||
}
|
||||
|
||||
func port_dissociate(port, source int32, object uintptr) int32 {
|
||||
return int32(sysvicall3(libc_port_dissociate, uintptr(port), uintptr(source), object))
|
||||
return int32(sysvicall3(&libc_port_dissociate, uintptr(port), uintptr(source), object))
|
||||
}
|
||||
|
||||
func port_getn(port int32, evs *portevent, max uint32, nget *uint32, timeout *timespec) int32 {
|
||||
return int32(sysvicall5(libc_port_getn, uintptr(port), uintptr(unsafe.Pointer(evs)), uintptr(max), uintptr(unsafe.Pointer(nget)), uintptr(unsafe.Pointer(timeout))))
|
||||
return int32(sysvicall5(&libc_port_getn, uintptr(port), uintptr(unsafe.Pointer(evs)), uintptr(max), uintptr(unsafe.Pointer(nget)), uintptr(unsafe.Pointer(timeout))))
|
||||
}
|
||||
|
||||
var portfd int32 = -1
|
||||
|
@ -194,7 +194,7 @@ func miniterrno()
|
||||
// Called on the new thread, can not allocate memory.
|
||||
func minit() {
|
||||
_g_ := getg()
|
||||
asmcgocall(unsafe.Pointer(funcPC(miniterrno)), unsafe.Pointer(libc____errno))
|
||||
asmcgocall(unsafe.Pointer(funcPC(miniterrno)), unsafe.Pointer(&libc____errno))
|
||||
// Initialize signal handling
|
||||
signalstack((*byte)(unsafe.Pointer(_g_.m.gsignal.stack.lo)), 32*1024)
|
||||
sigprocmask(_SIG_SETMASK, &sigset_none, nil)
|
||||
@ -290,7 +290,7 @@ func semacreate() uintptr {
|
||||
// Call libc's malloc rather than malloc. This will
|
||||
// allocate space on the C heap. We can't call malloc
|
||||
// here because it could cause a deadlock.
|
||||
_g_.m.libcall.fn = uintptr(libc_malloc)
|
||||
_g_.m.libcall.fn = uintptr(unsafe.Pointer(&libc_malloc))
|
||||
_g_.m.libcall.n = 1
|
||||
memclr(unsafe.Pointer(&_g_.m.scratch), uintptr(len(_g_.m.scratch.v)))
|
||||
_g_.m.scratch.v[0] = unsafe.Sizeof(*sem)
|
||||
@ -310,7 +310,7 @@ func semasleep(ns int64) int32 {
|
||||
_m_.ts.tv_sec = ns / 1000000000
|
||||
_m_.ts.tv_nsec = ns % 1000000000
|
||||
|
||||
_m_.libcall.fn = uintptr(unsafe.Pointer(libc_sem_reltimedwait_np))
|
||||
_m_.libcall.fn = uintptr(unsafe.Pointer(&libc_sem_reltimedwait_np))
|
||||
_m_.libcall.n = 2
|
||||
memclr(unsafe.Pointer(&_m_.scratch), uintptr(len(_m_.scratch.v)))
|
||||
_m_.scratch.v[0] = _m_.waitsema
|
||||
@ -326,7 +326,7 @@ func semasleep(ns int64) int32 {
|
||||
return 0
|
||||
}
|
||||
for {
|
||||
_m_.libcall.fn = uintptr(unsafe.Pointer(libc_sem_wait))
|
||||
_m_.libcall.fn = uintptr(unsafe.Pointer(&libc_sem_wait))
|
||||
_m_.libcall.n = 1
|
||||
memclr(unsafe.Pointer(&_m_.scratch), uintptr(len(_m_.scratch.v)))
|
||||
_m_.scratch.v[0] = _m_.waitsema
|
||||
@ -352,121 +352,121 @@ func semawakeup(mp *m) {
|
||||
|
||||
//go:nosplit
|
||||
func closefd(fd int32) int32 {
|
||||
return int32(sysvicall1(libc_close, uintptr(fd)))
|
||||
return int32(sysvicall1(&libc_close, uintptr(fd)))
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func exit(r int32) {
|
||||
sysvicall1(libc_exit, uintptr(r))
|
||||
sysvicall1(&libc_exit, uintptr(r))
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func getcontext(context *ucontext) /* int32 */ {
|
||||
sysvicall1(libc_getcontext, uintptr(unsafe.Pointer(context)))
|
||||
sysvicall1(&libc_getcontext, uintptr(unsafe.Pointer(context)))
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func madvise(addr unsafe.Pointer, n uintptr, flags int32) {
|
||||
sysvicall3(libc_madvise, uintptr(addr), uintptr(n), uintptr(flags))
|
||||
sysvicall3(&libc_madvise, uintptr(addr), uintptr(n), uintptr(flags))
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) unsafe.Pointer {
|
||||
return unsafe.Pointer(sysvicall6(libc_mmap, uintptr(addr), uintptr(n), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(off)))
|
||||
return unsafe.Pointer(sysvicall6(&libc_mmap, uintptr(addr), uintptr(n), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(off)))
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func munmap(addr unsafe.Pointer, n uintptr) {
|
||||
sysvicall2(libc_munmap, uintptr(addr), uintptr(n))
|
||||
sysvicall2(&libc_munmap, uintptr(addr), uintptr(n))
|
||||
}
|
||||
|
||||
func nanotime1()
|
||||
|
||||
//go:nosplit
|
||||
func nanotime() int64 {
|
||||
return int64(sysvicall0(libcFunc(funcPC(nanotime1))))
|
||||
return int64(sysvicall0((*libcFunc)(unsafe.Pointer(funcPC(nanotime1)))))
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func open(path *byte, mode, perm int32) int32 {
|
||||
return int32(sysvicall3(libc_open, uintptr(unsafe.Pointer(path)), uintptr(mode), uintptr(perm)))
|
||||
return int32(sysvicall3(&libc_open, uintptr(unsafe.Pointer(path)), uintptr(mode), uintptr(perm)))
|
||||
}
|
||||
|
||||
func pthread_attr_destroy(attr *pthreadattr) int32 {
|
||||
return int32(sysvicall1(libc_pthread_attr_destroy, uintptr(unsafe.Pointer(attr))))
|
||||
return int32(sysvicall1(&libc_pthread_attr_destroy, uintptr(unsafe.Pointer(attr))))
|
||||
}
|
||||
|
||||
func pthread_attr_getstack(attr *pthreadattr, addr unsafe.Pointer, size *uint64) int32 {
|
||||
return int32(sysvicall3(libc_pthread_attr_getstack, uintptr(unsafe.Pointer(attr)), uintptr(addr), uintptr(unsafe.Pointer(size))))
|
||||
return int32(sysvicall3(&libc_pthread_attr_getstack, uintptr(unsafe.Pointer(attr)), uintptr(addr), uintptr(unsafe.Pointer(size))))
|
||||
}
|
||||
|
||||
func pthread_attr_init(attr *pthreadattr) int32 {
|
||||
return int32(sysvicall1(libc_pthread_attr_init, uintptr(unsafe.Pointer(attr))))
|
||||
return int32(sysvicall1(&libc_pthread_attr_init, uintptr(unsafe.Pointer(attr))))
|
||||
}
|
||||
|
||||
func pthread_attr_setdetachstate(attr *pthreadattr, state int32) int32 {
|
||||
return int32(sysvicall2(libc_pthread_attr_setdetachstate, uintptr(unsafe.Pointer(attr)), uintptr(state)))
|
||||
return int32(sysvicall2(&libc_pthread_attr_setdetachstate, uintptr(unsafe.Pointer(attr)), uintptr(state)))
|
||||
}
|
||||
|
||||
func pthread_attr_setstack(attr *pthreadattr, addr uintptr, size uint64) int32 {
|
||||
return int32(sysvicall3(libc_pthread_attr_setstack, uintptr(unsafe.Pointer(attr)), uintptr(addr), uintptr(size)))
|
||||
return int32(sysvicall3(&libc_pthread_attr_setstack, uintptr(unsafe.Pointer(attr)), uintptr(addr), uintptr(size)))
|
||||
}
|
||||
|
||||
func pthread_create(thread *pthread, attr *pthreadattr, fn uintptr, arg unsafe.Pointer) int32 {
|
||||
return int32(sysvicall4(libc_pthread_create, uintptr(unsafe.Pointer(thread)), uintptr(unsafe.Pointer(attr)), uintptr(fn), uintptr(arg)))
|
||||
return int32(sysvicall4(&libc_pthread_create, uintptr(unsafe.Pointer(thread)), uintptr(unsafe.Pointer(attr)), uintptr(fn), uintptr(arg)))
|
||||
}
|
||||
|
||||
func raise(sig int32) /* int32 */ {
|
||||
sysvicall1(libc_raise, uintptr(sig))
|
||||
sysvicall1(&libc_raise, uintptr(sig))
|
||||
}
|
||||
|
||||
func raiseproc(sig int32) /* int32 */ {
|
||||
sysvicall1(libc_raise, uintptr(sig))
|
||||
sysvicall1(&libc_raise, uintptr(sig))
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func read(fd int32, buf unsafe.Pointer, nbyte int32) int32 {
|
||||
return int32(sysvicall3(libc_read, uintptr(fd), uintptr(buf), uintptr(nbyte)))
|
||||
return int32(sysvicall3(&libc_read, uintptr(fd), uintptr(buf), uintptr(nbyte)))
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func sem_init(sem *semt, pshared int32, value uint32) int32 {
|
||||
return int32(sysvicall3(libc_sem_init, uintptr(unsafe.Pointer(sem)), uintptr(pshared), uintptr(value)))
|
||||
return int32(sysvicall3(&libc_sem_init, uintptr(unsafe.Pointer(sem)), uintptr(pshared), uintptr(value)))
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func sem_post(sem *semt) int32 {
|
||||
return int32(sysvicall1(libc_sem_post, uintptr(unsafe.Pointer(sem))))
|
||||
return int32(sysvicall1(&libc_sem_post, uintptr(unsafe.Pointer(sem))))
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func sem_reltimedwait_np(sem *semt, timeout *timespec) int32 {
|
||||
return int32(sysvicall2(libc_sem_reltimedwait_np, uintptr(unsafe.Pointer(sem)), uintptr(unsafe.Pointer(timeout))))
|
||||
return int32(sysvicall2(&libc_sem_reltimedwait_np, uintptr(unsafe.Pointer(sem)), uintptr(unsafe.Pointer(timeout))))
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func sem_wait(sem *semt) int32 {
|
||||
return int32(sysvicall1(libc_sem_wait, uintptr(unsafe.Pointer(sem))))
|
||||
return int32(sysvicall1(&libc_sem_wait, uintptr(unsafe.Pointer(sem))))
|
||||
}
|
||||
|
||||
func setitimer(which int32, value *itimerval, ovalue *itimerval) /* int32 */ {
|
||||
sysvicall3(libc_setitimer, uintptr(which), uintptr(unsafe.Pointer(value)), uintptr(unsafe.Pointer(ovalue)))
|
||||
sysvicall3(&libc_setitimer, uintptr(which), uintptr(unsafe.Pointer(value)), uintptr(unsafe.Pointer(ovalue)))
|
||||
}
|
||||
|
||||
func sigaction(sig int32, act *sigactiont, oact *sigactiont) /* int32 */ {
|
||||
sysvicall3(libc_sigaction, uintptr(sig), uintptr(unsafe.Pointer(act)), uintptr(unsafe.Pointer(oact)))
|
||||
sysvicall3(&libc_sigaction, uintptr(sig), uintptr(unsafe.Pointer(act)), uintptr(unsafe.Pointer(oact)))
|
||||
}
|
||||
|
||||
func sigaltstack(ss *sigaltstackt, oss *sigaltstackt) /* int32 */ {
|
||||
sysvicall2(libc_sigaltstack, uintptr(unsafe.Pointer(ss)), uintptr(unsafe.Pointer(oss)))
|
||||
sysvicall2(&libc_sigaltstack, uintptr(unsafe.Pointer(ss)), uintptr(unsafe.Pointer(oss)))
|
||||
}
|
||||
|
||||
func sigprocmask(how int32, set *sigset, oset *sigset) /* int32 */ {
|
||||
sysvicall3(libc_sigprocmask, uintptr(how), uintptr(unsafe.Pointer(set)), uintptr(unsafe.Pointer(oset)))
|
||||
sysvicall3(&libc_sigprocmask, uintptr(how), uintptr(unsafe.Pointer(set)), uintptr(unsafe.Pointer(oset)))
|
||||
}
|
||||
|
||||
func sysconf(name int32) int64 {
|
||||
return int64(sysvicall1(libc_sysconf, uintptr(name)))
|
||||
return int64(sysvicall1(&libc_sysconf, uintptr(name)))
|
||||
}
|
||||
|
||||
func usleep1(uint32)
|
||||
@ -478,7 +478,7 @@ func usleep(µs uint32) {
|
||||
|
||||
//go:nosplit
|
||||
func write(fd uintptr, buf unsafe.Pointer, nbyte int32) int32 {
|
||||
return int32(sysvicall3(libc_write, uintptr(fd), uintptr(buf), uintptr(nbyte)))
|
||||
return int32(sysvicall3(&libc_write, uintptr(fd), uintptr(buf), uintptr(nbyte)))
|
||||
}
|
||||
|
||||
func osyield1()
|
||||
@ -490,7 +490,7 @@ func osyield() {
|
||||
// Check the validity of m because we might be called in cgo callback
|
||||
// path early enough where there isn't a m available yet.
|
||||
if _g_ != nil && _g_.m != nil {
|
||||
sysvicall0(libc_sched_yield)
|
||||
sysvicall0(&libc_sched_yield)
|
||||
return
|
||||
}
|
||||
osyield1()
|
||||
|
@ -14,19 +14,19 @@ var asmsysvicall6 libcFunc
|
||||
func sigfwd(fn uintptr, sig uint32, info *siginfo, ctx unsafe.Pointer)
|
||||
|
||||
//go:nosplit
|
||||
func sysvicall0(fn libcFunc) uintptr {
|
||||
func sysvicall0(fn *libcFunc) uintptr {
|
||||
libcall := &getg().m.libcall
|
||||
libcall.fn = uintptr(fn)
|
||||
libcall.fn = uintptr(unsafe.Pointer(fn))
|
||||
libcall.n = 0
|
||||
libcall.args = uintptr(fn) // it's unused but must be non-nil, otherwise crashes
|
||||
libcall.args = uintptr(unsafe.Pointer(fn)) // it's unused but must be non-nil, otherwise crashes
|
||||
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall))
|
||||
return libcall.r1
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func sysvicall1(fn libcFunc, a1 uintptr) uintptr {
|
||||
func sysvicall1(fn *libcFunc, a1 uintptr) uintptr {
|
||||
libcall := &getg().m.libcall
|
||||
libcall.fn = uintptr(fn)
|
||||
libcall.fn = uintptr(unsafe.Pointer(fn))
|
||||
libcall.n = 1
|
||||
// TODO(rsc): Why is noescape necessary here and below?
|
||||
libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
|
||||
@ -35,9 +35,9 @@ func sysvicall1(fn libcFunc, a1 uintptr) uintptr {
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func sysvicall2(fn libcFunc, a1, a2 uintptr) uintptr {
|
||||
func sysvicall2(fn *libcFunc, a1, a2 uintptr) uintptr {
|
||||
libcall := &getg().m.libcall
|
||||
libcall.fn = uintptr(fn)
|
||||
libcall.fn = uintptr(unsafe.Pointer(fn))
|
||||
libcall.n = 2
|
||||
libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
|
||||
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall))
|
||||
@ -45,9 +45,9 @@ func sysvicall2(fn libcFunc, a1, a2 uintptr) uintptr {
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func sysvicall3(fn libcFunc, a1, a2, a3 uintptr) uintptr {
|
||||
func sysvicall3(fn *libcFunc, a1, a2, a3 uintptr) uintptr {
|
||||
libcall := &getg().m.libcall
|
||||
libcall.fn = uintptr(fn)
|
||||
libcall.fn = uintptr(unsafe.Pointer(fn))
|
||||
libcall.n = 3
|
||||
libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
|
||||
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall))
|
||||
@ -55,9 +55,9 @@ func sysvicall3(fn libcFunc, a1, a2, a3 uintptr) uintptr {
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func sysvicall4(fn libcFunc, a1, a2, a3, a4 uintptr) uintptr {
|
||||
func sysvicall4(fn *libcFunc, a1, a2, a3, a4 uintptr) uintptr {
|
||||
libcall := &getg().m.libcall
|
||||
libcall.fn = uintptr(fn)
|
||||
libcall.fn = uintptr(unsafe.Pointer(fn))
|
||||
libcall.n = 4
|
||||
libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
|
||||
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall))
|
||||
@ -65,9 +65,9 @@ func sysvicall4(fn libcFunc, a1, a2, a3, a4 uintptr) uintptr {
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func sysvicall5(fn libcFunc, a1, a2, a3, a4, a5 uintptr) uintptr {
|
||||
func sysvicall5(fn *libcFunc, a1, a2, a3, a4, a5 uintptr) uintptr {
|
||||
libcall := &getg().m.libcall
|
||||
libcall.fn = uintptr(fn)
|
||||
libcall.fn = uintptr(unsafe.Pointer(fn))
|
||||
libcall.n = 5
|
||||
libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
|
||||
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall))
|
||||
@ -75,9 +75,9 @@ func sysvicall5(fn libcFunc, a1, a2, a3, a4, a5 uintptr) uintptr {
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func sysvicall6(fn libcFunc, a1, a2, a3, a4, a5, a6 uintptr) uintptr {
|
||||
func sysvicall6(fn *libcFunc, a1, a2, a3, a4, a5, a6 uintptr) uintptr {
|
||||
libcall := &getg().m.libcall
|
||||
libcall.fn = uintptr(fn)
|
||||
libcall.fn = uintptr(unsafe.Pointer(fn))
|
||||
libcall.n = 6
|
||||
libcall.args = uintptr(noescape(unsafe.Pointer(&a1)))
|
||||
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall))
|
||||
|
@ -41,7 +41,7 @@ TEXT runtime·nanotime1(SB),NOSPLIT,$0
|
||||
SUBQ $64, SP // 16 bytes will do, but who knows in the future?
|
||||
MOVQ $3, DI // CLOCK_REALTIME from <sys/time_impl.h>
|
||||
MOVQ SP, SI
|
||||
MOVQ libc_clock_gettime(SB), AX
|
||||
LEAQ libc_clock_gettime(SB), AX
|
||||
CALL AX
|
||||
MOVQ (SP), AX // tv_sec from struct timespec
|
||||
IMULQ $1000000000, AX // multiply into nanoseconds
|
||||
@ -54,7 +54,7 @@ TEXT runtime·nanotime1(SB),NOSPLIT,$0
|
||||
TEXT runtime·pipe1(SB),NOSPLIT,$0
|
||||
SUBQ $16, SP // 8 bytes will do, but stack has to be 16-byte alligned
|
||||
MOVQ SP, DI
|
||||
MOVQ libc_pipe(SB), AX
|
||||
LEAQ libc_pipe(SB), AX
|
||||
CALL AX
|
||||
MOVL 0(SP), AX
|
||||
MOVL 4(SP), DX
|
||||
@ -321,13 +321,13 @@ noswitch:
|
||||
|
||||
// Runs on OS stack. duration (in µs units) is in DI.
|
||||
TEXT runtime·usleep2(SB),NOSPLIT,$0
|
||||
MOVQ libc_usleep(SB), AX
|
||||
LEAQ libc_usleep(SB), AX
|
||||
CALL AX
|
||||
RET
|
||||
|
||||
// Runs on OS stack, called from runtime·osyield.
|
||||
TEXT runtime·osyield1(SB),NOSPLIT,$0
|
||||
MOVQ libc_sched_yield(SB), AX
|
||||
LEAQ libc_sched_yield(SB), AX
|
||||
CALL AX
|
||||
RET
|
||||
|
||||
|
@ -60,7 +60,7 @@ func syscall_rawsysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, e
|
||||
//go:nosplit
|
||||
func syscall_chdir(path uintptr) (err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_chdir)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_chdir)),
|
||||
n: 1,
|
||||
args: uintptr(unsafe.Pointer(&path)),
|
||||
}
|
||||
@ -71,7 +71,7 @@ func syscall_chdir(path uintptr) (err uintptr) {
|
||||
//go:nosplit
|
||||
func syscall_chroot(path uintptr) (err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_chroot)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_chroot)),
|
||||
n: 1,
|
||||
args: uintptr(unsafe.Pointer(&path)),
|
||||
}
|
||||
@ -82,12 +82,12 @@ func syscall_chroot(path uintptr) (err uintptr) {
|
||||
// like close, but must not split stack, for forkx.
|
||||
//go:nosplit
|
||||
func syscall_close(fd int32) int32 {
|
||||
return int32(sysvicall1(libc_close, uintptr(fd)))
|
||||
return int32(sysvicall1(&libc_close, uintptr(fd)))
|
||||
}
|
||||
|
||||
func syscall_dlopen(name *byte, mode uintptr) (handle uintptr, err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_dlopen)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_dlopen)),
|
||||
n: 2,
|
||||
args: uintptr(unsafe.Pointer(&name)),
|
||||
}
|
||||
@ -102,7 +102,7 @@ func syscall_dlopen(name *byte, mode uintptr) (handle uintptr, err uintptr) {
|
||||
|
||||
func syscall_dlclose(handle uintptr) (err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_dlclose)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_dlclose)),
|
||||
n: 1,
|
||||
args: uintptr(unsafe.Pointer(&handle)),
|
||||
}
|
||||
@ -114,7 +114,7 @@ func syscall_dlclose(handle uintptr) (err uintptr) {
|
||||
|
||||
func syscall_dlsym(handle uintptr, name *byte) (proc uintptr, err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_dlsym)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_dlsym)),
|
||||
n: 2,
|
||||
args: uintptr(unsafe.Pointer(&handle)),
|
||||
}
|
||||
@ -130,7 +130,7 @@ func syscall_dlsym(handle uintptr, name *byte) (proc uintptr, err uintptr) {
|
||||
//go:nosplit
|
||||
func syscall_execve(path, argv, envp uintptr) (err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_execve)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_execve)),
|
||||
n: 3,
|
||||
args: uintptr(unsafe.Pointer(&path)),
|
||||
}
|
||||
@ -141,13 +141,13 @@ func syscall_execve(path, argv, envp uintptr) (err uintptr) {
|
||||
// like exit, but must not split stack, for forkx.
|
||||
//go:nosplit
|
||||
func syscall_exit(code uintptr) {
|
||||
sysvicall1(libc_exit, code)
|
||||
sysvicall1(&libc_exit, code)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func syscall_fcntl(fd, cmd, arg uintptr) (val, err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_fcntl)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_fcntl)),
|
||||
n: 3,
|
||||
args: uintptr(unsafe.Pointer(&fd)),
|
||||
}
|
||||
@ -158,7 +158,7 @@ func syscall_fcntl(fd, cmd, arg uintptr) (val, err uintptr) {
|
||||
//go:nosplit
|
||||
func syscall_forkx(flags uintptr) (pid uintptr, err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_forkx)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_forkx)),
|
||||
n: 1,
|
||||
args: uintptr(unsafe.Pointer(&flags)),
|
||||
}
|
||||
@ -170,7 +170,7 @@ func syscall_gethostname() (name string, err uintptr) {
|
||||
cname := new([_MAXHOSTNAMELEN]byte)
|
||||
var args = [2]uintptr{uintptr(unsafe.Pointer(&cname[0])), _MAXHOSTNAMELEN}
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_gethostname)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_gethostname)),
|
||||
n: 2,
|
||||
args: uintptr(unsafe.Pointer(&args[0])),
|
||||
}
|
||||
@ -187,9 +187,9 @@ func syscall_gethostname() (name string, err uintptr) {
|
||||
//go:nosplit
|
||||
func syscall_getpid() (pid, err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_getpid)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_getpid)),
|
||||
n: 0,
|
||||
args: uintptr(unsafe.Pointer(libc_getpid)), // it's unused but must be non-nil, otherwise crashes
|
||||
args: uintptr(unsafe.Pointer(&libc_getpid)), // it's unused but must be non-nil, otherwise crashes
|
||||
}
|
||||
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
|
||||
return call.r1, call.err
|
||||
@ -198,7 +198,7 @@ func syscall_getpid() (pid, err uintptr) {
|
||||
//go:nosplit
|
||||
func syscall_ioctl(fd, req, arg uintptr) (err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_ioctl)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_ioctl)),
|
||||
n: 3,
|
||||
args: uintptr(unsafe.Pointer(&fd)),
|
||||
}
|
||||
@ -226,7 +226,7 @@ func syscall_pipe() (r, w, err uintptr) {
|
||||
// TODO(aram): make this panic once we stop calling fcntl(2) in net using it.
|
||||
func syscall_rawsyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_syscall)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_syscall)),
|
||||
n: 4,
|
||||
args: uintptr(unsafe.Pointer(&trap)),
|
||||
}
|
||||
@ -237,7 +237,7 @@ func syscall_rawsyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
|
||||
//go:nosplit
|
||||
func syscall_setgid(gid uintptr) (err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_setgid)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_setgid)),
|
||||
n: 1,
|
||||
args: uintptr(unsafe.Pointer(&gid)),
|
||||
}
|
||||
@ -248,7 +248,7 @@ func syscall_setgid(gid uintptr) (err uintptr) {
|
||||
//go:nosplit
|
||||
func syscall_setgroups(ngid, gid uintptr) (err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_setgroups)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_setgroups)),
|
||||
n: 2,
|
||||
args: uintptr(unsafe.Pointer(&ngid)),
|
||||
}
|
||||
@ -259,9 +259,9 @@ func syscall_setgroups(ngid, gid uintptr) (err uintptr) {
|
||||
//go:nosplit
|
||||
func syscall_setsid() (pid, err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_setsid)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_setsid)),
|
||||
n: 0,
|
||||
args: uintptr(unsafe.Pointer(libc_setsid)), // it's unused but must be non-nil, otherwise crashes
|
||||
args: uintptr(unsafe.Pointer(&libc_setsid)), // it's unused but must be non-nil, otherwise crashes
|
||||
}
|
||||
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
|
||||
return call.r1, call.err
|
||||
@ -270,7 +270,7 @@ func syscall_setsid() (pid, err uintptr) {
|
||||
//go:nosplit
|
||||
func syscall_setuid(uid uintptr) (err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_setuid)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_setuid)),
|
||||
n: 1,
|
||||
args: uintptr(unsafe.Pointer(&uid)),
|
||||
}
|
||||
@ -281,7 +281,7 @@ func syscall_setuid(uid uintptr) (err uintptr) {
|
||||
//go:nosplit
|
||||
func syscall_setpgid(pid, pgid uintptr) (err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_setpgid)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_setpgid)),
|
||||
n: 2,
|
||||
args: uintptr(unsafe.Pointer(&pid)),
|
||||
}
|
||||
@ -297,7 +297,7 @@ func syscall_setpgid(pid, pgid uintptr) (err uintptr) {
|
||||
// TODO(aram): make this panic once we stop calling fcntl(2) in net using it.
|
||||
func syscall_syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_syscall)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_syscall)),
|
||||
n: 4,
|
||||
args: uintptr(unsafe.Pointer(&trap)),
|
||||
}
|
||||
@ -309,7 +309,7 @@ func syscall_syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
|
||||
|
||||
func syscall_wait4(pid uintptr, wstatus *uint32, options uintptr, rusage unsafe.Pointer) (wpid int, err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_wait4)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_wait4)),
|
||||
n: 4,
|
||||
args: uintptr(unsafe.Pointer(&pid)),
|
||||
}
|
||||
@ -322,7 +322,7 @@ func syscall_wait4(pid uintptr, wstatus *uint32, options uintptr, rusage unsafe.
|
||||
//go:nosplit
|
||||
func syscall_write(fd, buf, nbyte uintptr) (n, err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(libc_write)),
|
||||
fn: uintptr(unsafe.Pointer(&libc_write)),
|
||||
n: 3,
|
||||
args: uintptr(unsafe.Pointer(&fd)),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user