From 8a064c600802eaab9da0cbc83adccafb5d1b8678 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Thu, 25 Jan 2018 13:57:37 -0500 Subject: [PATCH] runtime: fix silly frame sizes on arm and arm64 "-8" is not a sensible frame size on arm and we're about to start rejecting it. Replace it with -4. Likewise, "-4" is not a sensible frame size on arm64 and we're about to start rejecting it. Replace it with -8. Finally, clean up some places we're weirdly inconsistent about using 0 versus -8. Change-Id: If85e229993d5f7f1f0cfa9852b4e294d053bd784 Reviewed-on: https://go-review.googlesource.com/92038 Run-TryBot: Austin Clements TryBot-Result: Gobot Gobot Reviewed-by: Cherry Zhang --- src/runtime/asm_arm64.s | 8 ++++---- src/runtime/internal/atomic/asm_arm64.s | 4 ++-- src/runtime/internal/atomic/atomic_arm64.s | 6 +++--- src/runtime/sys_freebsd_arm.s | 18 +++++++++--------- src/runtime/sys_netbsd_arm.s | 6 +++--- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s index 9bf0646c8d..daf3bf79cc 100644 --- a/src/runtime/asm_arm64.s +++ b/src/runtime/asm_arm64.s @@ -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,$-4-0 +TEXT runtime·morestack_noctxt(SB),NOSPLIT,$-8-0 MOVW $0, R26 B runtime·morestack(SB) @@ -745,7 +745,7 @@ eq: MOVB R3, ret+16(FP) RET -TEXT runtime·cmpstring(SB),NOSPLIT,$-4-40 +TEXT runtime·cmpstring(SB),NOSPLIT,$-8-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,$-4-40 ADD $40, RSP, R7 B runtime·cmpbody<>(SB) -TEXT bytes·Compare(SB),NOSPLIT,$-4-56 +TEXT bytes·Compare(SB),NOSPLIT,$-8-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,$-4-56 // // On exit: // R4, R5, and R6 are clobbered -TEXT runtime·cmpbody<>(SB),NOSPLIT,$-4-0 +TEXT runtime·cmpbody<>(SB),NOSPLIT,$-8-0 CMP R2, R3 BEQ samebytes // same starting pointers; compare lengths CMP R0, R1 diff --git a/src/runtime/internal/atomic/asm_arm64.s b/src/runtime/internal/atomic/asm_arm64.s index b6af632efa..56b89a5a0b 100644 --- a/src/runtime/internal/atomic/asm_arm64.s +++ b/src/runtime/internal/atomic/asm_arm64.s @@ -29,10 +29,10 @@ ok: TEXT runtime∕internal∕atomic·Casuintptr(SB), NOSPLIT, $0-25 B runtime∕internal∕atomic·Cas64(SB) -TEXT runtime∕internal∕atomic·Loaduintptr(SB), NOSPLIT, $-8-16 +TEXT runtime∕internal∕atomic·Loaduintptr(SB), NOSPLIT, $0-16 B runtime∕internal∕atomic·Load64(SB) -TEXT runtime∕internal∕atomic·Loaduint(SB), NOSPLIT, $-8-16 +TEXT runtime∕internal∕atomic·Loaduint(SB), NOSPLIT, $0-16 B runtime∕internal∕atomic·Load64(SB) TEXT runtime∕internal∕atomic·Storeuintptr(SB), NOSPLIT, $0-16 diff --git a/src/runtime/internal/atomic/atomic_arm64.s b/src/runtime/internal/atomic/atomic_arm64.s index 6c2031c205..354fd1e94b 100644 --- a/src/runtime/internal/atomic/atomic_arm64.s +++ b/src/runtime/internal/atomic/atomic_arm64.s @@ -5,21 +5,21 @@ #include "textflag.h" // uint32 runtime∕internal∕atomic·Load(uint32 volatile* addr) -TEXT ·Load(SB),NOSPLIT,$-8-12 +TEXT ·Load(SB),NOSPLIT,$0-12 MOVD ptr+0(FP), R0 LDARW (R0), R0 MOVW R0, ret+8(FP) RET // uint64 runtime∕internal∕atomic·Load64(uint64 volatile* addr) -TEXT ·Load64(SB),NOSPLIT,$-8-16 +TEXT ·Load64(SB),NOSPLIT,$0-16 MOVD ptr+0(FP), R0 LDAR (R0), R0 MOVD R0, ret+8(FP) RET // void *runtime∕internal∕atomic·Loadp(void *volatile *addr) -TEXT ·Loadp(SB),NOSPLIT,$-8-16 +TEXT ·Loadp(SB),NOSPLIT,$0-16 MOVD ptr+0(FP), R0 LDAR (R0), R0 MOVD R0, ret+8(FP) diff --git a/src/runtime/sys_freebsd_arm.s b/src/runtime/sys_freebsd_arm.s index 3f52864305..e977eeb25c 100644 --- a/src/runtime/sys_freebsd_arm.s +++ b/src/runtime/sys_freebsd_arm.s @@ -74,7 +74,7 @@ TEXT runtime·thr_start(SB),NOSPLIT,$0 RET // Exit the entire program (like C exit) -TEXT runtime·exit(SB),NOSPLIT,$-8 +TEXT runtime·exit(SB),NOSPLIT,$-4 MOVW code+0(FP), R0 // arg 1 exit status MOVW $SYS_exit, R7 SWI $0 @@ -99,7 +99,7 @@ storeloop: MOVW.CS R8, (R8) JMP 0(PC) -TEXT runtime·open(SB),NOSPLIT,$-8 +TEXT runtime·open(SB),NOSPLIT,$-4 MOVW name+0(FP), R0 // arg 1 name MOVW mode+4(FP), R1 // arg 2 mode MOVW perm+8(FP), R2 // arg 3 perm @@ -109,7 +109,7 @@ TEXT runtime·open(SB),NOSPLIT,$-8 MOVW R0, ret+12(FP) RET -TEXT runtime·read(SB),NOSPLIT,$-8 +TEXT runtime·read(SB),NOSPLIT,$-4 MOVW fd+0(FP), R0 // arg 1 fd MOVW p+4(FP), R1 // arg 2 buf MOVW n+8(FP), R2 // arg 3 count @@ -119,7 +119,7 @@ TEXT runtime·read(SB),NOSPLIT,$-8 MOVW R0, ret+12(FP) RET -TEXT runtime·write(SB),NOSPLIT,$-8 +TEXT runtime·write(SB),NOSPLIT,$-4 MOVW fd+0(FP), R0 // arg 1 fd MOVW p+4(FP), R1 // arg 2 buf MOVW n+8(FP), R2 // arg 3 count @@ -129,7 +129,7 @@ TEXT runtime·write(SB),NOSPLIT,$-8 MOVW R0, ret+12(FP) RET -TEXT runtime·closefd(SB),NOSPLIT,$-8 +TEXT runtime·closefd(SB),NOSPLIT,$-4 MOVW fd+0(FP), R0 // arg 1 fd MOVW $SYS_close, R7 SWI $0 @@ -137,7 +137,7 @@ TEXT runtime·closefd(SB),NOSPLIT,$-8 MOVW R0, ret+4(FP) RET -TEXT runtime·getrlimit(SB),NOSPLIT,$-8 +TEXT runtime·getrlimit(SB),NOSPLIT,$-4 MOVW kind+0(FP), R0 MOVW limit+4(FP), R1 MOVW $SYS_getrlimit, R7 @@ -168,7 +168,7 @@ TEXT runtime·raiseproc(SB),NOSPLIT,$0 SWI $0 RET -TEXT runtime·setitimer(SB), NOSPLIT, $-8 +TEXT runtime·setitimer(SB), NOSPLIT, $-4 MOVW mode+0(FP), R0 MOVW new+4(FP), R1 MOVW old+8(FP), R2 @@ -216,7 +216,7 @@ TEXT runtime·nanotime(SB), NOSPLIT, $32 MOVW R1, ret_hi+4(FP) RET -TEXT runtime·sigaction(SB),NOSPLIT,$-8 +TEXT runtime·sigaction(SB),NOSPLIT,$-4 MOVW sig+0(FP), R0 // arg 1 sig MOVW new+4(FP), R1 // arg 2 act MOVW old+8(FP), R2 // arg 3 oact @@ -283,7 +283,7 @@ TEXT runtime·madvise(SB),NOSPLIT,$0 // ignore failure - maybe pages are locked RET -TEXT runtime·sigaltstack(SB),NOSPLIT,$-8 +TEXT runtime·sigaltstack(SB),NOSPLIT,$-4 MOVW new+0(FP), R0 MOVW old+4(FP), R1 MOVW $SYS_sigaltstack, R7 diff --git a/src/runtime/sys_netbsd_arm.s b/src/runtime/sys_netbsd_arm.s index 7d2e290dd9..3acde12ed0 100644 --- a/src/runtime/sys_netbsd_arm.s +++ b/src/runtime/sys_netbsd_arm.s @@ -33,7 +33,7 @@ storeloop: MOVW R8, (R8) JMP 0(PC) -TEXT runtime·open(SB),NOSPLIT,$-8 +TEXT runtime·open(SB),NOSPLIT,$-4 MOVW name+0(FP), R0 MOVW mode+4(FP), R1 MOVW perm+8(FP), R2 @@ -42,14 +42,14 @@ TEXT runtime·open(SB),NOSPLIT,$-8 MOVW R0, ret+12(FP) RET -TEXT runtime·closefd(SB),NOSPLIT,$-8 +TEXT runtime·closefd(SB),NOSPLIT,$-4 MOVW fd+0(FP), R0 SWI $0xa00006 MOVW.CS $-1, R0 MOVW R0, ret+4(FP) RET -TEXT runtime·read(SB),NOSPLIT,$-8 +TEXT runtime·read(SB),NOSPLIT,$-4 MOVW fd+0(FP), R0 MOVW p+4(FP), R1 MOVW n+8(FP), R2