1
0
mirror of https://github.com/golang/go synced 2024-11-11 21:20:21 -07:00

runtime: use NOFRAME on arm64

This replaces frame size -8 with the NOFRAME flag in arm64 assembly.

This was automated with:

sed -i -e 's/\(^TEXT.*[A-Z]\),\( *\)\$-8/\1|NOFRAME,\2$0/' $(find -name '*_arm64.s')

Plus a manual fix to mkduff.go.

The go binary is identical before and after this change.

Change-Id: I0310384d1a584118c41d1cd3a042bb8ea7227efa
Reviewed-on: https://go-review.googlesource.com/92043
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Austin Clements 2018-01-25 12:15:23 -05:00
parent a046caa1e8
commit beeabbcb25
13 changed files with 60 additions and 60 deletions

View File

@ -6,7 +6,7 @@
#include "textflag.h"
TEXT ·RewindAndSetgid(SB),NOSPLIT,$-8-0
TEXT ·RewindAndSetgid(SB),NOSPLIT|NOFRAME,$0-0
// Save link register
MOVD R30, R9

View File

@ -90,11 +90,11 @@ nocgo:
DATA runtime·mainPC+0(SB)/8,$runtime·main(SB)
GLOBL runtime·mainPC(SB),RODATA,$8
TEXT runtime·breakpoint(SB),NOSPLIT,$-8-0
TEXT runtime·breakpoint(SB),NOSPLIT|NOFRAME,$0-0
BRK
RET
TEXT runtime·asminit(SB),NOSPLIT,$-8-0
TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0
RET
/*
@ -103,7 +103,7 @@ TEXT runtime·asminit(SB),NOSPLIT,$-8-0
// void gosave(Gobuf*)
// save state in Gobuf; setjmp
TEXT runtime·gosave(SB), NOSPLIT, $-8-8
TEXT runtime·gosave(SB), NOSPLIT|NOFRAME, $0-8
MOVD buf+0(FP), R3
MOVD RSP, R0
MOVD R0, gobuf_sp(R3)
@ -143,7 +143,7 @@ TEXT runtime·gogo(SB), NOSPLIT, $24-8
// Switch to m->g0's stack, call fn(g).
// Fn must never return. It should gogo(&g->sched)
// to keep running g.
TEXT runtime·mcall(SB), NOSPLIT, $-8-8
TEXT runtime·mcall(SB), NOSPLIT|NOFRAME, $0-8
// Save caller state in g->sched
MOVD RSP, R0
MOVD R0, (g_sched+gobuf_sp)(g)
@ -257,7 +257,7 @@ noswitch:
// the top of a stack (for example, morestack calling newstack
// calling the scheduler calling newm calling gc), so we must
// record an argument size. For that purpose, it has no arguments.
TEXT runtime·morestack(SB),NOSPLIT,$-8-0
TEXT runtime·morestack(SB),NOSPLIT|NOFRAME,$0-0
// Cannot grow scheduler stack (m->g0).
MOVD g_m(g), R8
MOVD m_g0(R8), R4
@ -300,7 +300,7 @@ TEXT runtime·morestack(SB),NOSPLIT,$-8-0
// is still in this function, and not the beginning of the next.
UNDEF
TEXT runtime·morestack_noctxt(SB),NOSPLIT,$-8-0
TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
MOVW $0, R26
B runtime·morestack(SB)
@ -321,7 +321,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$-8-0
TEXT reflect·call(SB), NOSPLIT, $0-0
B ·reflectcall(SB)
TEXT ·reflectcall(SB), NOSPLIT, $-8-32
TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32
MOVWU argsize+24(FP), R16
DISPATCH(runtime·call32, 32)
DISPATCH(runtime·call64, 64)
@ -436,16 +436,16 @@ CALLFN(·call536870912, 536870920 )
CALLFN(·call1073741824, 1073741832 )
// AES hashing not implemented for ARM64, issue #10109.
TEXT runtime·aeshash(SB),NOSPLIT,$-8-0
TEXT runtime·aeshash(SB),NOSPLIT|NOFRAME,$0-0
MOVW $0, R0
MOVW (R0), R1
TEXT runtime·aeshash32(SB),NOSPLIT,$-8-0
TEXT runtime·aeshash32(SB),NOSPLIT|NOFRAME,$0-0
MOVW $0, R0
MOVW (R0), R1
TEXT runtime·aeshash64(SB),NOSPLIT,$-8-0
TEXT runtime·aeshash64(SB),NOSPLIT|NOFRAME,$0-0
MOVW $0, R0
MOVW (R0), R1
TEXT runtime·aeshashstr(SB),NOSPLIT,$-8-0
TEXT runtime·aeshashstr(SB),NOSPLIT|NOFRAME,$0-0
MOVW $0, R0
MOVW (R0), R1
@ -462,7 +462,7 @@ again:
// 1. grab stored LR for caller
// 2. sub 4 bytes to get back to BL deferreturn
// 3. BR to fn
TEXT runtime·jmpdefer(SB), NOSPLIT, $-8-16
TEXT runtime·jmpdefer(SB), NOSPLIT|NOFRAME, $0-16
MOVD 0(RSP), R0
SUB $4, R0
MOVD R0, LR
@ -475,7 +475,7 @@ TEXT runtime·jmpdefer(SB), NOSPLIT, $-8-16
B (R3)
// Save state of caller into g->sched. Smashes R0.
TEXT gosave<>(SB),NOSPLIT,$-8
TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0
MOVD LR, (g_sched+gobuf_pc)(g)
MOVD RSP, R0
MOVD R0, (g_sched+gobuf_sp)(g)
@ -703,17 +703,17 @@ TEXT setg_gcc<>(SB),NOSPLIT,$8
MOVD savedR27-8(SP), R27
RET
TEXT runtime·getcallerpc(SB),NOSPLIT,$-8-8
TEXT runtime·getcallerpc(SB),NOSPLIT|NOFRAME,$0-8
MOVD 0(RSP), R0 // LR saved by caller
MOVD R0, ret+0(FP)
RET
TEXT runtime·abort(SB),NOSPLIT,$-8-0
TEXT runtime·abort(SB),NOSPLIT|NOFRAME,$0-0
B (ZR)
UNDEF
// memequal(a, b unsafe.Pointer, size uintptr) bool
TEXT runtime·memequal(SB),NOSPLIT,$-8-25
TEXT runtime·memequal(SB),NOSPLIT|NOFRAME,$0-25
MOVD size+16(FP), R1
// short path to handle 0-byte case
CBZ R1, equal
@ -745,7 +745,7 @@ eq:
MOVB R3, ret+16(FP)
RET
TEXT runtime·cmpstring(SB),NOSPLIT,$-8-40
TEXT runtime·cmpstring(SB),NOSPLIT|NOFRAME,$0-40
MOVD s1_base+0(FP), R2
MOVD s1_len+8(FP), R0
MOVD s2_base+16(FP), R3
@ -753,7 +753,7 @@ TEXT runtime·cmpstring(SB),NOSPLIT,$-8-40
ADD $40, RSP, R7
B runtime·cmpbody<>(SB)
TEXT bytes·Compare(SB),NOSPLIT,$-8-56
TEXT bytes·Compare(SB),NOSPLIT|NOFRAME,$0-56
MOVD s1+0(FP), R2
MOVD s1+8(FP), R0
MOVD s2+24(FP), R3
@ -770,7 +770,7 @@ TEXT bytes·Compare(SB),NOSPLIT,$-8-56
//
// On exit:
// R4, R5, and R6 are clobbered
TEXT runtime·cmpbody<>(SB),NOSPLIT,$-8-0
TEXT runtime·cmpbody<>(SB),NOSPLIT|NOFRAME,$0-0
CMP R2, R3
BEQ samebytes // same starting pointers; compare lengths
CMP R0, R1
@ -1033,7 +1033,7 @@ TEXT runtime·return0(SB), NOSPLIT, $0
// The top-most function running on a goroutine
// returns to goexit+PCQuantum.
TEXT runtime·goexit(SB),NOSPLIT,$-8-0
TEXT runtime·goexit(SB),NOSPLIT|NOFRAME,$0-0
MOVD R0, R0 // NOP
BL runtime·goexit1(SB) // does not return

View File

@ -4,6 +4,6 @@
#include "textflag.h"
TEXT ·publicationBarrier(SB),NOSPLIT,$-8-0
TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0
DMB $0xe // DMB ST
RET

View File

@ -7,7 +7,7 @@
// Called by C code generated by cmd/cgo.
// func crosscall2(fn func(a unsafe.Pointer, n int32, ctxt uintptr), a unsafe.Pointer, n int32, ctxt uintptr)
// Saves C callee-saved registers and calls fn with three arguments.
TEXT crosscall2(SB),NOSPLIT,$-8
TEXT crosscall2(SB),NOSPLIT|NOFRAME,$0
/*
* We still need to save all callee save register as before, and then
* push 3 args for fn (R1, R2, R3).

View File

@ -10,7 +10,7 @@
//
// R1 - LR at moment of fault
// R2 - PC at moment of fault
TEXT xx_cgo_panicmem(SB),NOSPLIT,$-8
TEXT xx_cgo_panicmem(SB),NOSPLIT|NOFRAME,$0
// If in external C code, we need to load the g register.
BL runtime·load_g(SB)
CMP $0, g

View File

@ -4,7 +4,7 @@
#include "textflag.h"
TEXT runtime·duffzero(SB), NOSPLIT, $-8-0
TEXT runtime·duffzero(SB), NOSPLIT|NOFRAME, $0-0
STP.P (ZR, ZR), 16(R16)
STP.P (ZR, ZR), 16(R16)
STP.P (ZR, ZR), 16(R16)

View File

@ -5,7 +5,7 @@
#include "textflag.h"
// void runtime·memmove(void*, void*, uintptr)
TEXT runtime·memmove(SB), NOSPLIT, $-8-24
TEXT runtime·memmove(SB), NOSPLIT|NOFRAME, $0-24
MOVD to+0(FP), R3
MOVD from+8(FP), R4
MOVD n+16(FP), R5

View File

@ -153,7 +153,7 @@ func zeroARM64(w io.Writer) {
// ZR: always zero
// R16 (aka REGRT1): ptr to memory to be zeroed
// On return, R16 points to the last zeroed dword.
fmt.Fprintln(w, "TEXT runtime·duffzero(SB), NOSPLIT, $-8-0")
fmt.Fprintln(w, "TEXT runtime·duffzero(SB), NOSPLIT|NOFRAME, $0-0")
for i := 0; i < 63; i++ {
fmt.Fprintln(w, "\tSTP.P\t(ZR, ZR), 16(R16)")
}

View File

@ -4,13 +4,13 @@
#include "textflag.h"
TEXT _rt0_arm64_android(SB),NOSPLIT,$-8
TEXT _rt0_arm64_android(SB),NOSPLIT|NOFRAME,$0
MOVD $_rt0_arm64_linux(SB), R4
B (R4)
// When building with -buildmode=c-shared, this symbol is called when the shared
// library is loaded.
TEXT _rt0_arm64_android_lib(SB),NOSPLIT,$-8
TEXT _rt0_arm64_android_lib(SB),NOSPLIT|NOFRAME,$0
MOVW $1, R0 // argc
MOVD $_rt0_arm64_android_argv(SB), R1 // **argv
MOVD $_rt0_arm64_linux_lib(SB), R4

View File

@ -6,7 +6,7 @@
// No need for _rt0_arm64_darwin as darwin/arm64 only
// supports external linking.
TEXT _rt0_arm64_darwin(SB),NOSPLIT,$-8
TEXT _rt0_arm64_darwin(SB),NOSPLIT|NOFRAME,$0
MOVD $42, R0
MOVD $1, R16 // SYS_exit
SVC $0x80
@ -80,7 +80,7 @@ GLOBL _rt0_arm64_darwin_lib_argc<>(SB),NOPTR, $8
DATA _rt0_arm64_darwin_lib_argv<>(SB)/8, $0
GLOBL _rt0_arm64_darwin_lib_argv<>(SB),NOPTR, $8
TEXT main(SB),NOSPLIT,$-8
TEXT main(SB),NOSPLIT|NOFRAME,$0
MOVD $runtime·rt0_go(SB), R2
BL (R2)
exit:

View File

@ -4,7 +4,7 @@
#include "textflag.h"
TEXT _rt0_arm64_linux(SB),NOSPLIT,$-8
TEXT _rt0_arm64_linux(SB),NOSPLIT|NOFRAME,$0
MOVD 0(RSP), R0 // argc
ADD $8, RSP, R1 // argv
BL main(SB)
@ -88,7 +88,7 @@ DATA _rt0_arm64_linux_lib_argv<>(SB)/8, $0
GLOBL _rt0_arm64_linux_lib_argv<>(SB),NOPTR, $8
TEXT main(SB),NOSPLIT,$-8
TEXT main(SB),NOSPLIT|NOFRAME,$0
MOVD $runtime·rt0_go(SB), R2
BL (R2)
exit:

View File

@ -79,7 +79,7 @@ TEXT runtime·read(SB),NOSPLIT,$0
MOVW R0, ret+24(FP)
RET
TEXT runtime·exit(SB),NOSPLIT,$-8
TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0
MOVW code+0(FP), R0
MOVW $SYS_exit, R16
SVC $0x80

View File

@ -48,14 +48,14 @@
#define SYS_connect 203
#define SYS_brk 214
TEXT runtime·exit(SB),NOSPLIT,$-8-4
TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0-4
MOVW code+0(FP), R0
MOVD $SYS_exit_group, R8
SVC
RET
// func exitThread(wait *uint32)
TEXT runtime·exitThread(SB),NOSPLIT,$-8-8
TEXT runtime·exitThread(SB),NOSPLIT|NOFRAME,$0-8
MOVD wait+0(FP), R0
// We're done using the stack.
MOVW $0, R1
@ -65,7 +65,7 @@ TEXT runtime·exitThread(SB),NOSPLIT,$-8-8
SVC
JMP 0(PC)
TEXT runtime·open(SB),NOSPLIT,$-8-20
TEXT runtime·open(SB),NOSPLIT|NOFRAME,$0-20
MOVD $AT_FDCWD, R0
MOVD name+0(FP), R1
MOVW mode+8(FP), R2
@ -79,7 +79,7 @@ done:
MOVW R0, ret+16(FP)
RET
TEXT runtime·closefd(SB),NOSPLIT,$-8-12
TEXT runtime·closefd(SB),NOSPLIT|NOFRAME,$0-12
MOVW fd+0(FP), R0
MOVD $SYS_close, R8
SVC
@ -90,7 +90,7 @@ done:
MOVW R0, ret+8(FP)
RET
TEXT runtime·write(SB),NOSPLIT,$-8-28
TEXT runtime·write(SB),NOSPLIT|NOFRAME,$0-28
MOVD fd+0(FP), R0
MOVD p+8(FP), R1
MOVW n+16(FP), R2
@ -103,7 +103,7 @@ done:
MOVW R0, ret+24(FP)
RET
TEXT runtime·read(SB),NOSPLIT,$-8-28
TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0-28
MOVW fd+0(FP), R0
MOVD p+8(FP), R1
MOVW n+16(FP), R2
@ -116,7 +116,7 @@ done:
MOVW R0, ret+24(FP)
RET
TEXT runtime·getrlimit(SB),NOSPLIT,$-8-20
TEXT runtime·getrlimit(SB),NOSPLIT|NOFRAME,$0-20
MOVW kind+0(FP), R0
MOVD limit+8(FP), R1
MOVD $SYS_getrlimit, R8
@ -153,7 +153,7 @@ TEXT runtime·gettid(SB),NOSPLIT,$0-4
MOVW R0, ret+0(FP)
RET
TEXT runtime·raise(SB),NOSPLIT,$-8
TEXT runtime·raise(SB),NOSPLIT|NOFRAME,$0
MOVD $SYS_gettid, R8
SVC
MOVW R0, R0 // arg 1 tid
@ -162,7 +162,7 @@ TEXT runtime·raise(SB),NOSPLIT,$-8
SVC
RET
TEXT runtime·raiseproc(SB),NOSPLIT,$-8
TEXT runtime·raiseproc(SB),NOSPLIT|NOFRAME,$0
MOVD $SYS_getpid, R8
SVC
MOVW R0, R0 // arg 1 pid
@ -171,7 +171,7 @@ TEXT runtime·raiseproc(SB),NOSPLIT,$-8
SVC
RET
TEXT runtime·setitimer(SB),NOSPLIT,$-8-24
TEXT runtime·setitimer(SB),NOSPLIT|NOFRAME,$0-24
MOVW mode+0(FP), R0
MOVD new+8(FP), R1
MOVD old+16(FP), R2
@ -179,7 +179,7 @@ TEXT runtime·setitimer(SB),NOSPLIT,$-8-24
SVC
RET
TEXT runtime·mincore(SB),NOSPLIT,$-8-28
TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28
MOVD addr+0(FP), R0
MOVD n+8(FP), R1
MOVD dst+16(FP), R2
@ -215,7 +215,7 @@ TEXT runtime·nanotime(SB),NOSPLIT,$24-8
MOVD R3, ret+0(FP)
RET
TEXT runtime·rtsigprocmask(SB),NOSPLIT,$-8-28
TEXT runtime·rtsigprocmask(SB),NOSPLIT|NOFRAME,$0-28
MOVW how+0(FP), R0
MOVD new+8(FP), R1
MOVD old+16(FP), R2
@ -229,7 +229,7 @@ TEXT runtime·rtsigprocmask(SB),NOSPLIT,$-8-28
done:
RET
TEXT runtime·rt_sigaction(SB),NOSPLIT,$-8-36
TEXT runtime·rt_sigaction(SB),NOSPLIT|NOFRAME,$0-36
MOVD sig+0(FP), R0
MOVD new+8(FP), R1
MOVD old+16(FP), R2
@ -267,7 +267,7 @@ TEXT runtime·cgoSigtramp(SB),NOSPLIT,$0
MOVD $runtime·sigtramp(SB), R3
B (R3)
TEXT runtime·mmap(SB),NOSPLIT,$-8
TEXT runtime·mmap(SB),NOSPLIT|NOFRAME,$0
MOVD addr+0(FP), R0
MOVD n+8(FP), R1
MOVW prot+16(FP), R2
@ -288,7 +288,7 @@ ok:
MOVD $0, err+40(FP)
RET
TEXT runtime·munmap(SB),NOSPLIT,$-8
TEXT runtime·munmap(SB),NOSPLIT|NOFRAME,$0
MOVD addr+0(FP), R0
MOVD n+8(FP), R1
MOVD $SYS_munmap, R8
@ -299,7 +299,7 @@ TEXT runtime·munmap(SB),NOSPLIT,$-8
cool:
RET
TEXT runtime·madvise(SB),NOSPLIT,$-8
TEXT runtime·madvise(SB),NOSPLIT|NOFRAME,$0
MOVD addr+0(FP), R0
MOVD n+8(FP), R1
MOVW flags+16(FP), R2
@ -310,7 +310,7 @@ TEXT runtime·madvise(SB),NOSPLIT,$-8
// int64 futex(int32 *uaddr, int32 op, int32 val,
// struct timespec *timeout, int32 *uaddr2, int32 val2);
TEXT runtime·futex(SB),NOSPLIT,$-8
TEXT runtime·futex(SB),NOSPLIT|NOFRAME,$0
MOVD addr+0(FP), R0
MOVW op+8(FP), R1
MOVW val+12(FP), R2
@ -323,7 +323,7 @@ TEXT runtime·futex(SB),NOSPLIT,$-8
RET
// int64 clone(int32 flags, void *stk, M *mp, G *gp, void (*fn)(void));
TEXT runtime·clone(SB),NOSPLIT,$-8
TEXT runtime·clone(SB),NOSPLIT|NOFRAME,$0
MOVW flags+0(FP), R0
MOVD stk+8(FP), R1
@ -391,7 +391,7 @@ again:
SVC
B again // keep exiting
TEXT runtime·sigaltstack(SB),NOSPLIT,$-8
TEXT runtime·sigaltstack(SB),NOSPLIT|NOFRAME,$0
MOVD new+0(FP), R0
MOVD old+8(FP), R1
MOVD $SYS_sigaltstack, R8
@ -403,12 +403,12 @@ TEXT runtime·sigaltstack(SB),NOSPLIT,$-8
ok:
RET
TEXT runtime·osyield(SB),NOSPLIT,$-8
TEXT runtime·osyield(SB),NOSPLIT|NOFRAME,$0
MOVD $SYS_sched_yield, R8
SVC
RET
TEXT runtime·sched_getaffinity(SB),NOSPLIT,$-8
TEXT runtime·sched_getaffinity(SB),NOSPLIT|NOFRAME,$0
MOVD pid+0(FP), R0
MOVD len+8(FP), R1
MOVD buf+16(FP), R2
@ -418,7 +418,7 @@ TEXT runtime·sched_getaffinity(SB),NOSPLIT,$-8
RET
// int32 runtime·epollcreate(int32 size);
TEXT runtime·epollcreate(SB),NOSPLIT,$-8
TEXT runtime·epollcreate(SB),NOSPLIT|NOFRAME,$0
MOVW $0, R0
MOVD $SYS_epoll_create1, R8
SVC
@ -426,7 +426,7 @@ TEXT runtime·epollcreate(SB),NOSPLIT,$-8
RET
// int32 runtime·epollcreate1(int32 flags);
TEXT runtime·epollcreate1(SB),NOSPLIT,$-8
TEXT runtime·epollcreate1(SB),NOSPLIT|NOFRAME,$0
MOVW flags+0(FP), R0
MOVD $SYS_epoll_create1, R8
SVC
@ -434,7 +434,7 @@ TEXT runtime·epollcreate1(SB),NOSPLIT,$-8
RET
// func epollctl(epfd, op, fd int32, ev *epollEvent) int
TEXT runtime·epollctl(SB),NOSPLIT,$-8
TEXT runtime·epollctl(SB),NOSPLIT|NOFRAME,$0
MOVW epfd+0(FP), R0
MOVW op+4(FP), R1
MOVW fd+8(FP), R2
@ -445,7 +445,7 @@ TEXT runtime·epollctl(SB),NOSPLIT,$-8
RET
// int32 runtime·epollwait(int32 epfd, EpollEvent *ev, int32 nev, int32 timeout);
TEXT runtime·epollwait(SB),NOSPLIT,$-8
TEXT runtime·epollwait(SB),NOSPLIT|NOFRAME,$0
MOVW epfd+0(FP), R0
MOVD ev+8(FP), R1
MOVW nev+16(FP), R2
@ -457,7 +457,7 @@ TEXT runtime·epollwait(SB),NOSPLIT,$-8
RET
// void runtime·closeonexec(int32 fd);
TEXT runtime·closeonexec(SB),NOSPLIT,$-8
TEXT runtime·closeonexec(SB),NOSPLIT|NOFRAME,$0
MOVW fd+0(FP), R0 // fd
MOVD $2, R1 // F_SETFD
MOVD $1, R2 // FD_CLOEXEC