1
0
mirror of https://github.com/golang/go synced 2024-11-23 16:10:05 -07:00

runtime: use explicit NOFRAME on darwin/amd64

This CL marks some darwin assembly functions as NOFRAME to avoid relying
on the implicit amd64 NOFRAME heuristic, where NOSPLIT functions
without stack were also marked as NOFRAME.

Change-Id: I797f3909bcf7f7aad304e4ede820c884231e54f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/460235
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
qmuntal 2023-01-02 15:54:44 +01:00 committed by Quim Muntal
parent 89de906aa2
commit cea70301e2
2 changed files with 15 additions and 160 deletions

View File

@ -614,14 +614,14 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
var bpsize int var bpsize int
if ctxt.Arch.Family == sys.AMD64 && if ctxt.Arch.Family == sys.AMD64 &&
!p.From.Sym.NoFrame() && // (1) below !p.From.Sym.NoFrame() && // (1) below
!(autoffset == 0 && p.From.Sym.NoSplit() && ctxt.Headtype != objabi.Hwindows) && // (2) below !(autoffset == 0 && p.From.Sym.NoSplit() && ctxt.Headtype != objabi.Hwindows && ctxt.Headtype != objabi.Hdarwin) && // (2) below
!(autoffset == 0 && !hasCall) { // (3) below !(autoffset == 0 && !hasCall) { // (3) below
// Make room to save a base pointer. // Make room to save a base pointer.
// There are 2 cases we must avoid: // There are 2 cases we must avoid:
// 1) If noframe is set (which we do for functions which tail call). // 1) If noframe is set (which we do for functions which tail call).
// 2) Scary runtime internals which would be all messed up by frame pointers. // 2) Scary runtime internals which would be all messed up by frame pointers.
// We detect these using a heuristic: frameless nosplit functions. // We detect these using a heuristic: frameless nosplit functions.
// Windows does not use this heuristic anymore. // Windows and Darwin do not use this heuristic anymore.
// TODO: Maybe someday we label them all with NOFRAME and get rid of this heuristic. // TODO: Maybe someday we label them all with NOFRAME and get rid of this heuristic.
// For performance, we also want to avoid: // For performance, we also want to avoid:
// 3) Frameless leaf functions // 3) Frameless leaf functions

View File

@ -15,36 +15,25 @@
// Exit the entire program (like C exit) // Exit the entire program (like C exit)
TEXT runtime·exit_trampoline(SB),NOSPLIT,$0 TEXT runtime·exit_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 0(DI), DI // arg 1 exit status MOVL 0(DI), DI // arg 1 exit status
CALL libc_exit(SB) CALL libc_exit(SB)
MOVL $0xf1, 0xf1 // crash MOVL $0xf1, 0xf1 // crash
POPQ BP
RET RET
TEXT runtime·open_trampoline(SB),NOSPLIT,$0 TEXT runtime·open_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 8(DI), SI // arg 2 flags MOVL 8(DI), SI // arg 2 flags
MOVL 12(DI), DX // arg 3 mode MOVL 12(DI), DX // arg 3 mode
MOVQ 0(DI), DI // arg 1 pathname MOVQ 0(DI), DI // arg 1 pathname
XORL AX, AX // vararg: say "no float args" XORL AX, AX // vararg: say "no float args"
CALL libc_open(SB) CALL libc_open(SB)
POPQ BP
RET RET
TEXT runtime·close_trampoline(SB),NOSPLIT,$0 TEXT runtime·close_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 0(DI), DI // arg 1 fd MOVL 0(DI), DI // arg 1 fd
CALL libc_close(SB) CALL libc_close(SB)
POPQ BP
RET RET
TEXT runtime·read_trampoline(SB),NOSPLIT,$0 TEXT runtime·read_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 buf MOVQ 8(DI), SI // arg 2 buf
MOVL 16(DI), DX // arg 3 count MOVL 16(DI), DX // arg 3 count
MOVL 0(DI), DI // arg 1 fd MOVL 0(DI), DI // arg 1 fd
@ -55,12 +44,9 @@ TEXT runtime·read_trampoline(SB),NOSPLIT,$0
MOVL (AX), AX MOVL (AX), AX
NEGL AX // caller expects negative errno value NEGL AX // caller expects negative errno value
noerr: noerr:
POPQ BP
RET RET
TEXT runtime·write_trampoline(SB),NOSPLIT,$0 TEXT runtime·write_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 buf MOVQ 8(DI), SI // arg 2 buf
MOVL 16(DI), DX // arg 3 count MOVL 16(DI), DX // arg 3 count
MOVQ 0(DI), DI // arg 1 fd MOVQ 0(DI), DI // arg 1 fd
@ -71,39 +57,29 @@ TEXT runtime·write_trampoline(SB),NOSPLIT,$0
MOVL (AX), AX MOVL (AX), AX
NEGL AX // caller expects negative errno value NEGL AX // caller expects negative errno value
noerr: noerr:
POPQ BP
RET RET
TEXT runtime·pipe_trampoline(SB),NOSPLIT,$0 TEXT runtime·pipe_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
CALL libc_pipe(SB) // pointer already in DI CALL libc_pipe(SB) // pointer already in DI
TESTL AX, AX TESTL AX, AX
JEQ 3(PC) JEQ 3(PC)
CALL libc_error(SB) // return negative errno value CALL libc_error(SB) // return negative errno value
NEGL AX NEGL AX
POPQ BP
RET RET
TEXT runtime·setitimer_trampoline(SB),NOSPLIT,$0 TEXT runtime·setitimer_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 new MOVQ 8(DI), SI // arg 2 new
MOVQ 16(DI), DX // arg 3 old MOVQ 16(DI), DX // arg 3 old
MOVL 0(DI), DI // arg 1 which MOVL 0(DI), DI // arg 1 which
CALL libc_setitimer(SB) CALL libc_setitimer(SB)
POPQ BP
RET RET
TEXT runtime·madvise_trampoline(SB), NOSPLIT, $0 TEXT runtime·madvise_trampoline(SB), NOSPLIT, $0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 len MOVQ 8(DI), SI // arg 2 len
MOVL 16(DI), DX // arg 3 advice MOVL 16(DI), DX // arg 3 advice
MOVQ 0(DI), DI // arg 1 addr MOVQ 0(DI), DI // arg 1 addr
CALL libc_madvise(SB) CALL libc_madvise(SB)
// ignore failure - maybe pages are locked // ignore failure - maybe pages are locked
POPQ BP
RET RET
TEXT runtime·mlock_trampoline(SB), NOSPLIT, $0 TEXT runtime·mlock_trampoline(SB), NOSPLIT, $0
@ -112,8 +88,6 @@ TEXT runtime·mlock_trampoline(SB), NOSPLIT, $0
GLOBL timebase<>(SB),NOPTR,$(machTimebaseInfo__size) GLOBL timebase<>(SB),NOPTR,$(machTimebaseInfo__size)
TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$0 TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ DI, BX MOVQ DI, BX
CALL libc_mach_absolute_time(SB) CALL libc_mach_absolute_time(SB)
MOVQ AX, 0(BX) MOVQ AX, 0(BX)
@ -137,21 +111,15 @@ initialized:
MOVL SI, 8(BX) MOVL SI, 8(BX)
MOVL DI, 12(BX) MOVL DI, 12(BX)
MOVQ BP, SP MOVQ BP, SP
POPQ BP
RET RET
TEXT runtime·walltime_trampoline(SB),NOSPLIT,$0 TEXT runtime·walltime_trampoline(SB),NOSPLIT,$0
PUSHQ BP // make a frame; keep stack aligned
MOVQ SP, BP
MOVQ DI, SI // arg 2 timespec MOVQ DI, SI // arg 2 timespec
MOVL $CLOCK_REALTIME, DI // arg 1 clock_id MOVL $CLOCK_REALTIME, DI // arg 1 clock_id
CALL libc_clock_gettime(SB) CALL libc_clock_gettime(SB)
POPQ BP
RET RET
TEXT runtime·sigaction_trampoline(SB),NOSPLIT,$0 TEXT runtime·sigaction_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 new MOVQ 8(DI), SI // arg 2 new
MOVQ 16(DI), DX // arg 3 old MOVQ 16(DI), DX // arg 3 old
MOVL 0(DI), DI // arg 1 sig MOVL 0(DI), DI // arg 1 sig
@ -159,12 +127,9 @@ TEXT runtime·sigaction_trampoline(SB),NOSPLIT,$0
TESTL AX, AX TESTL AX, AX
JEQ 2(PC) JEQ 2(PC)
MOVL $0xf1, 0xf1 // crash MOVL $0xf1, 0xf1 // crash
POPQ BP
RET RET
TEXT runtime·sigprocmask_trampoline(SB),NOSPLIT,$0 TEXT runtime·sigprocmask_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 new MOVQ 8(DI), SI // arg 2 new
MOVQ 16(DI), DX // arg 3 old MOVQ 16(DI), DX // arg 3 old
MOVL 0(DI), DI // arg 1 how MOVL 0(DI), DI // arg 1 how
@ -172,33 +137,26 @@ TEXT runtime·sigprocmask_trampoline(SB),NOSPLIT,$0
TESTL AX, AX TESTL AX, AX
JEQ 2(PC) JEQ 2(PC)
MOVL $0xf1, 0xf1 // crash MOVL $0xf1, 0xf1 // crash
POPQ BP
RET RET
TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$0 TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 old MOVQ 8(DI), SI // arg 2 old
MOVQ 0(DI), DI // arg 1 new MOVQ 0(DI), DI // arg 1 new
CALL libc_sigaltstack(SB) CALL libc_sigaltstack(SB)
TESTQ AX, AX TESTQ AX, AX
JEQ 2(PC) JEQ 2(PC)
MOVL $0xf1, 0xf1 // crash MOVL $0xf1, 0xf1 // crash
POPQ BP
RET RET
TEXT runtime·raiseproc_trampoline(SB),NOSPLIT,$0 TEXT runtime·raiseproc_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 0(DI), BX // signal MOVL 0(DI), BX // signal
CALL libc_getpid(SB) CALL libc_getpid(SB)
MOVL AX, DI // arg 1 pid MOVL AX, DI // arg 1 pid
MOVL BX, SI // arg 2 signal MOVL BX, SI // arg 2 signal
CALL libc_kill(SB) CALL libc_kill(SB)
POPQ BP
RET RET
TEXT runtime·sigfwd(SB),NOSPLIT,$0-32 TEXT runtime·sigfwd(SB),NOSPLIT|NOFRAME,$0-32
MOVQ fn+0(FP), AX MOVQ fn+0(FP), AX
MOVL sig+8(FP), DI MOVL sig+8(FP), DI
MOVQ info+16(FP), SI MOVQ info+16(FP), SI
@ -214,7 +172,7 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
// This is the function registered during sigaction and is invoked when // This is the function registered during sigaction and is invoked when
// a signal is received. It just redirects to the Go function sigtrampgo. // a signal is received. It just redirects to the Go function sigtrampgo.
// Called using C ABI. // Called using C ABI.
TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$0 TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME|NOFRAME,$0
// Transition from C ABI to Go ABI. // Transition from C ABI to Go ABI.
PUSH_REGS_HOST_TO_ABI0() PUSH_REGS_HOST_TO_ABI0()
@ -239,7 +197,7 @@ TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$0
RET RET
// Called using C ABI. // Called using C ABI.
TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT,$0 TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT|NOFRAME,$0
// Transition from C ABI to Go ABI. // Transition from C ABI to Go ABI.
PUSH_REGS_HOST_TO_ABI0() PUSH_REGS_HOST_TO_ABI0()
@ -257,7 +215,7 @@ TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT,$0
// Used instead of sigtramp in programs that use cgo. // Used instead of sigtramp in programs that use cgo.
// Arguments from kernel are in DI, SI, DX. // Arguments from kernel are in DI, SI, DX.
TEXT runtime·cgoSigtramp(SB),NOSPLIT,$0 TEXT runtime·cgoSigtramp(SB),NOSPLIT|NOFRAME,$0
// If no traceback function, do usual sigtramp. // If no traceback function, do usual sigtramp.
MOVQ runtime·cgoTraceback(SB), AX MOVQ runtime·cgoTraceback(SB), AX
TESTQ AX, AX TESTQ AX, AX
@ -332,8 +290,6 @@ sigtrampnog:
JMP AX JMP AX
TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0 TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0
PUSHQ BP // make a frame; keep stack aligned
MOVQ SP, BP
MOVQ DI, BX MOVQ DI, BX
MOVQ 0(BX), DI // arg 1 addr MOVQ 0(BX), DI // arg 1 addr
MOVQ 8(BX), SI // arg 2 len MOVQ 8(BX), SI // arg 2 len
@ -351,27 +307,20 @@ TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0
ok: ok:
MOVQ AX, 32(BX) MOVQ AX, 32(BX)
MOVQ DX, 40(BX) MOVQ DX, 40(BX)
POPQ BP
RET RET
TEXT runtime·munmap_trampoline(SB),NOSPLIT,$0 TEXT runtime·munmap_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 len MOVQ 8(DI), SI // arg 2 len
MOVQ 0(DI), DI // arg 1 addr MOVQ 0(DI), DI // arg 1 addr
CALL libc_munmap(SB) CALL libc_munmap(SB)
TESTQ AX, AX TESTQ AX, AX
JEQ 2(PC) JEQ 2(PC)
MOVL $0xf1, 0xf1 // crash MOVL $0xf1, 0xf1 // crash
POPQ BP
RET RET
TEXT runtime·usleep_trampoline(SB),NOSPLIT,$0 TEXT runtime·usleep_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 0(DI), DI // arg 1 usec MOVL 0(DI), DI // arg 1 usec
CALL libc_usleep(SB) CALL libc_usleep(SB)
POPQ BP
RET RET
TEXT runtime·settls(SB),NOSPLIT,$32 TEXT runtime·settls(SB),NOSPLIT,$32
@ -379,8 +328,6 @@ TEXT runtime·settls(SB),NOSPLIT,$32
RET RET
TEXT runtime·sysctl_trampoline(SB),NOSPLIT,$0 TEXT runtime·sysctl_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 8(DI), SI // arg 2 miblen MOVL 8(DI), SI // arg 2 miblen
MOVQ 16(DI), DX // arg 3 oldp MOVQ 16(DI), DX // arg 3 oldp
MOVQ 24(DI), CX // arg 4 oldlenp MOVQ 24(DI), CX // arg 4 oldlenp
@ -388,31 +335,22 @@ TEXT runtime·sysctl_trampoline(SB),NOSPLIT,$0
MOVQ 40(DI), R9 // arg 6 newlen MOVQ 40(DI), R9 // arg 6 newlen
MOVQ 0(DI), DI // arg 1 mib MOVQ 0(DI), DI // arg 1 mib
CALL libc_sysctl(SB) CALL libc_sysctl(SB)
POPQ BP
RET RET
TEXT runtime·sysctlbyname_trampoline(SB),NOSPLIT,$0 TEXT runtime·sysctlbyname_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 oldp MOVQ 8(DI), SI // arg 2 oldp
MOVQ 16(DI), DX // arg 3 oldlenp MOVQ 16(DI), DX // arg 3 oldlenp
MOVQ 24(DI), CX // arg 4 newp MOVQ 24(DI), CX // arg 4 newp
MOVQ 32(DI), R8 // arg 5 newlen MOVQ 32(DI), R8 // arg 5 newlen
MOVQ 0(DI), DI // arg 1 name MOVQ 0(DI), DI // arg 1 name
CALL libc_sysctlbyname(SB) CALL libc_sysctlbyname(SB)
POPQ BP
RET RET
TEXT runtime·kqueue_trampoline(SB),NOSPLIT,$0 TEXT runtime·kqueue_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
CALL libc_kqueue(SB) CALL libc_kqueue(SB)
POPQ BP
RET RET
TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0 TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 keventt MOVQ 8(DI), SI // arg 2 keventt
MOVL 16(DI), DX // arg 3 nch MOVL 16(DI), DX // arg 3 nch
MOVQ 24(DI), CX // arg 4 ev MOVQ 24(DI), CX // arg 4 ev
@ -426,24 +364,20 @@ TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0
MOVLQSX (AX), AX // errno MOVLQSX (AX), AX // errno
NEGQ AX // caller wants it as a negative error code NEGQ AX // caller wants it as a negative error code
ok: ok:
POPQ BP
RET RET
TEXT runtime·fcntl_trampoline(SB),NOSPLIT,$0 TEXT runtime·fcntl_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 4(DI), SI // arg 2 cmd MOVL 4(DI), SI // arg 2 cmd
MOVL 8(DI), DX // arg 3 arg MOVL 8(DI), DX // arg 3 arg
MOVL 0(DI), DI // arg 1 fd MOVL 0(DI), DI // arg 1 fd
XORL AX, AX // vararg: say "no float args" XORL AX, AX // vararg: say "no float args"
CALL libc_fcntl(SB) CALL libc_fcntl(SB)
POPQ BP
RET RET
// mstart_stub is the first function executed on a new thread started by pthread_create. // mstart_stub is the first function executed on a new thread started by pthread_create.
// It just does some low-level setup and then calls mstart. // It just does some low-level setup and then calls mstart.
// Note: called with the C calling convention. // Note: called with the C calling convention.
TEXT runtime·mstart_stub(SB),NOSPLIT,$0 TEXT runtime·mstart_stub(SB),NOSPLIT|NOFRAME,$0
// DI points to the m. // DI points to the m.
// We are already on m's g0 stack. // We are already on m's g0 stack.
@ -472,129 +406,85 @@ TEXT runtime·mstart_stub(SB),NOSPLIT,$0
// A single int32 result is returned in AX. // A single int32 result is returned in AX.
// (For more results, make an args/results structure.) // (For more results, make an args/results structure.)
TEXT runtime·pthread_attr_init_trampoline(SB),NOSPLIT,$0 TEXT runtime·pthread_attr_init_trampoline(SB),NOSPLIT,$0
PUSHQ BP // make frame, keep stack 16-byte aligned.
MOVQ SP, BP
MOVQ 0(DI), DI // arg 1 attr MOVQ 0(DI), DI // arg 1 attr
CALL libc_pthread_attr_init(SB) CALL libc_pthread_attr_init(SB)
POPQ BP
RET RET
TEXT runtime·pthread_attr_getstacksize_trampoline(SB),NOSPLIT,$0 TEXT runtime·pthread_attr_getstacksize_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 size MOVQ 8(DI), SI // arg 2 size
MOVQ 0(DI), DI // arg 1 attr MOVQ 0(DI), DI // arg 1 attr
CALL libc_pthread_attr_getstacksize(SB) CALL libc_pthread_attr_getstacksize(SB)
POPQ BP
RET RET
TEXT runtime·pthread_attr_setdetachstate_trampoline(SB),NOSPLIT,$0 TEXT runtime·pthread_attr_setdetachstate_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 state MOVQ 8(DI), SI // arg 2 state
MOVQ 0(DI), DI // arg 1 attr MOVQ 0(DI), DI // arg 1 attr
CALL libc_pthread_attr_setdetachstate(SB) CALL libc_pthread_attr_setdetachstate(SB)
POPQ BP
RET RET
TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0 TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$16
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
MOVQ 0(DI), SI // arg 2 attr MOVQ 0(DI), SI // arg 2 attr
MOVQ 8(DI), DX // arg 3 start MOVQ 8(DI), DX // arg 3 start
MOVQ 16(DI), CX // arg 4 arg MOVQ 16(DI), CX // arg 4 arg
MOVQ SP, DI // arg 1 &threadid (which we throw away) MOVQ SP, DI // arg 1 &threadid (which we throw away)
CALL libc_pthread_create(SB) CALL libc_pthread_create(SB)
MOVQ BP, SP
POPQ BP
RET RET
TEXT runtime·raise_trampoline(SB),NOSPLIT,$0 TEXT runtime·raise_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 0(DI), DI // arg 1 signal MOVL 0(DI), DI // arg 1 signal
CALL libc_raise(SB) CALL libc_raise(SB)
POPQ BP
RET RET
TEXT runtime·pthread_mutex_init_trampoline(SB),NOSPLIT,$0 TEXT runtime·pthread_mutex_init_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 attr MOVQ 8(DI), SI // arg 2 attr
MOVQ 0(DI), DI // arg 1 mutex MOVQ 0(DI), DI // arg 1 mutex
CALL libc_pthread_mutex_init(SB) CALL libc_pthread_mutex_init(SB)
POPQ BP
RET RET
TEXT runtime·pthread_mutex_lock_trampoline(SB),NOSPLIT,$0 TEXT runtime·pthread_mutex_lock_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 0(DI), DI // arg 1 mutex MOVQ 0(DI), DI // arg 1 mutex
CALL libc_pthread_mutex_lock(SB) CALL libc_pthread_mutex_lock(SB)
POPQ BP
RET RET
TEXT runtime·pthread_mutex_unlock_trampoline(SB),NOSPLIT,$0 TEXT runtime·pthread_mutex_unlock_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 0(DI), DI // arg 1 mutex MOVQ 0(DI), DI // arg 1 mutex
CALL libc_pthread_mutex_unlock(SB) CALL libc_pthread_mutex_unlock(SB)
POPQ BP
RET RET
TEXT runtime·pthread_cond_init_trampoline(SB),NOSPLIT,$0 TEXT runtime·pthread_cond_init_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 attr MOVQ 8(DI), SI // arg 2 attr
MOVQ 0(DI), DI // arg 1 cond MOVQ 0(DI), DI // arg 1 cond
CALL libc_pthread_cond_init(SB) CALL libc_pthread_cond_init(SB)
POPQ BP
RET RET
TEXT runtime·pthread_cond_wait_trampoline(SB),NOSPLIT,$0 TEXT runtime·pthread_cond_wait_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 mutex MOVQ 8(DI), SI // arg 2 mutex
MOVQ 0(DI), DI // arg 1 cond MOVQ 0(DI), DI // arg 1 cond
CALL libc_pthread_cond_wait(SB) CALL libc_pthread_cond_wait(SB)
POPQ BP
RET RET
TEXT runtime·pthread_cond_timedwait_relative_np_trampoline(SB),NOSPLIT,$0 TEXT runtime·pthread_cond_timedwait_relative_np_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 mutex MOVQ 8(DI), SI // arg 2 mutex
MOVQ 16(DI), DX // arg 3 timeout MOVQ 16(DI), DX // arg 3 timeout
MOVQ 0(DI), DI // arg 1 cond MOVQ 0(DI), DI // arg 1 cond
CALL libc_pthread_cond_timedwait_relative_np(SB) CALL libc_pthread_cond_timedwait_relative_np(SB)
POPQ BP
RET RET
TEXT runtime·pthread_cond_signal_trampoline(SB),NOSPLIT,$0 TEXT runtime·pthread_cond_signal_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 0(DI), DI // arg 1 cond MOVQ 0(DI), DI // arg 1 cond
CALL libc_pthread_cond_signal(SB) CALL libc_pthread_cond_signal(SB)
POPQ BP
RET RET
TEXT runtime·pthread_self_trampoline(SB),NOSPLIT,$0 TEXT runtime·pthread_self_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ DI, BX // BX is caller-save MOVQ DI, BX // BX is caller-save
CALL libc_pthread_self(SB) CALL libc_pthread_self(SB)
MOVQ AX, 0(BX) // return value MOVQ AX, 0(BX) // return value
POPQ BP
RET RET
TEXT runtime·pthread_kill_trampoline(SB),NOSPLIT,$0 TEXT runtime·pthread_kill_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 sig MOVQ 8(DI), SI // arg 2 sig
MOVQ 0(DI), DI // arg 1 thread MOVQ 0(DI), DI // arg 1 thread
CALL libc_pthread_kill(SB) CALL libc_pthread_kill(SB)
POPQ BP
RET RET
TEXT runtime·osinit_hack_trampoline(SB),NOSPLIT,$0 TEXT runtime·osinit_hack_trampoline(SB),NOSPLIT,$0
@ -622,10 +512,7 @@ TEXT runtime·osinit_hack_trampoline(SB),NOSPLIT,$0
// //
// syscall expects a 32-bit result and tests for 32-bit -1 // syscall expects a 32-bit result and tests for 32-bit -1
// to decide there was an error. // to decide there was an error.
TEXT runtime·syscall(SB),NOSPLIT,$0 TEXT runtime·syscall(SB),NOSPLIT,$16
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
MOVQ (0*8)(DI), CX // fn MOVQ (0*8)(DI), CX // fn
MOVQ (2*8)(DI), SI // a2 MOVQ (2*8)(DI), SI // a2
MOVQ (3*8)(DI), DX // a3 MOVQ (3*8)(DI), DX // a3
@ -652,8 +539,6 @@ TEXT runtime·syscall(SB),NOSPLIT,$0
ok: ok:
XORL AX, AX // no error (it's ignored anyway) XORL AX, AX // no error (it's ignored anyway)
MOVQ BP, SP
POPQ BP
RET RET
// syscallX calls a function in libc on behalf of the syscall package. // syscallX calls a function in libc on behalf of the syscall package.
@ -672,10 +557,7 @@ ok:
// //
// syscallX is like syscall but expects a 64-bit result // syscallX is like syscall but expects a 64-bit result
// and tests for 64-bit -1 to decide there was an error. // and tests for 64-bit -1 to decide there was an error.
TEXT runtime·syscallX(SB),NOSPLIT,$0 TEXT runtime·syscallX(SB),NOSPLIT,$16
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
MOVQ (0*8)(DI), CX // fn MOVQ (0*8)(DI), CX // fn
MOVQ (2*8)(DI), SI // a2 MOVQ (2*8)(DI), SI // a2
MOVQ (3*8)(DI), DX // a3 MOVQ (3*8)(DI), DX // a3
@ -702,16 +584,11 @@ TEXT runtime·syscallX(SB),NOSPLIT,$0
ok: ok:
XORL AX, AX // no error (it's ignored anyway) XORL AX, AX // no error (it's ignored anyway)
MOVQ BP, SP
POPQ BP
RET RET
// syscallPtr is like syscallX except that the libc function reports an // syscallPtr is like syscallX except that the libc function reports an
// error by returning NULL and setting errno. // error by returning NULL and setting errno.
TEXT runtime·syscallPtr(SB),NOSPLIT,$0 TEXT runtime·syscallPtr(SB),NOSPLIT,$16
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
MOVQ (0*8)(DI), CX // fn MOVQ (0*8)(DI), CX // fn
MOVQ (2*8)(DI), SI // a2 MOVQ (2*8)(DI), SI // a2
MOVQ (3*8)(DI), DX // a3 MOVQ (3*8)(DI), DX // a3
@ -738,8 +615,6 @@ TEXT runtime·syscallPtr(SB),NOSPLIT,$0
ok: ok:
XORL AX, AX // no error (it's ignored anyway) XORL AX, AX // no error (it's ignored anyway)
MOVQ BP, SP
POPQ BP
RET RET
// syscall6 calls a function in libc on behalf of the syscall package. // syscall6 calls a function in libc on behalf of the syscall package.
@ -761,10 +636,7 @@ ok:
// //
// syscall6 expects a 32-bit result and tests for 32-bit -1 // syscall6 expects a 32-bit result and tests for 32-bit -1
// to decide there was an error. // to decide there was an error.
TEXT runtime·syscall6(SB),NOSPLIT,$0 TEXT runtime·syscall6(SB),NOSPLIT,$16
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
MOVQ (0*8)(DI), R11// fn MOVQ (0*8)(DI), R11// fn
MOVQ (2*8)(DI), SI // a2 MOVQ (2*8)(DI), SI // a2
MOVQ (3*8)(DI), DX // a3 MOVQ (3*8)(DI), DX // a3
@ -791,8 +663,6 @@ TEXT runtime·syscall6(SB),NOSPLIT,$0
ok: ok:
XORL AX, AX // no error (it's ignored anyway) XORL AX, AX // no error (it's ignored anyway)
MOVQ BP, SP
POPQ BP
RET RET
// syscall6X calls a function in libc on behalf of the syscall package. // syscall6X calls a function in libc on behalf of the syscall package.
@ -814,10 +684,7 @@ ok:
// //
// syscall6X is like syscall6 but expects a 64-bit result // syscall6X is like syscall6 but expects a 64-bit result
// and tests for 64-bit -1 to decide there was an error. // and tests for 64-bit -1 to decide there was an error.
TEXT runtime·syscall6X(SB),NOSPLIT,$0 TEXT runtime·syscall6X(SB),NOSPLIT,$16
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
MOVQ (0*8)(DI), R11// fn MOVQ (0*8)(DI), R11// fn
MOVQ (2*8)(DI), SI // a2 MOVQ (2*8)(DI), SI // a2
MOVQ (3*8)(DI), DX // a3 MOVQ (3*8)(DI), DX // a3
@ -844,8 +711,6 @@ TEXT runtime·syscall6X(SB),NOSPLIT,$0
ok: ok:
XORL AX, AX // no error (it's ignored anyway) XORL AX, AX // no error (it's ignored anyway)
MOVQ BP, SP
POPQ BP
RET RET
// syscall9 calls a function in libc on behalf of the syscall package. // syscall9 calls a function in libc on behalf of the syscall package.
@ -870,10 +735,7 @@ ok:
// //
// syscall9 expects a 32-bit result and tests for 32-bit -1 // syscall9 expects a 32-bit result and tests for 32-bit -1
// to decide there was an error. // to decide there was an error.
TEXT runtime·syscall9(SB),NOSPLIT,$0 TEXT runtime·syscall9(SB),NOSPLIT,$16
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
MOVQ (0*8)(DI), R13// fn MOVQ (0*8)(DI), R13// fn
MOVQ (2*8)(DI), SI // a2 MOVQ (2*8)(DI), SI // a2
MOVQ (3*8)(DI), DX // a3 MOVQ (3*8)(DI), DX // a3
@ -903,17 +765,12 @@ TEXT runtime·syscall9(SB),NOSPLIT,$0
ok: ok:
XORL AX, AX // no error (it's ignored anyway) XORL AX, AX // no error (it's ignored anyway)
MOVQ BP, SP
POPQ BP
RET RET
// syscall_x509 is for crypto/x509. It is like syscall6 but does not check for errors, // syscall_x509 is for crypto/x509. It is like syscall6 but does not check for errors,
// takes 5 uintptrs and 1 float64, and only returns one value, // takes 5 uintptrs and 1 float64, and only returns one value,
// for use with standard C ABI functions. // for use with standard C ABI functions.
TEXT runtime·syscall_x509(SB),NOSPLIT,$0 TEXT runtime·syscall_x509(SB),NOSPLIT,$16
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
MOVQ (0*8)(DI), R11// fn MOVQ (0*8)(DI), R11// fn
MOVQ (2*8)(DI), SI // a2 MOVQ (2*8)(DI), SI // a2
MOVQ (3*8)(DI), DX // a3 MOVQ (3*8)(DI), DX // a3
@ -930,6 +787,4 @@ TEXT runtime·syscall_x509(SB),NOSPLIT,$0
MOVQ AX, (7*8)(DI) // r1 MOVQ AX, (7*8)(DI) // r1
XORL AX, AX // no error (it's ignored anyway) XORL AX, AX // no error (it's ignored anyway)
MOVQ BP, SP
POPQ BP
RET RET