10754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Copyright 2015 The Go Authors. All rights reserved.
20754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Use of this source code is governed by a BSD-style
30754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// license that can be found in the LICENSE file.
40754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
50754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#include "go_asm.h"
60754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#include "go_tls.h"
70754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#include "tls_arm64.h"
80754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#include "funcdata.h"
90754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#include "textflag.h"
100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
110754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·rt0_go(SB),NOSPLIT,$0
120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// SP = stack; R0 = argc; R1 = argv
130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUB	$32, RSP
150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	R0, 8(RSP) // argc
160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R1, 16(RSP) // argv
170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// create istack out of the given (operating system) stack.
190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// _cgo_init may update stackguard.
200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$runtime·g0(SB), g
210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD RSP, R7
220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$(-64*1024)(R7), R0
230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, g_stackguard0(g)
240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, g_stackguard1(g)
250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, (g_stack+stack_lo)(g)
260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R7, (g_stack+stack_hi)(g)
270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// if there is a _cgo_init, call it using the gcc ABI.
290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	_cgo_init(SB), R12
300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	$0, R12
310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	nocgo
320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MRS_TPIDR_R0			// load TLS base pointer
340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, R3			// arg 3: TLS base pointer
350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#ifdef TLSG_IS_VARIABLE
360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$runtime·tls_g(SB), R2 	// arg 2: &tls_g
370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#else
380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$0, R2		        // arg 2: not used when using platform's TLS
390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#endif
400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$setg_gcc<>(SB), R1	// arg 1: setg
410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g, R0			// arg 0: G
420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	(R12)
430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	_cgo_init(SB), R12
440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	$0, R12
450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	nocgo
460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotnocgo:
480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// update stackguard after _cgo_init
490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(g_stack+stack_lo)(g), R0
500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	$const__StackGuard, R0
510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, g_stackguard0(g)
520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, g_stackguard1(g)
530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// set the per-goroutine and per-mach "registers"
550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$runtime·m0(SB), R0
560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// save m->g0 = g0
580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g, m_g0(R0)
590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// save m0 to g0->m
600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, g_m(g)
610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·check(SB)
630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	8(RSP), R0	// copy argc
650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	R0, -8(RSP)
660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	16(RSP), R0		// copy argv
670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, 0(RSP)
680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·args(SB)
690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·osinit(SB)
700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·schedinit(SB)
710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// create a new goroutine to start program
730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$runtime·mainPC(SB), R0		// entry
740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	RSP, R7
750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD.W	$0, -8(R7)
760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD.W	R0, -8(R7)
770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD.W	$0, -8(R7)
780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD.W	$0, -8(R7)
790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R7, RSP
800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·newproc(SB)
810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	$32, RSP
820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// start this M
840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·mstart(SB)
850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$0, R0
870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, (R0)	// boom
880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	UNDEF
890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
900754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA	runtime·mainPC+0(SB)/8,$runtime·main(SB)
910754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotGLOBL	runtime·mainPC(SB),RODATA,$8
920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
930754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·breakpoint(SB),NOSPLIT,$-8-0
940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BRK
950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
970754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·asminit(SB),NOSPLIT,$-8-0
980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot/*
1010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot *  go-routine
1020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot */
1030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// void gosave(Gobuf*)
1050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// save state in Gobuf; setjmp
1060754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·gosave(SB), NOSPLIT, $-8-8
1070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	buf+0(FP), R3
1080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	RSP, R0
1090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, gobuf_sp(R3)
1100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	LR, gobuf_pc(R3)
1110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g, gobuf_g(R3)
1120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	ZR, gobuf_lr(R3)
1130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	ZR, gobuf_ret(R3)
1140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Assert ctxt is zero. See func save.
1150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	gobuf_ctxt(R3), R0
1160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	$0, R0
1170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	2(PC)
1180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·badctxt(SB)
1190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
1200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// void gogo(Gobuf*)
1220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// restore state from Gobuf; longjmp
1230754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·gogo(SB), NOSPLIT, $24-8
1240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	buf+0(FP), R5
1250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	gobuf_g(R5), g
1260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·save_g(SB)
1270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	0(g), R4	// make sure g is not nil
1290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	gobuf_sp(R5), R0
1300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, RSP
1310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	gobuf_lr(R5), LR
1320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	gobuf_ret(R5), R0
1330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	gobuf_ctxt(R5), R26
1340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$0, gobuf_sp(R5)
1350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$0, gobuf_ret(R5)
1360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$0, gobuf_lr(R5)
1370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$0, gobuf_ctxt(R5)
1380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	ZR, ZR // set condition codes for == test, needed by stack split
1390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	gobuf_pc(R5), R6
1400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	(R6)
1410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// void mcall(fn func(*g))
1430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Switch to m->g0's stack, call fn(g).
1440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Fn must never return. It should gogo(&g->sched)
1450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// to keep running g.
1460754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·mcall(SB), NOSPLIT, $-8-8
1470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Save caller state in g->sched
1480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	RSP, R0
1490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, (g_sched+gobuf_sp)(g)
1500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	LR, (g_sched+gobuf_pc)(g)
1510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$0, (g_sched+gobuf_lr)(g)
1520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g, (g_sched+gobuf_g)(g)
1530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Switch to m->g0 & its stack, call fn.
1550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g, R3
1560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g_m(g), R8
1570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	m_g0(R8), g
1580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·save_g(SB)
1590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	g, R3
1600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BNE	2(PC)
1610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	runtime·badmcall(SB)
1620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	fn+0(FP), R26			// context
1630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	0(R26), R4			// code pointer
1640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(g_sched+gobuf_sp)(g), R0
1650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, RSP	// sp = m->g0->sched.sp
1660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R3, -8(RSP)
1670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$0, -16(RSP)
1680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUB	$16, RSP
1690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	(R4)
1700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	runtime·badmcall2(SB)
1710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// systemstack_switch is a dummy routine that systemstack leaves at the bottom
1730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// of the G stack. We need to distinguish the routine that
1740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// lives at the bottom of the G stack from the one that lives
1750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// at the top of the system stack because the one at the top of
1760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// the system stack terminates the stack walk (see topofstack()).
1770754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·systemstack_switch(SB), NOSPLIT, $0-0
1780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	UNDEF
1790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	(LR)	// make sure this function is not leaf
1800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
1810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// func systemstack(fn func())
1830754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·systemstack(SB), NOSPLIT, $0-8
1840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	fn+0(FP), R3	// R3 = fn
1850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R3, R26		// context
1860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g_m(g), R4	// R4 = m
1870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	m_gsignal(R4), R5	// R5 = gsignal
1890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	g, R5
1900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	noswitch
1910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	m_g0(R4), R5	// R5 = g0
1930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	g, R5
1940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	noswitch
1950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	m_curg(R4), R6
1970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	g, R6
1980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	switch
1990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Bad: g is not gsignal, not g0, not curg. What is it?
2010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Hide call from linker nosplit analysis.
2020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$runtime·badsystemstack(SB), R3
2030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	(R3)
2040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotswitch:
2060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// save our state in g->sched. Pretend to
2070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// be systemstack_switch if the G stack is scanned.
2080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$runtime·systemstack_switch(SB), R6
2090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	$8, R6	// get past prologue
2100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R6, (g_sched+gobuf_pc)(g)
2110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	RSP, R0
2120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, (g_sched+gobuf_sp)(g)
2130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$0, (g_sched+gobuf_lr)(g)
2140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g, (g_sched+gobuf_g)(g)
2150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// switch to g0
2170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R5, g
2180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·save_g(SB)
2190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(g_sched+gobuf_sp)(g), R3
2200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// make it look like mstart called systemstack on g0, to stop traceback
2210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUB	$16, R3
2220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AND	$~15, R3
2230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$runtime·mstart(SB), R4
2240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R4, 0(R3)
2250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R3, RSP
2260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// call target function
2280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	0(R26), R3	// code pointer
2290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	(R3)
2300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// switch back to g
2320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g_m(g), R3
2330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	m_curg(R3), g
2340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·save_g(SB)
2350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(g_sched+gobuf_sp)(g), R0
2360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, RSP
2370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$0, (g_sched+gobuf_sp)(g)
2380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
2390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotnoswitch:
2410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// already on m stack, just call directly
2420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Using a tail call here cleans up tracebacks since we won't stop
2430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// at an intermediate systemstack.
2440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	0(R26), R3	// code pointer
2450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD.P	16(RSP), R30	// restore LR
2460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	(R3)
2470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot/*
2490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot * support for morestack
2500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot */
2510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Called during function prolog when more stack is needed.
2530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Caller has already loaded:
2540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// R3 prolog's LR (R30)
2550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//
2560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// The traceback routines see morestack on a g0 as being
2570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// the top of a stack (for example, morestack calling newstack
2580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// calling the scheduler calling newm calling gc), so we must
2590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// record an argument size. For that purpose, it has no arguments.
2600754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·morestack(SB),NOSPLIT,$-8-0
2610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Cannot grow scheduler stack (m->g0).
2620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g_m(g), R8
2630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	m_g0(R8), R4
2640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	g, R4
2650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BNE	3(PC)
2660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·badmorestackg0(SB)
2670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	runtime·abort(SB)
2680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Cannot grow signal stack (m->gsignal).
2700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	m_gsignal(R8), R4
2710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	g, R4
2720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BNE	3(PC)
2730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·badmorestackgsignal(SB)
2740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	runtime·abort(SB)
2750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Called from f.
2770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Set g->sched to context in f
2780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	RSP, R0
2790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, (g_sched+gobuf_sp)(g)
2800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	LR, (g_sched+gobuf_pc)(g)
2810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R3, (g_sched+gobuf_lr)(g)
2820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R26, (g_sched+gobuf_ctxt)(g)
2830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Called from f.
2850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Set m->morebuf to f's callers.
2860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R3, (m_morebuf+gobuf_pc)(R8)	// f's caller's PC
2870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	RSP, R0
2880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, (m_morebuf+gobuf_sp)(R8)	// f's caller's RSP
2890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g, (m_morebuf+gobuf_g)(R8)
2900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Call newstack on m->g0's stack.
2920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	m_g0(R8), g
2930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·save_g(SB)
2940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(g_sched+gobuf_sp)(g), R0
2950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, RSP
2960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD.W	$0, -16(RSP)	// create a call frame on g0 (saved LR; keep 16-aligned)
2970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·newstack(SB)
2980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Not reached, but make sure the return PC from the call to newstack
3000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// is still in this function, and not the beginning of the next.
3010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	UNDEF
3020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3030754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·morestack_noctxt(SB),NOSPLIT,$-4-0
3040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	$0, R26
3050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B runtime·morestack(SB)
3060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// reflectcall: call a function with the given argument list
3080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32).
3090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// we don't have variable-sized frames, so we use a small number
3100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// of constant-sized-frame functions to encode a few bits of size in the pc.
3110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Caution: ugly multiline assembly macros in your future!
3120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#define DISPATCH(NAME,MAXSIZE)		\
3140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$MAXSIZE, R27;		\
3150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R27, R16;		\
3160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BGT	3(PC);			\
3170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$NAME(SB), R27;	\
3180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	(R27)
3190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Note: can't just "B NAME(SB)" - bad inlining results.
3200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3210754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT reflect·call(SB), NOSPLIT, $0-0
3220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	·reflectcall(SB)
3230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3240754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT ·reflectcall(SB), NOSPLIT, $-8-32
3250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVWU argsize+24(FP), R16
3260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call32, 32)
3270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call64, 64)
3280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call128, 128)
3290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call256, 256)
3300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call512, 512)
3310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call1024, 1024)
3320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call2048, 2048)
3330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call4096, 4096)
3340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call8192, 8192)
3350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call16384, 16384)
3360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call32768, 32768)
3370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call65536, 65536)
3380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call131072, 131072)
3390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call262144, 262144)
3400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call524288, 524288)
3410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call1048576, 1048576)
3420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call2097152, 2097152)
3430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call4194304, 4194304)
3440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call8388608, 8388608)
3450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call16777216, 16777216)
3460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call33554432, 33554432)
3470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call67108864, 67108864)
3480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call134217728, 134217728)
3490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call268435456, 268435456)
3500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call536870912, 536870912)
3510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call1073741824, 1073741824)
3520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$runtime·badreflectcall(SB), R0
3530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	(R0)
3540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#define CALLFN(NAME,MAXSIZE)			\
3560754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT NAME(SB), WRAPPER, $MAXSIZE-24;		\
3570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	NO_LOCAL_POINTERS;			\
3580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	/* copy arguments to stack */		\
3590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	arg+16(FP), R3;			\
3600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVWU	argsize+24(FP), R4;		\
3610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	$8, RSP, R5;			\
3620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BIC	$0xf, R4, R6;			\
3630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R6, 6(PC);			\
3640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	/* if R6=(argsize&~15) != 0 */		\
3650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	R6, R5, R6;			\
3660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	/* copy 16 bytes a time */		\
3670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LDP.P	16(R3), (R7, R8);		\
3680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	STP.P	(R7, R8), 16(R5);		\
3690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R5, R6;				\
3700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BNE	-3(PC);				\
3710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AND	$0xf, R4, R6;			\
3720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R6, 6(PC);			\
3730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	/* if R6=(argsize&15) != 0 */		\
3740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	R6, R5, R6;			\
3750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	/* copy 1 byte a time for the rest */	\
3760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVBU.P	1(R3), R7;			\
3770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVBU.P	R7, 1(R5);			\
3780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R5, R6;				\
3790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BNE	-3(PC);				\
3800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	/* call function */			\
3810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	f+8(FP), R26;			\
3820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(R26), R0;			\
3830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PCDATA  $PCDATA_StackMapIndex, $0;	\
3840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	(R0);				\
3850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	/* copy return values back */		\
3860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	argtype+0(FP), R7;		\
3870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	arg+16(FP), R3;			\
3880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVWU	n+24(FP), R4;			\
3890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVWU	retoffset+28(FP), R6;		\
3900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	$8, RSP, R5;			\
3910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	R6, R5; 			\
3920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	R6, R3;				\
3930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUB	R6, R4;				\
3940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	callRet<>(SB);			\
3950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
3960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// callRet copies return values back at the end of call*. This is a
3980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// separate function so it can allocate stack space for the arguments
3990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// to reflectcallmove. It does not follow the Go ABI; it expects its
4000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// arguments in registers.
4010754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT callRet<>(SB), NOSPLIT, $40-0
4020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R7, 8(RSP)
4030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R3, 16(RSP)
4040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R5, 24(RSP)
4050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R4, 32(RSP)
4060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·reflectcallmove(SB)
4070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
4080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// These have 8 added to make the overall frame size a multiple of 16,
4100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// as required by the ABI. (There is another +8 for the saved LR.)
4110754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall32, 40 )
4120754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall64, 72 )
4130754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall128, 136 )
4140754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall256, 264 )
4150754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall512, 520 )
4160754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall1024, 1032 )
4170754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall2048, 2056 )
4180754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall4096, 4104 )
4190754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall8192, 8200 )
4200754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall16384, 16392 )
4210754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall32768, 32776 )
4220754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall65536, 65544 )
4230754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall131072, 131080 )
4240754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall262144, 262152 )
4250754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall524288, 524296 )
4260754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall1048576, 1048584 )
4270754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall2097152, 2097160 )
4280754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall4194304, 4194312 )
4290754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall8388608, 8388616 )
4300754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall16777216, 16777224 )
4310754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall33554432, 33554440 )
4320754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall67108864, 67108872 )
4330754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall134217728, 134217736 )
4340754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall268435456, 268435464 )
4350754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall536870912, 536870920 )
4360754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall1073741824, 1073741832 )
4370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// AES hashing not implemented for ARM64, issue #10109.
4390754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·aeshash(SB),NOSPLIT,$-8-0
4400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	$0, R0
4410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	(R0), R1
4420754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·aeshash32(SB),NOSPLIT,$-8-0
4430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	$0, R0
4440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	(R0), R1
4450754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·aeshash64(SB),NOSPLIT,$-8-0
4460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	$0, R0
4470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	(R0), R1
4480754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·aeshashstr(SB),NOSPLIT,$-8-0
4490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	$0, R0
4500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	(R0), R1
4510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4520754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·procyield(SB),NOSPLIT,$0-0
4530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVWU	cycles+0(FP), R0
4540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotagain:
4550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	YIELD
4560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBW	$1, R0
4570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBNZ	R0, again
4580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
4590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// void jmpdefer(fv, sp);
4610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// called from deferreturn.
4620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// 1. grab stored LR for caller
4630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// 2. sub 4 bytes to get back to BL deferreturn
4640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// 3. BR to fn
4650754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·jmpdefer(SB), NOSPLIT, $-8-16
4660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	0(RSP), R0
4670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUB	$4, R0
4680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, LR
4690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	fv+0(FP), R26
4710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	argp+8(FP), R0
4720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, RSP
4730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUB	$8, RSP
4740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	0(R26), R3
4750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	(R3)
4760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Save state of caller into g->sched. Smashes R0.
4780754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT gosave<>(SB),NOSPLIT,$-8
4790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	LR, (g_sched+gobuf_pc)(g)
4800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD RSP, R0
4810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, (g_sched+gobuf_sp)(g)
4820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$0, (g_sched+gobuf_lr)(g)
4830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$0, (g_sched+gobuf_ret)(g)
4840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Assert ctxt is zero. See func save.
4850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(g_sched+gobuf_ctxt)(g), R0
4860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	$0, R0
4870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	2(PC)
4880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·badctxt(SB)
4890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
4900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// func asmcgocall(fn, arg unsafe.Pointer) int32
4920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Call fn(arg) on the scheduler stack,
4930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// aligned appropriately for the gcc ABI.
4940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// See cgocall.go for more details.
4950754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT ·asmcgocall(SB),NOSPLIT,$0-20
4960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	fn+0(FP), R1
4970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	arg+8(FP), R0
4980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	RSP, R2		// save original stack pointer
5000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g, R4
5010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Figure out if we need to switch to m->g0 stack.
5030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// We get called to create new OS threads too, and those
5040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// come in on the m->g0 stack already.
5050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g_m(g), R8
5060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	m_g0(R8), R3
5070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R3, g
5080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	g0
5090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, R9	// gosave<> and save_g might clobber R0
5100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	gosave<>(SB)
5110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R3, g
5120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·save_g(SB)
5130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(g_sched+gobuf_sp)(g), R0
5140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, RSP
5150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R9, R0
5160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Now on a scheduling stack (a pthread-created stack).
5180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotg0:
5190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Save room for two of our pointers /*, plus 32 bytes of callee
5200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// save area that lives on the caller stack. */
5210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	RSP, R13
5220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUB	$16, R13
5230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R13, RSP
5240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R4, 0(RSP)	// save old g on stack
5250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(g_stack+stack_hi)(R4), R4
5260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUB	R2, R4
5270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R4, 8(RSP)	// save depth in old g stack (can't just save SP, as stack might be copied during a callback)
5280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	(R1)
5290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, R9
5300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Restore g, stack pointer. R0 is errno, so don't touch it
5320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	0(RSP), g
5330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·save_g(SB)
5340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(g_stack+stack_hi)(g), R5
5350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	8(RSP), R6
5360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUB	R6, R5
5370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R9, R0
5380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R5, RSP
5390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	R0, ret+16(FP)
5410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
5420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// cgocallback(void (*fn)(void*), void *frame, uintptr framesize, uintptr ctxt)
5440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Turn the fn into a Go func (by taking its address) and call
5450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// cgocallback_gofunc.
5460754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·cgocallback(SB),NOSPLIT,$40-32
5470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$fn+0(FP), R0
5480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, 8(RSP)
5490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	frame+8(FP), R0
5500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, 16(RSP)
5510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	framesize+16(FP), R0
5520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, 24(RSP)
5530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	ctxt+24(FP), R0
5540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, 32(RSP)
5550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$runtime·cgocallback_gofunc(SB), R0
5560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	(R0)
5570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
5580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// cgocallback_gofunc(FuncVal*, void *frame, uintptr framesize, uintptr ctxt)
5600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// See cgocall.go for more details.
5610754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT ·cgocallback_gofunc(SB),NOSPLIT,$24-32
5620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	NO_LOCAL_POINTERS
5630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Load g from thread-local storage.
5650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	runtime·iscgo(SB), R3
5660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	$0, R3
5670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	nocgo
5680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·load_g(SB)
5690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotnocgo:
5700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// If g is nil, Go did not create the current thread.
5720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Call needm to obtain one for temporary use.
5730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// In this case, we're running on the thread stack, so there's
5740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// lots of space, but the linker doesn't know. Hide the call from
5750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// the linker analysis by using an indirect call.
5760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	$0, g
5770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	needm
5780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g_m(g), R8
5800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R8, savedm-8(SP)
5810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	havem
5820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotneedm:
5840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g, savedm-8(SP) // g is zero, so is m.
5850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$runtime·needm(SB), R0
5860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	(R0)
5870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Set m->sched.sp = SP, so that if a panic happens
5890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// during the function we are about to execute, it will
5900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// have a valid SP to run on the g0 stack.
5910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// The next few lines (after the havem label)
5920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// will save this SP onto the stack and then write
5930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// the same SP back to m->sched.sp. That seems redundant,
5940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// but if an unrecovered panic happens, unwindm will
5950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// restore the g->sched.sp from the stack location
5960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// and then systemstack will try to use it. If we don't set it here,
5970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// that restored SP will be uninitialized (typically 0) and
5980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// will not be usable.
5990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g_m(g), R8
6000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	m_g0(R8), R3
6010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	RSP, R0
6020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, (g_sched+gobuf_sp)(R3)
6030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robothavem:
6050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Now there's a valid m, and we're running on its m->g0.
6060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Save current m->g0->sched.sp on stack and then set it to SP.
6070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Save current sp in m->g0->sched.sp in preparation for
6080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// switch back to m->curg stack.
6090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// NOTE: unwindm knows that the saved g->sched.sp is at 16(RSP) aka savedsp-16(SP).
6100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Beware that the frame size is actually 32.
6110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	m_g0(R8), R3
6120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(g_sched+gobuf_sp)(R3), R4
6130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R4, savedsp-16(SP)
6140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	RSP, R0
6150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, (g_sched+gobuf_sp)(R3)
6160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Switch to m->curg stack and call runtime.cgocallbackg.
6180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Because we are taking over the execution of m->curg
6190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// but *not* resuming what had been running, we need to
6200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// save that information (m->curg->sched) so we can restore it.
6210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// We can restore m->curg->sched.sp easily, because calling
6220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// runtime.cgocallbackg leaves SP unchanged upon return.
6230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// To save m->curg->sched.pc, we push it onto the stack.
6240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// This has the added benefit that it looks to the traceback
6250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// routine like cgocallbackg is going to return to that
6260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// PC (because the frame we allocate below has the same
6270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// size as cgocallback_gofunc's frame declared above)
6280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// so that the traceback will seamlessly trace back into
6290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// the earlier calls.
6300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	//
6310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// In the new goroutine, -8(SP) is unused (where SP refers to
6320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// m->curg's SP while we're setting it up, before we've adjusted it).
6330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	m_curg(R8), g
6340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·save_g(SB)
6350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(g_sched+gobuf_sp)(g), R4 // prepare stack as R4
6360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(g_sched+gobuf_pc)(g), R5
6370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R5, -(24+8)(R4)
6380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	ctxt+24(FP), R0
6390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, -(16+8)(R4)
6400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$-(24+8)(R4), R0 // maintain 16-byte SP alignment
6410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, RSP
6420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·cgocallbackg(SB)
6430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Restore g->sched (== m->curg->sched) from saved values.
6450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	0(RSP), R5
6460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R5, (g_sched+gobuf_pc)(g)
6470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	RSP, R4
6480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	$(24+8), R4, R4
6490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R4, (g_sched+gobuf_sp)(g)
6500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Switch back to m->g0's stack and restore m->g0->sched.sp.
6520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// (Unlike m->curg, the g0 goroutine never uses sched.pc,
6530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// so we do not have to restore it.)
6540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g_m(g), R8
6550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	m_g0(R8), g
6560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·save_g(SB)
6570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(g_sched+gobuf_sp)(g), R0
6580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, RSP
6590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	savedsp-16(SP), R4
6600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R4, (g_sched+gobuf_sp)(g)
6610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// If the m on entry was nil, we called needm above to borrow an m
6630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// for the duration of the call. Since the call is over, return it with dropm.
6640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	savedm-8(SP), R6
6650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	$0, R6
6660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BNE	droppedm
6670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$runtime·dropm(SB), R0
6680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	(R0)
6690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotdroppedm:
6700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Done!
6720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
6730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Called from cgo wrappers, this function returns g->m->curg.stack.hi.
6750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Must obey the gcc calling convention.
6760754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT _cgo_topofstack(SB),NOSPLIT,$24
6770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// g (R28) and REGTMP (R27)  might be clobbered by load_g. They
6780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// are callee-save in the gcc calling convention, so save them.
6790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R27, savedR27-8(SP)
6800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g, saveG-16(SP)
6810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·load_g(SB)
6830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	g_m(g), R0
6840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	m_curg(R0), R0
6850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	(g_stack+stack_hi)(R0), R0
6860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	saveG-16(SP), g
6880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	savedR28-8(SP), R27
6890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
6900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// void setg(G*); set g. for use by needm.
6920754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·setg(SB), NOSPLIT, $0-8
6930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	gg+0(FP), g
6940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// This only happens if iscgo, so jump straight to save_g
6950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·save_g(SB)
6960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
6970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// void setg_gcc(G*); set g called from gcc
6990754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT setg_gcc<>(SB),NOSPLIT,$8
7000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, g
7010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R27, savedR27-8(SP)
7020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·save_g(SB)
7030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	savedR27-8(SP), R27
7040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
7050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7060754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·getcallerpc(SB),NOSPLIT,$-8-8
7070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	0(RSP), R0		// LR saved by caller
7080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, ret+0(FP)
7090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
7100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7110754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·abort(SB),NOSPLIT,$-8-0
7120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	(ZR)
7130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	UNDEF
7140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// memequal(a, b unsafe.Pointer, size uintptr) bool
7160754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·memequal(SB),NOSPLIT,$-8-25
7170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	size+16(FP), R1
7180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// short path to handle 0-byte case
7190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R1, equal
7200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	a+0(FP), R0
7210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	b+8(FP), R2
7220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$ret+24(FP), R8
7230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	runtime·memeqbody<>(SB)
7240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotequal:
7250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$1, R0
7260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	R0, ret+24(FP)
7270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
7280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// memequal_varlen(a, b unsafe.Pointer) bool
7300754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·memequal_varlen(SB),NOSPLIT,$40-17
7310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	a+0(FP), R3
7320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	b+8(FP), R4
7330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R3, R4
7340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	eq
7350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	8(R26), R5    // compiler stores size at offset 8 in the closure
7360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R3, 8(RSP)
7370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R4, 16(RSP)
7380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R5, 24(RSP)
7390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·memequal(SB)
7400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVBU	32(RSP), R3
7410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	R3, ret+16(FP)
7420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
7430754ce079d936daf401bbf49cb69a318aa79828android-build-team Roboteq:
7440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$1, R3
7450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	R3, ret+16(FP)
7460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
7470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7480754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·cmpstring(SB),NOSPLIT,$-4-40
7490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	s1_base+0(FP), R2
7500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	s1_len+8(FP), R0
7510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	s2_base+16(FP), R3
7520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	s2_len+24(FP), R1
7530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	$40, RSP, R7
7540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	runtime·cmpbody<>(SB)
7550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7560754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT bytes·Compare(SB),NOSPLIT,$-4-56
7570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	s1+0(FP), R2
7580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	s1+8(FP), R0
7590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	s2+24(FP), R3
7600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	s2+32(FP), R1
7610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	$56, RSP, R7
7620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	runtime·cmpbody<>(SB)
7630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// On entry:
7650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// R0 is the length of s1
7660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// R1 is the length of s2
7670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// R2 points to the start of s1
7680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// R3 points to the start of s2
7690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// R7 points to return value (-1/0/1 will be written here)
7700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//
7710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// On exit:
7720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// R4, R5, and R6 are clobbered
7730754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·cmpbody<>(SB),NOSPLIT,$-4-0
7740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R2, R3
7750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	samebytes // same starting pointers; compare lengths
7760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R0, R1
7770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CSEL    LT, R1, R0, R6 // R6 is min(R0, R1)
7780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	R2, R6	// R2 is current byte in s1, R6 is last byte in s1 to compare
7800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotloop:
7810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R2, R6
7820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	samebytes // all compared bytes were the same; compare lengths
7830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVBU.P	1(R2), R4
7840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVBU.P	1(R3), R5
7850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R4, R5
7860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	loop
7870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// bytes differed
7880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$1, R4
7890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CSNEG	LT, R4, R4, R4
7900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R4, (R7)
7910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
7920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotsamebytes:
7930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$1, R4
7940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R0, R1
7950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CSNEG	LT, R4, R4, R4
7960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CSEL	EQ, ZR, R4, R4
7970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R4, (R7)
7980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
7990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//
8010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// functions for other packages
8020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//
8030754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT bytes·IndexByte(SB),NOSPLIT,$0-40
8040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	b+0(FP), R0
8050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	b_len+8(FP), R2
8060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVBU	c+24(FP), R1
8070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$ret+32(FP), R8
8080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	runtime·indexbytebody<>(SB)
8090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8100754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT strings·IndexByte(SB),NOSPLIT,$0-32
8110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	s+0(FP), R0
8120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	s_len+8(FP), R2
8130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVBU	c+16(FP), R1
8140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$ret+24(FP), R8
8150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	runtime·indexbytebody<>(SB)
8160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// input:
8180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//   R0: data
8190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//   R1: byte to search
8200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//   R2: data len
8210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//   R8: address to put result
8220754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·indexbytebody<>(SB),NOSPLIT,$0
8230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Core algorithm:
8240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// For each 32-byte chunk we calculate a 64-bit syndrome value,
8250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// with two bits per byte. For each tuple, bit 0 is set if the
8260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// relevant byte matched the requested character and bit 1 is
8270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// not used (faster than using a 32bit syndrome). Since the bits
8280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// in the syndrome reflect exactly the order in which things occur
8290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// in the original string, counting trailing zeros allows to
8300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// identify exactly which byte has matched.
8310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R2, fail
8330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, R11
8340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Magic constant 0x40100401 allows us to identify
8350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// which lane matches the requested byte.
8360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// 0x40100401 = ((1<<0) + (4<<8) + (16<<16) + (64<<24))
8370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Different bytes have different bit masks (i.e: 1, 4, 16, 64)
8380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$0x40100401, R5
8390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VMOV	R1, V0.B16
8400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Work with aligned 32-byte chunks
8410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BIC	$0x1f, R0, R3
8420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VMOV	R5, V5.S4
8430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ANDS	$0x1f, R0, R9
8440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AND	$0x1f, R2, R10
8450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	loop
8460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Input string is not 32-byte aligned. We calculate the
8480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// syndrome value for the aligned 32 bytes block containing
8490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// the first bytes and mask off the irrelevant part.
8500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VLD1.P	(R3), [V1.B16, V2.B16]
8510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUB	$0x20, R9, R4
8520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDS	R4, R2, R2
8530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VCMEQ	V0.B16, V1.B16, V3.B16
8540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VCMEQ	V0.B16, V2.B16, V4.B16
8550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VAND	V5.B16, V3.B16, V3.B16
8560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VAND	V5.B16, V4.B16, V4.B16
8570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VADDP	V4.B16, V3.B16, V6.B16 // 256->128
8580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VADDP	V6.B16, V6.B16, V6.B16 // 128->64
8590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VMOV	V6.D[0], R6
8600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Clear the irrelevant lower bits
8610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LSL	$1, R9, R4
8620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LSR	R4, R6, R6
8630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LSL	R4, R6, R6
8640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// The first block can also be the last
8650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BLS	masklast
8660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Have we found something already?
8670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBNZ	R6, tail
8680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotloop:
8700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VLD1.P	(R3), [V1.B16, V2.B16]
8710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBS	$0x20, R2, R2
8720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VCMEQ	V0.B16, V1.B16, V3.B16
8730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VCMEQ	V0.B16, V2.B16, V4.B16
8740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// If we're out of data we finish regardless of the result
8750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BLS	end
8760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Use a fast check for the termination condition
8770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VORR	V4.B16, V3.B16, V6.B16
8780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VADDP	V6.D2, V6.D2, V6.D2
8790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VMOV	V6.D[0], R6
8800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// We're not out of data, loop if we haven't found the character
8810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R6, loop
8820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotend:
8840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Termination condition found, let's calculate the syndrome value
8850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VAND	V5.B16, V3.B16, V3.B16
8860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VAND	V5.B16, V4.B16, V4.B16
8870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VADDP	V4.B16, V3.B16, V6.B16
8880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VADDP	V6.B16, V6.B16, V6.B16
8890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VMOV	V6.D[0], R6
8900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Only do the clear for the last possible block with less than 32 bytes
8910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Condition flags come from SUBS in the loop
8920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BHS	tail
8930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotmasklast:
8950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Clear the irrelevant upper bits
8960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	R9, R10, R4
8970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AND	$0x1f, R4, R4
8980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUB	$0x20, R4, R4
8990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	NEG	R4<<1, R4
9000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LSL	R4, R6, R6
9010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LSR	R4, R6, R6
9020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robottail:
9040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Check that we have found a character
9050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R6, fail
9060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Count the trailing zeros using bit reversing
9070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RBIT	R6, R6
9080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Compensate the last post-increment
9090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUB	$0x20, R3, R3
9100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// And count the leading zeros
9110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CLZ	R6, R6
9120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// R6 is twice the offset into the fragment
9130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	R6>>1, R3, R0
9140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Compute the offset result
9150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUB	R11, R0, R0
9160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, (R8)
9170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
9180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotfail:
9200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$-1, R0
9210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, (R8)
9220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
9230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Equal(a, b []byte) bool
9250754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT bytes·Equal(SB),NOSPLIT,$0-49
9260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	a_len+8(FP), R1
9270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	b_len+32(FP), R3
9280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R1, R3
9290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// unequal lengths are not equal
9300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BNE	not_equal
9310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// short path to handle 0-byte case
9320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R1, equal
9330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	a+0(FP), R0
9340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	b+24(FP), R2
9350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$ret+48(FP), R8
9360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	B	runtime·memeqbody<>(SB)
9370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotequal:
9380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$1, R0
9390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	R0, ret+48(FP)
9400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
9410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotnot_equal:
9420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	ZR, ret+48(FP)
9430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
9440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// input:
9460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// R0: pointer a
9470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// R1: data len
9480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// R2: pointer b
9490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// R8: address to put result
9500754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·memeqbody<>(SB),NOSPLIT,$0
9510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	$1, R1
9520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// handle 1-byte special case for better performance
9530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BEQ	one
9540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	$16, R1
9550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// handle specially if length < 16
9560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BLO	tail
9570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BIC	$0x3f, R1, R3
9580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R3, chunk16
9590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// work with 64-byte chunks
9600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	R3, R0, R6	// end of chunks
9610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotchunk64_loop:
9620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VLD1.P	(R0), [V0.D2, V1.D2, V2.D2, V3.D2]
9630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VLD1.P	(R2), [V4.D2, V5.D2, V6.D2, V7.D2]
9640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VCMEQ	V0.D2, V4.D2, V8.D2
9650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VCMEQ	V1.D2, V5.D2, V9.D2
9660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VCMEQ	V2.D2, V6.D2, V10.D2
9670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VCMEQ	V3.D2, V7.D2, V11.D2
9680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VAND	V8.B16, V9.B16, V8.B16
9690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VAND	V8.B16, V10.B16, V8.B16
9700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VAND	V8.B16, V11.B16, V8.B16
9710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R0, R6
9720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VMOV	V8.D[0], R4
9730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VMOV	V8.D[1], R5
9740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R4, not_equal
9750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R5, not_equal
9760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BNE	chunk64_loop
9770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AND	$0x3f, R1, R1
9780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R1, equal
9790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotchunk16:
9800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// work with 16-byte chunks
9810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BIC	$0xf, R1, R3
9820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R3, tail
9830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	R3, R0, R6	// end of chunks
9840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotchunk16_loop:
9850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VLD1.P	(R0), [V0.D2]
9860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VLD1.P	(R2), [V1.D2]
9870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VCMEQ	V0.D2, V1.D2, V2.D2
9880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R0, R6
9890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VMOV	V2.D[0], R4
9900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	VMOV	V2.D[1], R5
9910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R4, not_equal
9920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R5, not_equal
9930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BNE	chunk16_loop
9940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AND	$0xf, R1, R1
9950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CBZ	R1, equal
9960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robottail:
9970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// special compare of tail with length < 16
9980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TBZ	$3, R1, lt_8
9990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD.P	8(R0), R4
10000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD.P	8(R2), R5
10010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R4, R5
10020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BNE	not_equal
10030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotlt_8:
10040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TBZ	$2, R1, lt_4
10050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVWU.P	4(R0), R4
10060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVWU.P	4(R2), R5
10070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R4, R5
10080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BNE	not_equal
10090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotlt_4:
10100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TBZ	$1, R1, lt_2
10110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVHU.P	2(R0), R4
10120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVHU.P	2(R2), R5
10130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R4, R5
10140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BNE	not_equal
10150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotlt_2:
10160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TBZ     $0, R1, equal
10170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotone:
10180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVBU	(R0), R4
10190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVBU	(R2), R5
10200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMP	R4, R5
10210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BNE	not_equal
10220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotequal:
10230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	$1, R0
10240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	R0, (R8)
10250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
10260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotnot_equal:
10270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	ZR, (R8)
10280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
10290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10300754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·return0(SB), NOSPLIT, $0
10310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	$0, R0
10320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
10330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// The top-most function running on a goroutine
10350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// returns to goexit+PCQuantum.
10360754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·goexit(SB),NOSPLIT,$-8-0
10370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, R0	// NOP
10380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BL	runtime·goexit1(SB)	// does not return
10390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10400754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·sigreturn(SB),NOSPLIT,$0-0
10410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
10420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// This is called from .init_array and follows the platform, not Go, ABI.
10440754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·addmoduledata(SB),NOSPLIT,$0-0
10450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUB	$0x10, RSP
10460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R27, 8(RSP) // The access to global variables below implicitly uses R27, which is callee-save
10470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	runtime·lastmoduledatap(SB), R1
10480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, moduledata_next(R1)
10490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	R0, runtime·lastmoduledatap(SB)
10500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVD	8(RSP), R27
10510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADD	$0x10, RSP
10520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
10530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10540754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT ·checkASM(SB),NOSPLIT,$0-1
10550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVW	$1, R3
10560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	R3, ret+0(FP)
10570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
1058