Commit 9ddfb643 authored by Russ Cox's avatar Russ Cox

runtime: record argument size in assembly functions

I have not done the system call stubs in sys_*.s.
I hope to avoid that, because those do not block, so those
frames will not appear in stack traces during garbage
collection.

R=golang-dev, dvyukov, khr
CC=golang-dev
https://golang.org/cl/11360043
parent e69082ff
This diff is collapsed.
This diff is collapsed.
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "zasm_GOOS_GOARCH.h" #include "zasm_GOOS_GOARCH.h"
#include "funcdata.h"
// using frame size $-4 means do not save LR on stack. // using frame size $-4 means do not save LR on stack.
TEXT _rt0_go(SB),7,$-4 TEXT _rt0_go(SB),7,$-4
...@@ -61,7 +62,9 @@ TEXT _rt0_go(SB),7,$-4 ...@@ -61,7 +62,9 @@ TEXT _rt0_go(SB),7,$-4
MOVW.W R0, -4(R13) MOVW.W R0, -4(R13)
MOVW $0, R0 MOVW $0, R0
MOVW.W R0, -4(R13) // push $0 as guard MOVW.W R0, -4(R13) // push $0 as guard
ARGSIZE(12)
BL runtime·newproc(SB) BL runtime·newproc(SB)
ARGSIZE(-1)
MOVW $12(R13), R13 // pop args and LR MOVW $12(R13), R13 // pop args and LR
// start this M // start this M
...@@ -74,14 +77,15 @@ TEXT _rt0_go(SB),7,$-4 ...@@ -74,14 +77,15 @@ TEXT _rt0_go(SB),7,$-4
DATA runtime·main·f+0(SB)/4,$runtime·main(SB) DATA runtime·main·f+0(SB)/4,$runtime·main(SB)
GLOBL runtime·main·f(SB),8,$4 GLOBL runtime·main·f(SB),8,$4
TEXT runtime·breakpoint(SB),7,$0 TEXT runtime·breakpoint(SB),7,$0-0
// gdb won't skip this breakpoint instruction automatically, // gdb won't skip this breakpoint instruction automatically,
// so you must manually "set $pc+=4" to skip it and continue. // so you must manually "set $pc+=4" to skip it and continue.
WORD $0xe1200071 // BKPT 0x0001 WORD $0xe1200071 // BKPT 0x0001
RET RET
GLOBL runtime·goarm(SB), $4 GLOBL runtime·goarm(SB), $4
TEXT runtime·asminit(SB),7,$0
TEXT runtime·asminit(SB),7,$0-0
// disable runfast (flush-to-zero) mode of vfp if runtime.goarm > 5 // disable runfast (flush-to-zero) mode of vfp if runtime.goarm > 5
MOVW runtime·goarm(SB), R11 MOVW runtime·goarm(SB), R11
CMP $5, R11 CMP $5, R11
...@@ -97,7 +101,7 @@ TEXT runtime·asminit(SB),7,$0 ...@@ -97,7 +101,7 @@ TEXT runtime·asminit(SB),7,$0
// void gosave(Gobuf*) // void gosave(Gobuf*)
// save state in Gobuf; setjmp // save state in Gobuf; setjmp
TEXT runtime·gosave(SB), 7, $-4 TEXT runtime·gosave(SB), 7, $-4-4
MOVW 0(FP), R0 // gobuf MOVW 0(FP), R0 // gobuf
MOVW SP, gobuf_sp(R0) MOVW SP, gobuf_sp(R0)
MOVW LR, gobuf_pc(R0) MOVW LR, gobuf_pc(R0)
...@@ -110,7 +114,7 @@ TEXT runtime·gosave(SB), 7, $-4 ...@@ -110,7 +114,7 @@ TEXT runtime·gosave(SB), 7, $-4
// void gogo(Gobuf*) // void gogo(Gobuf*)
// restore state from Gobuf; longjmp // restore state from Gobuf; longjmp
TEXT runtime·gogo(SB), 7, $-4 TEXT runtime·gogo(SB), 7, $-4-4
MOVW 0(FP), R1 // gobuf MOVW 0(FP), R1 // gobuf
MOVW gobuf_g(R1), g MOVW gobuf_g(R1), g
MOVW 0(g), R2 // make sure g != nil MOVW 0(g), R2 // make sure g != nil
...@@ -133,7 +137,7 @@ TEXT runtime·gogo(SB), 7, $-4 ...@@ -133,7 +137,7 @@ TEXT runtime·gogo(SB), 7, $-4
// Switch to m->g0's stack, call fn(g). // Switch to m->g0's stack, call fn(g).
// Fn must never return. It should gogo(&g->sched) // Fn must never return. It should gogo(&g->sched)
// to keep running g. // to keep running g.
TEXT runtime·mcall(SB), 7, $-4 TEXT runtime·mcall(SB), 7, $-4-4
MOVW fn+0(FP), R0 MOVW fn+0(FP), R0
// Save caller state in g->sched. // Save caller state in g->sched.
...@@ -200,7 +204,7 @@ TEXT runtime·morestack(SB),7,$-4 ...@@ -200,7 +204,7 @@ TEXT runtime·morestack(SB),7,$-4
// with the desired args running the desired function. // with the desired args running the desired function.
// //
// func call(fn *byte, arg *byte, argsize uint32). // func call(fn *byte, arg *byte, argsize uint32).
TEXT reflect·call(SB), 7, $-4 TEXT reflect·call(SB), 7, $-4-12
// Save our caller's state as the PC and SP to // Save our caller's state as the PC and SP to
// restore when returning from f. // restore when returning from f.
MOVW LR, (m_morebuf+gobuf_pc)(m) // our caller's PC MOVW LR, (m_morebuf+gobuf_pc)(m) // our caller's PC
...@@ -274,7 +278,7 @@ TEXT gosave<>(SB),7,$0 ...@@ -274,7 +278,7 @@ TEXT gosave<>(SB),7,$0
// Call fn(arg) on the scheduler stack, // Call fn(arg) on the scheduler stack,
// aligned appropriately for the gcc ABI. // aligned appropriately for the gcc ABI.
// See cgocall.c for more details. // See cgocall.c for more details.
TEXT runtime·asmcgocall(SB),7,$0 TEXT runtime·asmcgocall(SB),7,$0-8
MOVW fn+0(FP), R1 MOVW fn+0(FP), R1
MOVW arg+4(FP), R0 MOVW arg+4(FP), R0
MOVW R13, R2 MOVW R13, R2
...@@ -306,7 +310,7 @@ TEXT runtime·asmcgocall(SB),7,$0 ...@@ -306,7 +310,7 @@ TEXT runtime·asmcgocall(SB),7,$0
// cgocallback(void (*fn)(void*), void *frame, uintptr framesize) // cgocallback(void (*fn)(void*), void *frame, uintptr framesize)
// Turn the fn into a Go func (by taking its address) and call // Turn the fn into a Go func (by taking its address) and call
// cgocallback_gofunc. // cgocallback_gofunc.
TEXT runtime·cgocallback(SB),7,$12 TEXT runtime·cgocallback(SB),7,$12-12
MOVW $fn+0(FP), R0 MOVW $fn+0(FP), R0
MOVW R0, 4(R13) MOVW R0, 4(R13)
MOVW frame+4(FP), R0 MOVW frame+4(FP), R0
...@@ -319,7 +323,7 @@ TEXT runtime·cgocallback(SB),7,$12 ...@@ -319,7 +323,7 @@ TEXT runtime·cgocallback(SB),7,$12
// cgocallback_gofunc(void (*fn)(void*), void *frame, uintptr framesize) // cgocallback_gofunc(void (*fn)(void*), void *frame, uintptr framesize)
// See cgocall.c for more details. // See cgocall.c for more details.
TEXT runtime·cgocallback_gofunc(SB),7,$12 TEXT runtime·cgocallback_gofunc(SB),7,$12-12
// Load m and g from thread-local storage. // Load m and g from thread-local storage.
MOVW _cgo_load_gm(SB), R0 MOVW _cgo_load_gm(SB), R0
CMP $0, R0 CMP $0, R0
...@@ -410,7 +414,7 @@ havem: ...@@ -410,7 +414,7 @@ havem:
RET RET
// void setmg(M*, G*); set m and g. for use by needm. // void setmg(M*, G*); set m and g. for use by needm.
TEXT runtime·setmg(SB), 7, $0 TEXT runtime·setmg(SB), 7, $0-8
MOVW mm+0(FP), m MOVW mm+0(FP), m
MOVW gg+4(FP), g MOVW gg+4(FP), g
...@@ -421,24 +425,24 @@ TEXT runtime·setmg(SB), 7, $0 ...@@ -421,24 +425,24 @@ TEXT runtime·setmg(SB), 7, $0
RET RET
TEXT runtime·getcallerpc(SB),7,$-4 TEXT runtime·getcallerpc(SB),7,$-4-4
MOVW 0(SP), R0 MOVW 0(SP), R0
RET RET
TEXT runtime·setcallerpc(SB),7,$-4 TEXT runtime·setcallerpc(SB),7,$-4-8
MOVW x+4(FP), R0 MOVW x+4(FP), R0
MOVW R0, 0(SP) MOVW R0, 0(SP)
RET RET
TEXT runtime·getcallersp(SB),7,$-4 TEXT runtime·getcallersp(SB),7,$-4-4
MOVW 0(FP), R0 MOVW 0(FP), R0
MOVW $-4(R0), R0 MOVW $-4(R0), R0
RET RET
TEXT runtime·emptyfunc(SB),0,$0 TEXT runtime·emptyfunc(SB),0,$0-0
RET RET
TEXT runtime·abort(SB),7,$-4 TEXT runtime·abort(SB),7,$-4-0
MOVW $0, R0 MOVW $0, R0
MOVW (R0), R1 MOVW (R0), R1
...@@ -456,7 +460,7 @@ TEXT runtime·abort(SB),7,$-4 ...@@ -456,7 +460,7 @@ TEXT runtime·abort(SB),7,$-4
// TEXT runtime·cas(SB),7,$0 // TEXT runtime·cas(SB),7,$0
// B runtime·armcas(SB) // B runtime·armcas(SB)
// //
TEXT runtime·armcas(SB),7,$0 TEXT runtime·armcas(SB),7,$0-12
MOVW valptr+0(FP), R1 MOVW valptr+0(FP), R1
MOVW old+4(FP), R2 MOVW old+4(FP), R2
MOVW new+8(FP), R3 MOVW new+8(FP), R3
...@@ -473,7 +477,7 @@ casfail: ...@@ -473,7 +477,7 @@ casfail:
MOVW $0, R0 MOVW $0, R0
RET RET
TEXT runtime·stackguard(SB),7,$0 TEXT runtime·stackguard(SB),7,$0-8
MOVW R13, R1 MOVW R13, R1
MOVW g_stackguard(g), R2 MOVW g_stackguard(g), R2
MOVW R1, sp+0(FP) MOVW R1, sp+0(FP)
...@@ -481,20 +485,20 @@ TEXT runtime·stackguard(SB),7,$0 ...@@ -481,20 +485,20 @@ TEXT runtime·stackguard(SB),7,$0
RET RET
// AES hashing not implemented for ARM // AES hashing not implemented for ARM
TEXT runtime·aeshash(SB),7,$-4 TEXT runtime·aeshash(SB),7,$-4-0
MOVW $0, R0 MOVW $0, R0
MOVW (R0), R1 MOVW (R0), R1
TEXT runtime·aeshash32(SB),7,$-4 TEXT runtime·aeshash32(SB),7,$-4-0
MOVW $0, R0 MOVW $0, R0
MOVW (R0), R1 MOVW (R0), R1
TEXT runtime·aeshash64(SB),7,$-4 TEXT runtime·aeshash64(SB),7,$-4-0
MOVW $0, R0 MOVW $0, R0
MOVW (R0), R1 MOVW (R0), R1
TEXT runtime·aeshashstr(SB),7,$-4 TEXT runtime·aeshashstr(SB),7,$-4-0
MOVW $0, R0 MOVW $0, R0
MOVW (R0), R1 MOVW (R0), R1
TEXT runtime·memeq(SB),7,$-4 TEXT runtime·memeq(SB),7,$-4-12
MOVW a+0(FP), R1 MOVW a+0(FP), R1
MOVW b+4(FP), R2 MOVW b+4(FP), R2
MOVW n+8(FP), R3 MOVW n+8(FP), R3
......
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file defines the IDs for PCDATA and FUNCDATA instructions
// in Go binaries. It is included by both C and assembly, so it must
// be written using #defines. It is included by the runtime package
// as well as the compilers.
#define PCDATA_ArgSize 0
// To be used in assembly.
#define ARGSIZE(n) PCDATA $PCDATA_ArgSize, $n
...@@ -28,7 +28,7 @@ TOE = 11 ...@@ -28,7 +28,7 @@ TOE = 11
N = 12 N = 12
TMP = 12 /* N and TMP don't overlap */ TMP = 12 /* N and TMP don't overlap */
TEXT runtime·memclr(SB),7,$0 TEXT runtime·memclr(SB),7,$0-8
MOVW ptr+0(FP), R(TO) MOVW ptr+0(FP), R(TO)
MOVW n+4(FP), R(N) MOVW n+4(FP), R(N)
MOVW $0, R(0) MOVW $0, R(0)
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
TEXT runtime·memmove(SB), 7, $0 TEXT runtime·memmove(SB), 7, $0-12
MOVL to+0(FP), DI MOVL to+0(FP), DI
MOVL fr+4(FP), SI MOVL fr+4(FP), SI
MOVL n+8(FP), BX MOVL n+8(FP), BX
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
// THE SOFTWARE. // THE SOFTWARE.
// void runtime·memmove(void*, void*, uintptr) // void runtime·memmove(void*, void*, uintptr)
TEXT runtime·memmove(SB), 7, $0 TEXT runtime·memmove(SB), 7, $0-24
MOVQ to+0(FP), DI MOVQ to+0(FP), DI
MOVQ fr+8(FP), SI MOVQ fr+8(FP), SI
......
...@@ -56,7 +56,7 @@ FR2 = 4 ...@@ -56,7 +56,7 @@ FR2 = 4
FW3 = 4 FW3 = 4
FR3 = 8 /* shared with TE */ FR3 = 8 /* shared with TE */
TEXT runtime·memmove(SB), 7, $4 TEXT runtime·memmove(SB), 7, $4-12
_memmove: _memmove:
MOVW to+0(FP), R(TS) MOVW to+0(FP), R(TS)
MOVW from+4(FP), R(FROM) MOVW from+4(FP), R(FROM)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// +build race // +build race
// func runtime·racefuncenter(pc uintptr) // func runtime·racefuncenter(pc uintptr)
TEXT runtime·racefuncenter(SB), 7, $16 TEXT runtime·racefuncenter(SB), 7, $16-8
MOVQ DX, saved-8(SP) // save function entry context (for closures) MOVQ DX, saved-8(SP) // save function entry context (for closures)
MOVQ pc+0(FP), DX MOVQ pc+0(FP), DX
MOVQ DX, arg-16(SP) MOVQ DX, arg-16(SP)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment