diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s index a5943dcbc7..49df28530a 100644 --- a/src/runtime/asm_386.s +++ b/src/runtime/asm_386.s @@ -665,12 +665,6 @@ TEXT gosave<>(SB),NOSPLIT,$0 // Call fn(arg) on the scheduler stack, // aligned appropriately for the gcc ABI. // See cgocall.c for more details. -TEXT ·asmcgocall(SB),NOSPLIT,$0-8 - MOVL fn+0(FP), AX - MOVL arg+4(FP), BX - CALL asmcgocall<>(SB) - RET - TEXT ·asmcgocall_errno(SB),NOSPLIT,$0-12 MOVL fn+0(FP), AX MOVL arg+4(FP), BX diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index d43e660cb4..639ab340fe 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -645,12 +645,6 @@ TEXT gosave<>(SB),NOSPLIT,$0 // Call fn(arg) on the scheduler stack, // aligned appropriately for the gcc ABI. // See cgocall.c for more details. -TEXT ·asmcgocall(SB),NOSPLIT,$0-16 - MOVQ fn+0(FP), AX - MOVQ arg+8(FP), BX - CALL asmcgocall<>(SB) - RET - TEXT ·asmcgocall_errno(SB),NOSPLIT,$0-20 MOVQ fn+0(FP), AX MOVQ arg+8(FP), BX diff --git a/src/runtime/asm_amd64p32.s b/src/runtime/asm_amd64p32.s index 393e1b203f..fd640ab3e9 100644 --- a/src/runtime/asm_amd64p32.s +++ b/src/runtime/asm_amd64p32.s @@ -582,12 +582,6 @@ TEXT runtime·jmpdefer(SB), NOSPLIT, $0-8 MOVL 0(DX), BX JMP BX // but first run the deferred function -// asmcgocall(void(*fn)(void*), void *arg) -// Not implemented. -TEXT runtime·asmcgocall(SB),NOSPLIT,$0-8 - MOVL 0, AX - RET - // asmcgocall(void(*fn)(void*), void *arg) // Not implemented. TEXT runtime·asmcgocall_errno(SB),NOSPLIT,$0-12 diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s index a765b0c6b9..1797fea493 100644 --- a/src/runtime/asm_arm.s +++ b/src/runtime/asm_arm.s @@ -478,12 +478,6 @@ TEXT gosave<>(SB),NOSPLIT,$0 // Call fn(arg) on the scheduler stack, // aligned appropriately for the gcc ABI. // See cgocall.c for more details. -TEXT ·asmcgocall(SB),NOSPLIT,$0-8 - MOVW fn+0(FP), R1 - MOVW arg+4(FP), R0 - BL asmcgocall<>(SB) - RET - TEXT ·asmcgocall_errno(SB),NOSPLIT,$0-12 MOVW fn+0(FP), R1 MOVW arg+4(FP), R0 diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s index 2321c3855f..ed70eca771 100644 --- a/src/runtime/asm_arm64.s +++ b/src/runtime/asm_arm64.s @@ -549,12 +549,6 @@ TEXT gosave<>(SB),NOSPLIT,$-8 // Call fn(arg) on the scheduler stack, // aligned appropriately for the gcc ABI. // See cgocall.go for more details. -TEXT ·asmcgocall(SB),NOSPLIT,$0-16 - MOVD fn+0(FP), R1 - MOVD arg+8(FP), R0 - BL asmcgocall<>(SB) - RET - TEXT ·asmcgocall_errno(SB),NOSPLIT,$0-20 MOVD fn+0(FP), R1 MOVD arg+8(FP), R0 diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s index 6e3aa3c9d2..f90016c4b6 100644 --- a/src/runtime/asm_ppc64x.s +++ b/src/runtime/asm_ppc64x.s @@ -698,12 +698,6 @@ TEXT gosave<>(SB),NOSPLIT,$-8 // Call fn(arg) on the scheduler stack, // aligned appropriately for the gcc ABI. // See cgocall.c for more details. -TEXT ·asmcgocall(SB),NOSPLIT,$0-16 - MOVD fn+0(FP), R3 - MOVD arg+8(FP), R4 - BL asmcgocall<>(SB) - RET - TEXT ·asmcgocall_errno(SB),NOSPLIT,$0-20 MOVD fn+0(FP), R3 MOVD arg+8(FP), R4 diff --git a/src/runtime/cgocall.go b/src/runtime/cgocall.go index c01d616ca7..8f0b83c55e 100644 --- a/src/runtime/cgocall.go +++ b/src/runtime/cgocall.go @@ -82,11 +82,6 @@ package runtime import "unsafe" // Call from Go to C. -//go:nosplit -func cgocall(fn, arg unsafe.Pointer) { - cgocall_errno(fn, arg) -} - //go:nosplit func cgocall_errno(fn, arg unsafe.Pointer) int32 { if !iscgo && GOOS != "solaris" && GOOS != "windows" { @@ -148,7 +143,7 @@ func cmalloc(n uintptr) unsafe.Pointer { ret unsafe.Pointer } args.n = uint64(n) - cgocall(_cgo_malloc, unsafe.Pointer(&args)) + cgocall_errno(_cgo_malloc, unsafe.Pointer(&args)) if args.ret == nil { throw("C malloc failed") } @@ -156,7 +151,7 @@ func cmalloc(n uintptr) unsafe.Pointer { } func cfree(p unsafe.Pointer) { - cgocall(_cgo_free, p) + cgocall_errno(_cgo_free, p) } // Call from C back to Go. diff --git a/src/runtime/env_posix.go b/src/runtime/env_posix.go index 5e49287421..e648442677 100644 --- a/src/runtime/env_posix.go +++ b/src/runtime/env_posix.go @@ -32,7 +32,7 @@ func syscall_setenv_c(k string, v string) { return } arg := [2]unsafe.Pointer{cstring(k), cstring(v)} - asmcgocall(unsafe.Pointer(_cgo_setenv), unsafe.Pointer(&arg)) + asmcgocall_errno(unsafe.Pointer(_cgo_setenv), unsafe.Pointer(&arg)) } // Update the C environment if cgo is loaded. @@ -43,7 +43,7 @@ func syscall_unsetenv_c(k string) { return } arg := [1]unsafe.Pointer{cstring(k)} - asmcgocall(unsafe.Pointer(_cgo_unsetenv), unsafe.Pointer(&arg)) + asmcgocall_errno(unsafe.Pointer(_cgo_unsetenv), unsafe.Pointer(&arg)) } func cstring(s string) unsafe.Pointer { diff --git a/src/runtime/os1_windows.go b/src/runtime/os1_windows.go index bc472d0de9..9565366453 100644 --- a/src/runtime/os1_windows.go +++ b/src/runtime/os1_windows.go @@ -372,7 +372,7 @@ func stdcall(fn stdFunction) uintptr { // all three values to be non-zero, it will use them mp.libcallsp = getcallersp(unsafe.Pointer(&fn)) } - asmcgocall(asmstdcallAddr, unsafe.Pointer(&mp.libcall)) + asmcgocall_errno(asmstdcallAddr, unsafe.Pointer(&mp.libcall)) mp.libcallsp = 0 return mp.libcall.r1 } diff --git a/src/runtime/os3_solaris.go b/src/runtime/os3_solaris.go index 53d7b96b0f..cf576da477 100644 --- a/src/runtime/os3_solaris.go +++ b/src/runtime/os3_solaris.go @@ -201,7 +201,7 @@ func msigsave(mp *m) { // Called on the new thread, can not allocate memory. func minit() { _g_ := getg() - asmcgocall(unsafe.Pointer(funcPC(miniterrno)), unsafe.Pointer(&libc____errno)) + asmcgocall_errno(unsafe.Pointer(funcPC(miniterrno)), unsafe.Pointer(&libc____errno)) // Initialize signal handling signalstack(&_g_.m.gsignal.stack) @@ -317,7 +317,7 @@ func semacreate() uintptr { memclr(unsafe.Pointer(&_g_.m.scratch), uintptr(len(_g_.m.scratch.v))) _g_.m.scratch.v[0] = unsafe.Sizeof(*sem) _g_.m.libcall.args = uintptr(unsafe.Pointer(&_g_.m.scratch)) - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&_g_.m.libcall)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&_g_.m.libcall)) sem = (*semt)(unsafe.Pointer(_g_.m.libcall.r1)) if sem_init(sem, 0, 0) != 0 { throw("sem_init") @@ -338,7 +338,7 @@ func semasleep(ns int64) int32 { _m_.scratch.v[0] = _m_.waitsema _m_.scratch.v[1] = uintptr(unsafe.Pointer(&_m_.ts)) _m_.libcall.args = uintptr(unsafe.Pointer(&_m_.scratch)) - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&_m_.libcall)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&_m_.libcall)) if *_m_.perrno != 0 { if *_m_.perrno == _ETIMEDOUT || *_m_.perrno == _EAGAIN || *_m_.perrno == _EINTR { return -1 @@ -353,7 +353,7 @@ func semasleep(ns int64) int32 { memclr(unsafe.Pointer(&_m_.scratch), uintptr(len(_m_.scratch.v))) _m_.scratch.v[0] = _m_.waitsema _m_.libcall.args = uintptr(unsafe.Pointer(&_m_.scratch)) - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&_m_.libcall)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&_m_.libcall)) if _m_.libcall.r1 == 0 { break } diff --git a/src/runtime/os_solaris.go b/src/runtime/os_solaris.go index fd20a5cd11..c6c02ff5d8 100644 --- a/src/runtime/os_solaris.go +++ b/src/runtime/os_solaris.go @@ -19,7 +19,7 @@ func sysvicall0(fn *libcFunc) uintptr { libcall.fn = uintptr(unsafe.Pointer(fn)) libcall.n = 0 libcall.args = uintptr(unsafe.Pointer(fn)) // it's unused but must be non-nil, otherwise crashes - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall)) return libcall.r1 } @@ -30,7 +30,7 @@ func sysvicall1(fn *libcFunc, a1 uintptr) uintptr { libcall.n = 1 // TODO(rsc): Why is noescape necessary here and below? libcall.args = uintptr(noescape(unsafe.Pointer(&a1))) - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall)) return libcall.r1 } @@ -40,7 +40,7 @@ func sysvicall2(fn *libcFunc, a1, a2 uintptr) uintptr { libcall.fn = uintptr(unsafe.Pointer(fn)) libcall.n = 2 libcall.args = uintptr(noescape(unsafe.Pointer(&a1))) - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall)) return libcall.r1 } @@ -50,7 +50,7 @@ func sysvicall3(fn *libcFunc, a1, a2, a3 uintptr) uintptr { libcall.fn = uintptr(unsafe.Pointer(fn)) libcall.n = 3 libcall.args = uintptr(noescape(unsafe.Pointer(&a1))) - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall)) return libcall.r1 } @@ -60,7 +60,7 @@ func sysvicall4(fn *libcFunc, a1, a2, a3, a4 uintptr) uintptr { libcall.fn = uintptr(unsafe.Pointer(fn)) libcall.n = 4 libcall.args = uintptr(noescape(unsafe.Pointer(&a1))) - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall)) return libcall.r1 } @@ -70,7 +70,7 @@ func sysvicall5(fn *libcFunc, a1, a2, a3, a4, a5 uintptr) uintptr { libcall.fn = uintptr(unsafe.Pointer(fn)) libcall.n = 5 libcall.args = uintptr(noescape(unsafe.Pointer(&a1))) - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall)) return libcall.r1 } @@ -80,6 +80,6 @@ func sysvicall6(fn *libcFunc, a1, a2, a3, a4, a5, a6 uintptr) uintptr { libcall.fn = uintptr(unsafe.Pointer(fn)) libcall.n = 6 libcall.args = uintptr(noescape(unsafe.Pointer(&a1))) - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(libcall)) return libcall.r1 } diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 805b96e627..06f301fa27 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -94,7 +94,7 @@ func main() { if _cgo_notify_runtime_init_done == nil { throw("_cgo_notify_runtime_init_done missing") } - cgocall(_cgo_notify_runtime_init_done, nil) + cgocall_errno(_cgo_notify_runtime_init_done, nil) } main_init() diff --git a/src/runtime/proc1.go b/src/runtime/proc1.go index fa6c2e11d5..e6e11ea697 100644 --- a/src/runtime/proc1.go +++ b/src/runtime/proc1.go @@ -1093,7 +1093,7 @@ func newm(fn func(), _p_ *p) { ts.g.set(mp.g0) ts.tls = (*uint64)(unsafe.Pointer(&mp.tls[0])) ts.fn = unsafe.Pointer(funcPC(mstart)) - asmcgocall(_cgo_thread_start, unsafe.Pointer(&ts)) + asmcgocall_errno(_cgo_thread_start, unsafe.Pointer(&ts)) return } newosproc(mp, unsafe.Pointer(mp.g0.stack.hi)) diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go index aa84951eb4..b167f163af 100644 --- a/src/runtime/stubs.go +++ b/src/runtime/stubs.go @@ -204,9 +204,6 @@ func getcallerpc(argp unsafe.Pointer) uintptr //go:noescape func getcallersp(argp unsafe.Pointer) uintptr -//go:noescape -func asmcgocall(fn, arg unsafe.Pointer) - //go:noescape func asmcgocall_errno(fn, arg unsafe.Pointer) int32 diff --git a/src/runtime/syscall_solaris.go b/src/runtime/syscall_solaris.go index ae1f334365..e69745c94a 100644 --- a/src/runtime/syscall_solaris.go +++ b/src/runtime/syscall_solaris.go @@ -34,7 +34,7 @@ func syscall_sysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err args: uintptr(unsafe.Pointer(&a1)), } entersyscallblock(0) - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) exitsyscall(0) return call.r1, call.r2, call.err } @@ -46,7 +46,7 @@ func syscall_rawsysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, e n: nargs, args: uintptr(unsafe.Pointer(&a1)), } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.r1, call.r2, call.err } @@ -61,7 +61,7 @@ func syscall_chdir(path uintptr) (err uintptr) { n: 1, args: uintptr(unsafe.Pointer(&path)), } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.err } @@ -72,7 +72,7 @@ func syscall_chroot(path uintptr) (err uintptr) { n: 1, args: uintptr(unsafe.Pointer(&path)), } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.err } @@ -89,7 +89,7 @@ func syscall_execve(path, argv, envp uintptr) (err uintptr) { n: 3, args: uintptr(unsafe.Pointer(&path)), } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.err } @@ -106,7 +106,7 @@ func syscall_fcntl(fd, cmd, arg uintptr) (val, err uintptr) { n: 3, args: uintptr(unsafe.Pointer(&fd)), } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.r1, call.err } @@ -117,7 +117,7 @@ func syscall_forkx(flags uintptr) (pid uintptr, err uintptr) { n: 1, args: uintptr(unsafe.Pointer(&flags)), } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.r1, call.err } @@ -130,7 +130,7 @@ func syscall_gethostname() (name string, err uintptr) { args: uintptr(unsafe.Pointer(&args[0])), } entersyscallblock(0) - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) exitsyscall(0) if call.r1 != 0 { return "", call.err @@ -146,7 +146,7 @@ func syscall_getpid() (pid, err uintptr) { n: 0, args: uintptr(unsafe.Pointer(&libc_getpid)), // it's unused but must be non-nil, otherwise crashes } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.r1, call.err } @@ -157,7 +157,7 @@ func syscall_ioctl(fd, req, arg uintptr) (err uintptr) { n: 3, args: uintptr(unsafe.Pointer(&fd)), } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.err } @@ -168,7 +168,7 @@ func syscall_pipe() (r, w, err uintptr) { args: uintptr(unsafe.Pointer(&pipe1)), // it's unused but must be non-nil, otherwise crashes } entersyscallblock(0) - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) exitsyscall(0) return call.r1, call.r2, call.err } @@ -185,7 +185,7 @@ func syscall_rawsyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) { n: 4, args: uintptr(unsafe.Pointer(&trap)), } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.r1, call.r2, call.err } @@ -196,7 +196,7 @@ func syscall_setgid(gid uintptr) (err uintptr) { n: 1, args: uintptr(unsafe.Pointer(&gid)), } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.err } @@ -207,7 +207,7 @@ func syscall_setgroups(ngid, gid uintptr) (err uintptr) { n: 2, args: uintptr(unsafe.Pointer(&ngid)), } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.err } @@ -218,7 +218,7 @@ func syscall_setsid() (pid, err uintptr) { n: 0, args: uintptr(unsafe.Pointer(&libc_setsid)), // it's unused but must be non-nil, otherwise crashes } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.r1, call.err } @@ -229,7 +229,7 @@ func syscall_setuid(uid uintptr) (err uintptr) { n: 1, args: uintptr(unsafe.Pointer(&uid)), } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.err } @@ -240,7 +240,7 @@ func syscall_setpgid(pid, pgid uintptr) (err uintptr) { n: 2, args: uintptr(unsafe.Pointer(&pid)), } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.err } @@ -257,7 +257,7 @@ func syscall_syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) { args: uintptr(unsafe.Pointer(&trap)), } entersyscallblock(0) - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) exitsyscall(0) return call.r1, call.r2, call.err } @@ -269,7 +269,7 @@ func syscall_wait4(pid uintptr, wstatus *uint32, options uintptr, rusage unsafe. args: uintptr(unsafe.Pointer(&pid)), } entersyscallblock(0) - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) exitsyscall(0) return int(call.r1), call.err } @@ -281,6 +281,6 @@ func syscall_write(fd, buf, nbyte uintptr) (n, err uintptr) { n: 3, args: uintptr(unsafe.Pointer(&fd)), } - asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) + asmcgocall_errno(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call)) return call.r1, call.err }