10754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Copyright 2009 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 "funcdata.h"
80754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#include "textflag.h"
90754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// _rt0_386 is common startup code for most 386 systems when using
110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// internal linking. This is the entry point for the program from the
120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// kernel for an ordinary -buildmode=exe program. The stack holds the
130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// number of arguments and the C-style argv.
140754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT _rt0_386(SB),NOSPLIT,$8
150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	8(SP), AX	// argc
160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	12(SP), BX	// argv
170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 0(SP)
180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, 4(SP)
190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	runtime·rt0_go(SB)
200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// _rt0_386_lib is common startup code for most 386 systems when
220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// using -buildmode=c-archive or -buildmode=c-shared. The linker will
230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// arrange to invoke this function as a global constructor (for
240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// c-archive) or when the shared library is loaded (for c-shared).
250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// We expect argc and argv to be passed on the stack following the
260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// usual C ABI.
270754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT _rt0_386_lib(SB),NOSPLIT,$0
280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PUSHL	BP
290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SP, BP
300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PUSHL	BX
310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PUSHL	SI
320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PUSHL	DI
330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	8(BP), AX
350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, _rt0_386_lib_argc<>(SB)
360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	12(BP), AX
370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, _rt0_386_lib_argv<>(SB)
380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Synchronous initialization.
400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·libpreinit(SB)
410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	$8, SP
430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Create a new thread to do the runtime initialization.
450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	_cgo_sys_thread_create(SB), AX
460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	AX, AX
470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JZ	nocgo
480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Align stack to call C function.
500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// We moved SP to BP above, but BP was clobbered by the libpreinit call.
510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SP, BP
520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ANDL	$~15, SP
530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$_rt0_386_lib_go(SB), BX
550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, 0(SP)
560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, 4(SP)
570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	AX
590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BP, SP
610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	restore
630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotnocgo:
650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0x800000, 0(SP)                    // stacksize = 8192KB
660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$_rt0_386_lib_go(SB), AX
670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 4(SP)                           // fn
680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·newosproc0(SB)
690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotrestore:
710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	$8, SP
720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	POPL	DI
730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	POPL	SI
740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	POPL	BX
750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	POPL	BP
760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// _rt0_386_lib_go initializes the Go runtime.
790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// This is started in a separate thread by _rt0_386_lib.
800754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT _rt0_386_lib_go(SB),NOSPLIT,$8
810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	_rt0_386_lib_argc<>(SB), AX
820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 0(SP)
830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	_rt0_386_lib_argv<>(SB), AX
840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 4(SP)
850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	runtime·rt0_go(SB)
860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
870754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA _rt0_386_lib_argc<>(SB)/4, $0
880754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotGLOBL _rt0_386_lib_argc<>(SB),NOPTR, $4
890754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA _rt0_386_lib_argv<>(SB)/4, $0
900754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotGLOBL _rt0_386_lib_argv<>(SB),NOPTR, $4
910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
920754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·rt0_go(SB),NOSPLIT,$0
930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Copy arguments forward on an even stack.
940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Users of this function jump to it, they don't call it.
950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	0(SP), AX
960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	4(SP), BX
970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	$128, SP		// plenty of scratch
980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ANDL	$~15, SP
990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 120(SP)		// save argc, argv away
1000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, 124(SP)
1010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// set default stack bounds.
1030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// _cgo_init may update stackguard.
1040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$runtime·g0(SB), BP
1050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	(-64*1024+104)(SP), BX
1060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, g_stackguard0(BP)
1070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, g_stackguard1(BP)
1080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, (g_stack+stack_lo)(BP)
1090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SP, (g_stack+stack_hi)(BP)
1100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// find out information about the processor we're on
1120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#ifdef GOOS_nacl // NaCl doesn't like PUSHFL/POPFL
1130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP 	has_cpuid
1140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#else
1150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// first see if CPUID instruction is supported.
1160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PUSHFL
1170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PUSHFL
1180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	XORL	$(1<<21), 0(SP) // flip ID bit
1190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	POPFL
1200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PUSHFL
1210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	POPL	AX
1220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	XORL	0(SP), AX
1230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	POPFL	// restore EFLAGS
1240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$(1<<21), AX
1250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE 	has_cpuid
1260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#endif
1270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotbad_proc: // show that the program requires MMX.
1290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$2, 0(SP)
1300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$bad_proc_msg<>(SB), 4(SP)
1310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0x3d, 8(SP)
1320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·write(SB)
1330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$1, 0(SP)
1340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·exit(SB)
1350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	INT	$3
1360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robothas_cpuid:
1380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, AX
1390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CPUID
1400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, SI
1410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	AX, $0
1420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JE	nocpuinfo
1430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Figure out how to serialize RDTSC.
1450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// On Intel processors LFENCE is enough. AMD requires MFENCE.
1460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Don't know about the rest, so let's do MFENCE.
1470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BX, $0x756E6547  // "Genu"
1480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	notintel
1490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	DX, $0x49656E69  // "ineI"
1500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	notintel
1510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	CX, $0x6C65746E  // "ntel"
1520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	notintel
1530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	$1, runtime·isIntel(SB)
1540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	$1, runtime·lfenceBeforeRdtsc(SB)
1550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotnotintel:
1560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Load EAX=1 cpuid flags
1580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$1, AX
1590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CPUID
1600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	CX, DI // Move to global variable clobbers CX when generating PIC
1610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, runtime·processorVersionInfo(SB)
1620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Check for MMX support
1640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$(1<<23), DX // MMX
1650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JZ	bad_proc
1660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$(1<<26), DX // SSE2
1680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETNE	runtime·support_sse2(SB)
1690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$(1<<9), DI // SSSE3
1710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETNE	runtime·support_ssse3(SB)
1720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$(1<<19), DI // SSE4.1
1740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETNE	runtime·support_sse41(SB)
1750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$(1<<20), DI // SSE4.2
1770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETNE	runtime·support_sse42(SB)
1780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$(1<<23), DI // POPCNT
1800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETNE	runtime·support_popcnt(SB)
1810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$(1<<25), DI // AES
1830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETNE	runtime·support_aes(SB)
1840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$(1<<27), DI // OSXSAVE
1860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETNE	runtime·support_osxsave(SB)
1870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// If OS support for XMM and YMM is not present
1890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// support_avx will be set back to false later.
1900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$(1<<28), DI // AVX
1910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETNE	runtime·support_avx(SB)
1920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
1930754ce079d936daf401bbf49cb69a318aa79828android-build-team Roboteax7:
1940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Load EAX=7/ECX=0 cpuid flags
1950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	SI, $7
1960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JLT	osavx
1970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$7, AX
1980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, CX
1990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CPUID
2000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$(1<<3), BX // BMI1
2020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETNE	runtime·support_bmi1(SB)
2030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// If OS support for XMM and YMM is not present
2050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// support_avx2 will be set back to false later.
2060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$(1<<5), BX
2070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETNE	runtime·support_avx2(SB)
2080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$(1<<8), BX // BMI2
2100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETNE	runtime·support_bmi2(SB)
2110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$(1<<9), BX // ERMS
2130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETNE	runtime·support_erms(SB)
2140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotosavx:
2160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// nacl does not support XGETBV to test
2170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// for XMM and YMM OS support.
2180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#ifndef GOOS_nacl
2190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPB	runtime·support_osxsave(SB), $1
2200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	noavx
2210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, CX
2220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// For XGETBV, OSXSAVE bit is required and sufficient
2230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	XGETBV
2240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ANDL	$6, AX
2250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	AX, $6 // Check for OS support of XMM and YMM registers.
2260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JE nocpuinfo
2270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#endif
2280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotnoavx:
2290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB $0, runtime·support_avx(SB)
2300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB $0, runtime·support_avx2(SB)
2310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotnocpuinfo:
2330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// if there is an _cgo_init, call it to let it
2340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// initialize and to set up GS.  if not,
2350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// we set up GS ourselves.
2360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	_cgo_init(SB), AX
2370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	AX, AX
2380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JZ	needtls
2390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$setg_gcc<>(SB), BX
2400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, 4(SP)
2410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BP, 0(SP)
2420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	AX
2430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// update stackguard after _cgo_init
2450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$runtime·g0(SB), CX
2460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(g_stack+stack_lo)(CX), AX
2470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	$const__StackGuard, AX
2480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, g_stackguard0(CX)
2490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, g_stackguard1(CX)
2500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#ifndef GOOS_windows
2520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// skip runtime·ldt0setup(SB) and tls test after _cgo_init for non-windows
2530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP ok
2540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#endif
2550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotneedtls:
2560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#ifdef GOOS_plan9
2570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// skip runtime·ldt0setup(SB) and tls test on Plan 9 in all cases
2580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	ok
2590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#endif
2600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// set up %gs
2620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·ldt0setup(SB)
2630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// store through it, to make sure it works
2650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(BX)
2660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0x123, g(BX)
2670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	runtime·m0+m_tls(SB), AX
2680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	AX, $0x123
2690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	ok
2700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 0	// abort
2710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotok:
2720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// set up m and g "registers"
2730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(BX)
2740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	runtime·g0(SB), DX
2750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DX, g(BX)
2760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	runtime·m0(SB), AX
2770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// save m->g0 = g0
2790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DX, m_g0(AX)
2800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// save g0->m = m0
2810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, g_m(DX)
2820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·emptyfunc(SB)	// fault if stack check is wrong
2840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// convention is D is always cleared
2860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CLD
2870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·check(SB)
2890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// saved argc, argv
2910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	120(SP), AX
2920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 0(SP)
2930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	124(SP), AX
2940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 4(SP)
2950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·args(SB)
2960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·osinit(SB)
2970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·schedinit(SB)
2980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
2990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// create a new goroutine to start program
3000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PUSHL	$runtime·mainPC(SB)	// entry
3010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PUSHL	$0	// arg size
3020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·newproc(SB)
3030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	POPL	AX
3040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	POPL	AX
3050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// start this M
3070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·mstart(SB)
3080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	INT $3
3100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
3110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3120754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA	bad_proc_msg<>+0x00(SB)/8, $"This pro"
3130754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA	bad_proc_msg<>+0x08(SB)/8, $"gram can"
3140754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA	bad_proc_msg<>+0x10(SB)/8, $" only be"
3150754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA	bad_proc_msg<>+0x18(SB)/8, $" run on "
3160754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA	bad_proc_msg<>+0x20(SB)/8, $"processo"
3170754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA	bad_proc_msg<>+0x28(SB)/8, $"rs with "
3180754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA	bad_proc_msg<>+0x30(SB)/8, $"MMX supp"
3190754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA	bad_proc_msg<>+0x38(SB)/4, $"ort."
3200754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA	bad_proc_msg<>+0x3c(SB)/1, $0xa
3210754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotGLOBL	bad_proc_msg<>(SB), RODATA, $0x3d
3220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3230754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA	runtime·mainPC+0(SB)/4,$runtime·main(SB)
3240754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotGLOBL	runtime·mainPC(SB),RODATA,$4
3250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3260754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·breakpoint(SB),NOSPLIT,$0-0
3270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	INT $3
3280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
3290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3300754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·asminit(SB),NOSPLIT,$0-0
3310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Linux and MinGW start the FPU in extended double precision.
3320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Other operating systems use double precision.
3330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Change to double precision to match them,
3340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// and to match other hardware that only has double.
3350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	FLDCW	runtime·controlWord64(SB)
3360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
3370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot/*
3390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot *  go-routine
3400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot */
3410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// void gosave(Gobuf*)
3430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// save state in Gobuf; setjmp
3440754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·gosave(SB), NOSPLIT, $0-4
3450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	buf+0(FP), AX		// gobuf
3460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	buf+0(FP), BX		// caller's SP
3470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, gobuf_sp(AX)
3480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	0(SP), BX		// caller's PC
3490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, gobuf_pc(AX)
3500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, gobuf_ret(AX)
3510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Assert ctxt is zero. See func save.
3520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	gobuf_ctxt(AX), BX
3530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	BX, BX
3540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JZ	2(PC)
3550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·badctxt(SB)
3560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
3570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(CX), BX
3580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, gobuf_g(AX)
3590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
3600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// void gogo(Gobuf*)
3620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// restore state from Gobuf; longjmp
3630754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·gogo(SB), NOSPLIT, $8-4
3640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	buf+0(FP), BX		// gobuf
3650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	gobuf_g(BX), DX
3660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	0(DX), CX		// make sure g != nil
3670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
3680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DX, g(CX)
3690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	gobuf_sp(BX), SP	// restore SP
3700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	gobuf_ret(BX), AX
3710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	gobuf_ctxt(BX), DX
3720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, gobuf_sp(BX)	// clear to help garbage collector
3730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, gobuf_ret(BX)
3740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, gobuf_ctxt(BX)
3750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	gobuf_pc(BX), BX
3760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	BX
3770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// func mcall(fn func(*g))
3790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Switch to m->g0's stack, call fn(g).
3800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Fn must never return. It should gogo(&g->sched)
3810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// to keep running g.
3820754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·mcall(SB), NOSPLIT, $0-4
3830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	fn+0(FP), DI
3840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(DX)
3860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(DX), AX	// save state in g->sched
3870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	0(SP), BX	// caller's PC
3880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, (g_sched+gobuf_pc)(AX)
3890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	fn+0(FP), BX	// caller's SP
3900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, (g_sched+gobuf_sp)(AX)
3910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, (g_sched+gobuf_g)(AX)
3920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
3930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// switch to m->g0 & its stack, call fn
3940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(DX), BX
3950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g_m(BX), BX
3960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	m_g0(BX), SI
3970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	SI, AX	// if g == m->g0 call badmcall
3980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	3(PC)
3990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$runtime·badmcall(SB), AX
4000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	AX
4010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SI, g(DX)	// g = m->g0
4020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(g_sched+gobuf_sp)(SI), SP	// sp = m->g0->sched.sp
4030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PUSHL	AX
4040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DI, DX
4050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	0(DI), DI
4060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	DI
4070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	POPL	AX
4080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$runtime·badmcall2(SB), AX
4090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	AX
4100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
4110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// systemstack_switch is a dummy routine that systemstack leaves at the bottom
4130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// of the G stack. We need to distinguish the routine that
4140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// lives at the bottom of the G stack from the one that lives
4150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// at the top of the system stack because the one at the top of
4160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// the system stack terminates the stack walk (see topofstack()).
4170754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·systemstack_switch(SB), NOSPLIT, $0-0
4180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
4190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// func systemstack(fn func())
4210754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·systemstack(SB), NOSPLIT, $0-4
4220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	fn+0(FP), DI	// DI = fn
4230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
4240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(CX), AX	// AX = g
4250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g_m(AX), BX	// BX = m
4260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	m_gsignal(BX), DX	// DX = gsignal
4280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	AX, DX
4290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	noswitch
4300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	m_g0(BX), DX	// DX = g0
4320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	AX, DX
4330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	noswitch
4340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	m_curg(BX), BP
4360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	AX, BP
4370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	switch
4380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Bad: g is not gsignal, not g0, not curg. What is it?
4400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Hide call from linker nosplit analysis.
4410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$runtime·badsystemstack(SB), AX
4420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	AX
4430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotswitch:
4450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// save our state in g->sched. Pretend to
4460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// be systemstack_switch if the G stack is scanned.
4470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$runtime·systemstack_switch(SB), (g_sched+gobuf_pc)(AX)
4480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SP, (g_sched+gobuf_sp)(AX)
4490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, (g_sched+gobuf_g)(AX)
4500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// switch to g0
4520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
4530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DX, g(CX)
4540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(g_sched+gobuf_sp)(DX), BX
4550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// make it look like mstart called systemstack on g0, to stop traceback
4560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	$4, BX
4570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$runtime·mstart(SB), DX
4580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DX, 0(BX)
4590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, SP
4600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// call target function
4620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DI, DX
4630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	0(DI), DI
4640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	DI
4650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// switch back to g
4670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
4680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(CX), AX
4690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g_m(AX), BX
4700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	m_curg(BX), AX
4710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, g(CX)
4720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(g_sched+gobuf_sp)(AX), SP
4730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, (g_sched+gobuf_sp)(AX)
4740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
4750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotnoswitch:
4770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// already on system stack; tail call the function
4780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Using a tail call here cleans up tracebacks since we won't stop
4790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// at an intermediate systemstack.
4800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DI, DX
4810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	0(DI), DI
4820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	DI
4830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot/*
4850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot * support for morestack
4860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot */
4870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
4880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Called during function prolog when more stack is needed.
4890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//
4900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// The traceback routines see morestack on a g0 as being
4910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// the top of a stack (for example, morestack calling newstack
4920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// calling the scheduler calling newm calling gc), so we must
4930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// record an argument size. For that purpose, it has no arguments.
4940754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·morestack(SB),NOSPLIT,$0-0
4950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Cannot grow scheduler stack (m->g0).
4960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
4970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(CX), BX
4980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g_m(BX), BX
4990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	m_g0(BX), SI
5000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	g(CX), SI
5010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	3(PC)
5020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·badmorestackg0(SB)
5030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	INT	$3
5040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Cannot grow signal stack.
5060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	m_gsignal(BX), SI
5070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	g(CX), SI
5080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	3(PC)
5090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·badmorestackgsignal(SB)
5100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	INT	$3
5110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Called from f.
5130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Set m->morebuf to f's caller.
5140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	4(SP), DI	// f's caller's PC
5150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DI, (m_morebuf+gobuf_pc)(BX)
5160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	8(SP), CX	// f's caller's SP
5170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	CX, (m_morebuf+gobuf_sp)(BX)
5180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
5190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(CX), SI
5200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SI, (m_morebuf+gobuf_g)(BX)
5210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Set g->sched to context in f.
5230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	0(SP), AX	// f's PC
5240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, (g_sched+gobuf_pc)(SI)
5250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SI, (g_sched+gobuf_g)(SI)
5260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	4(SP), AX	// f's SP
5270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, (g_sched+gobuf_sp)(SI)
5280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DX, (g_sched+gobuf_ctxt)(SI)
5290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Call newstack on m->g0's stack.
5310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	m_g0(BX), BP
5320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BP, g(CX)
5330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(g_sched+gobuf_sp)(BP), AX
5340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	-4(AX), BX	// fault if CALL would, before smashing SP
5350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, SP
5360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·newstack(SB)
5370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, 0x1003	// crash if newstack returns
5380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
5390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5400754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·morestack_noctxt(SB),NOSPLIT,$0-0
5410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, DX
5420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP runtime·morestack(SB)
5430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// reflectcall: call a function with the given argument list
5450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32).
5460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// we don't have variable-sized frames, so we use a small number
5470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// of constant-sized-frame functions to encode a few bits of size in the pc.
5480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Caution: ugly multiline assembly macros in your future!
5490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#define DISPATCH(NAME,MAXSIZE)		\
5510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	CX, $MAXSIZE;		\
5520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JA	3(PC);			\
5530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$NAME(SB), AX;		\
5540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	AX
5550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Note: can't just "JMP NAME(SB)" - bad inlining results.
5560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5570754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT reflect·call(SB), NOSPLIT, $0-0
5580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	·reflectcall(SB)
5590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5600754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT ·reflectcall(SB), NOSPLIT, $0-20
5610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	argsize+12(FP), CX
5620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call16, 16)
5630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call32, 32)
5640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call64, 64)
5650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call128, 128)
5660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call256, 256)
5670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call512, 512)
5680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call1024, 1024)
5690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call2048, 2048)
5700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call4096, 4096)
5710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call8192, 8192)
5720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call16384, 16384)
5730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call32768, 32768)
5740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call65536, 65536)
5750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call131072, 131072)
5760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call262144, 262144)
5770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call524288, 524288)
5780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call1048576, 1048576)
5790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call2097152, 2097152)
5800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call4194304, 4194304)
5810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call8388608, 8388608)
5820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call16777216, 16777216)
5830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call33554432, 33554432)
5840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call67108864, 67108864)
5850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call134217728, 134217728)
5860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call268435456, 268435456)
5870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call536870912, 536870912)
5880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DISPATCH(runtime·call1073741824, 1073741824)
5890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$runtime·badreflectcall(SB), AX
5900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	AX
5910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
5920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#define CALLFN(NAME,MAXSIZE)			\
5930754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT NAME(SB), WRAPPER, $MAXSIZE-20;		\
5940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	NO_LOCAL_POINTERS;			\
5950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	/* copy arguments to stack */		\
5960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	argptr+8(FP), SI;		\
5970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	argsize+12(FP), CX;		\
5980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SP, DI;				\
5990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	REP;MOVSB;				\
6000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	/* call function */			\
6010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	f+4(FP), DX;			\
6020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(DX), AX; 			\
6030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PCDATA  $PCDATA_StackMapIndex, $0;	\
6040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	AX;				\
6050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	/* copy return values back */		\
6060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	argtype+0(FP), DX;		\
6070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	argptr+8(FP), DI;		\
6080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	argsize+12(FP), CX;		\
6090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	retoffset+16(FP), BX;		\
6100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SP, SI;				\
6110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	BX, DI;				\
6120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	BX, SI;				\
6130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	BX, CX;				\
6140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	callRet<>(SB);			\
6150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
6160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// callRet copies return values back at the end of call*. This is a
6180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// separate function so it can allocate stack space for the arguments
6190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// to reflectcallmove. It does not follow the Go ABI; it expects its
6200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// arguments in registers.
6210754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT callRet<>(SB), NOSPLIT, $16-0
6220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DX, 0(SP)
6230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DI, 4(SP)
6240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SI, 8(SP)
6250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	CX, 12(SP)
6260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·reflectcallmove(SB)
6270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
6280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6290754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall16, 16)
6300754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall32, 32)
6310754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall64, 64)
6320754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall128, 128)
6330754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall256, 256)
6340754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall512, 512)
6350754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall1024, 1024)
6360754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall2048, 2048)
6370754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall4096, 4096)
6380754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall8192, 8192)
6390754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall16384, 16384)
6400754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall32768, 32768)
6410754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall65536, 65536)
6420754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall131072, 131072)
6430754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall262144, 262144)
6440754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall524288, 524288)
6450754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall1048576, 1048576)
6460754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall2097152, 2097152)
6470754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall4194304, 4194304)
6480754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall8388608, 8388608)
6490754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall16777216, 16777216)
6500754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall33554432, 33554432)
6510754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall67108864, 67108864)
6520754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall134217728, 134217728)
6530754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall268435456, 268435456)
6540754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall536870912, 536870912)
6550754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotCALLFNcall1073741824, 1073741824)
6560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6570754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·procyield(SB),NOSPLIT,$0-0
6580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	cycles+0(FP), AX
6590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotagain:
6600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PAUSE
6610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	$1, AX
6620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNZ	again
6630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
6640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6650754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT ·publicationBarrier(SB),NOSPLIT,$0-0
6660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Stores are already ordered on x86, so this is just a
6670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// compile barrier.
6680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
6690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// void jmpdefer(fn, sp);
6710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// called from deferreturn.
6720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// 1. pop the caller
6730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// 2. sub 5 bytes (the length of CALL & a 32 bit displacement) from the callers
6740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//    return (when building for shared libraries, subtract 16 bytes -- 5 bytes
6750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//    for CALL & displacement to call __x86.get_pc_thunk.cx, 6 bytes for the
6760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//    LEAL to load the offset into BX, and finally 5 for the call & displacement)
6770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// 3. jmp to the argument
6780754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·jmpdefer(SB), NOSPLIT, $0-8
6790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	fv+0(FP), DX	// fn
6800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	argp+4(FP), BX	// caller sp
6810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	-4(BX), SP	// caller sp after CALL
6820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#ifdef GOBUILDMODE_shared
6830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	$16, (SP)	// return to CALL again
6840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#else
6850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	$5, (SP)	// return to CALL again
6860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#endif
6870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	0(DX), BX
6880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	BX	// but first run the deferred function
6890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
6900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Save state of caller into g->sched.
6910754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT gosave<>(SB),NOSPLIT,$0
6920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PUSHL	AX
6930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PUSHL	BX
6940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(BX)
6950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(BX), BX
6960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	arg+0(FP), AX
6970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, (g_sched+gobuf_sp)(BX)
6980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	-4(AX), AX
6990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, (g_sched+gobuf_pc)(BX)
7000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, (g_sched+gobuf_ret)(BX)
7010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Assert ctxt is zero. See func save.
7020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(g_sched+gobuf_ctxt)(BX), AX
7030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	AX, AX
7040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JZ	2(PC)
7050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·badctxt(SB)
7060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	POPL	BX
7070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	POPL	AX
7080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
7090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// func asmcgocall(fn, arg unsafe.Pointer) int32
7110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Call fn(arg) on the scheduler stack,
7120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// aligned appropriately for the gcc ABI.
7130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// See cgocall.go for more details.
7140754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT ·asmcgocall(SB),NOSPLIT,$0-12
7150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	fn+0(FP), AX
7160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	arg+4(FP), BX
7170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SP, DX
7190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Figure out if we need to switch to m->g0 stack.
7210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// We get called to create new OS threads too, and those
7220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// come in on the m->g0 stack already.
7230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
7240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(CX), BP
7250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g_m(BP), BP
7260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	m_g0(BP), SI
7270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(CX), DI
7280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	SI, DI
7290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	noswitch
7300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	gosave<>(SB)
7310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
7320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SI, g(CX)
7330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(g_sched+gobuf_sp)(SI), SP
7340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotnoswitch:
7360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Now on a scheduling stack (a pthread-created stack).
7370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	$32, SP
7380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ANDL	$~15, SP	// alignment, perhaps unnecessary
7390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DI, 8(SP)	// save g
7400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(g_stack+stack_hi)(DI), DI
7410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	DX, DI
7420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DI, 4(SP)	// save depth in stack (can't just save SP, as stack might be copied during a callback)
7430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, 0(SP)	// first argument in x86-32 ABI
7440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	AX
7450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Restore registers, g, stack pointer.
7470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
7480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	8(SP), DI
7490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(g_stack+stack_hi)(DI), SI
7500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	4(SP), SI
7510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DI, g(CX)
7520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SI, SP
7530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, ret+8(FP)
7550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
7560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// cgocallback(void (*fn)(void*), void *frame, uintptr framesize, uintptr ctxt)
7580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Turn the fn into a Go func (by taking its address) and call
7590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// cgocallback_gofunc.
7600754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·cgocallback(SB),NOSPLIT,$16-16
7610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	fn+0(FP), AX
7620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 0(SP)
7630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	frame+4(FP), AX
7640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 4(SP)
7650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	framesize+8(FP), AX
7660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 8(SP)
7670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	ctxt+12(FP), AX
7680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 12(SP)
7690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$runtime·cgocallback_gofunc(SB), AX
7700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	AX
7710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
7720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// cgocallback_gofunc(FuncVal*, void *frame, uintptr framesize, uintptr ctxt)
7740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// See cgocall.go for more details.
7750754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT ·cgocallback_gofunc(SB),NOSPLIT,$12-16
7760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	NO_LOCAL_POINTERS
7770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
7780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// If g is nil, Go did not create the current thread.
7790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Call needm to obtain one for temporary use.
7800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// In this case, we're running on the thread stack, so there's
7810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// lots of space, but the linker doesn't know. Hide the call from
7820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// the linker analysis by using an indirect call through AX.
7830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
7840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#ifdef GOOS_windows
7850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, BP
7860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	CX, $0
7870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	2(PC) // TODO
7880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#endif
7890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(CX), BP
7900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BP, $0
7910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	needm
7920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g_m(BP), BP
7930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BP, DX // saved copy of oldm
7940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	havem
7950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotneedm:
7960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, 0(SP)
7970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$runtime·needm(SB), AX
7980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	AX
7990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	0(SP), DX
8000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
8010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(CX), BP
8020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g_m(BP), BP
8030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Set m->sched.sp = SP, so that if a panic happens
8050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// during the function we are about to execute, it will
8060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// have a valid SP to run on the g0 stack.
8070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// The next few lines (after the havem label)
8080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// will save this SP onto the stack and then write
8090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// the same SP back to m->sched.sp. That seems redundant,
8100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// but if an unrecovered panic happens, unwindm will
8110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// restore the g->sched.sp from the stack location
8120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// and then systemstack will try to use it. If we don't set it here,
8130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// that restored SP will be uninitialized (typically 0) and
8140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// will not be usable.
8150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	m_g0(BP), SI
8160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SP, (g_sched+gobuf_sp)(SI)
8170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robothavem:
8190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Now there's a valid m, and we're running on its m->g0.
8200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Save current m->g0->sched.sp on stack and then set it to SP.
8210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Save current sp in m->g0->sched.sp in preparation for
8220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// switch back to m->curg stack.
8230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// NOTE: unwindm knows that the saved g->sched.sp is at 0(SP).
8240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	m_g0(BP), SI
8250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(g_sched+gobuf_sp)(SI), AX
8260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 0(SP)
8270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SP, (g_sched+gobuf_sp)(SI)
8280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Switch to m->curg stack and call runtime.cgocallbackg.
8300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Because we are taking over the execution of m->curg
8310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// but *not* resuming what had been running, we need to
8320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// save that information (m->curg->sched) so we can restore it.
8330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// We can restore m->curg->sched.sp easily, because calling
8340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// runtime.cgocallbackg leaves SP unchanged upon return.
8350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// To save m->curg->sched.pc, we push it onto the stack.
8360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// This has the added benefit that it looks to the traceback
8370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// routine like cgocallbackg is going to return to that
8380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// PC (because the frame we allocate below has the same
8390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// size as cgocallback_gofunc's frame declared above)
8400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// so that the traceback will seamlessly trace back into
8410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// the earlier calls.
8420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	//
8430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// In the new goroutine, 4(SP) holds the saved oldm (DX) register.
8440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// 8(SP) is unused.
8450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	m_curg(BP), SI
8460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SI, g(CX)
8470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(g_sched+gobuf_sp)(SI), DI // prepare stack as DI
8480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(g_sched+gobuf_pc)(SI), BP
8490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BP, -4(DI)
8500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	ctxt+12(FP), CX
8510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	-(4+12)(DI), SP
8520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DX, 4(SP)
8530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	CX, 0(SP)
8540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·cgocallbackg(SB)
8550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	4(SP), DX
8560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Restore g->sched (== m->curg->sched) from saved values.
8580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
8590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(CX), SI
8600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	12(SP), BP
8610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BP, (g_sched+gobuf_pc)(SI)
8620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	(12+4)(SP), DI
8630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DI, (g_sched+gobuf_sp)(SI)
8640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Switch back to m->g0's stack and restore m->g0->sched.sp.
8660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// (Unlike m->curg, the g0 goroutine never uses sched.pc,
8670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// so we do not have to restore it.)
8680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(CX), BP
8690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g_m(BP), BP
8700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	m_g0(BP), SI
8710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SI, g(CX)
8720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(g_sched+gobuf_sp)(SI), SP
8730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	0(SP), AX
8740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, (g_sched+gobuf_sp)(SI)
8750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// If the m on entry was nil, we called needm above to borrow an m
8770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// for the duration of the call. Since the call is over, return it with dropm.
8780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	DX, $0
8790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE 3(PC)
8800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$runtime·dropm(SB), AX
8810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	AX
8820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Done!
8840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
8850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
8860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// void setg(G*); set g. for use by needm.
8870754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·setg(SB), NOSPLIT, $0-4
8880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	gg+0(FP), BX
8890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#ifdef GOOS_windows
8900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BX, $0
8910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	settls
8920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, 0x14(FS)
8930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
8940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotsettls:
8950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g_m(BX), AX
8960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	m_tls(AX), AX
8970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 0x14(FS)
8980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot#endif
8990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
9000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, g(CX)
9010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
9020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// void setg_gcc(G*); set g. for use by gcc
9040754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT setg_gcc<>(SB), NOSPLIT, $0
9050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(AX)
9060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	gg+0(FP), DX
9070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DX, g(AX)
9080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
9090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// check that SP is in range [g->stack.lo, g->stack.hi)
9110754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·stackcheck(SB), NOSPLIT, $0-0
9120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
9130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(CX), AX
9140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	(g_stack+stack_hi)(AX), SP
9150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JHI	2(PC)
9160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	INT	$3
9170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	SP, (g_stack+stack_lo)(AX)
9180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JHI	2(PC)
9190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	INT	$3
9200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
9210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// func cputicks() int64
9230754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·cputicks(SB),NOSPLIT,$0-8
9240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPB	runtime·support_sse2(SB), $1
9250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	done
9260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPB	runtime·lfenceBeforeRdtsc(SB), $1
9270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	mfence
9280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BYTE	$0x0f; BYTE $0xae; BYTE $0xe8 // LFENCE
9290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	done
9300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotmfence:
9310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BYTE	$0x0f; BYTE $0xae; BYTE $0xf0 // MFENCE
9320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotdone:
9330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RDTSC
9340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, ret_lo+0(FP)
9350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DX, ret_hi+4(FP)
9360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
9370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9380754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·ldt0setup(SB),NOSPLIT,$16-0
9390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// set up ldt 7 to point at m0.tls
9400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// ldt 1 would be fine on Linux, but on OS X, 7 is as low as we can go.
9410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// the entry number is just a hint.  setldt will set up GS with what it used.
9420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$7, 0(SP)
9430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	runtime·m0+m_tls(SB), AX
9440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 4(SP)
9450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$32, 8(SP)	// sizeof(tls array)
9460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·setldt(SB)
9470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
9480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9490754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·emptyfunc(SB),0,$0-0
9500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
9510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// hash function using AES hardware instructions
9530754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·aeshash(SB),NOSPLIT,$0-16
9540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	p+0(FP), AX	// ptr to data
9550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	s+8(FP), BX	// size
9560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	ret+12(FP), DX
9570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	runtime·aeshashbody(SB)
9580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9590754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·aeshashstr(SB),NOSPLIT,$0-12
9600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	p+0(FP), AX	// ptr to string object
9610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	4(AX), BX	// length of string
9620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(AX), AX	// string data
9630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	ret+8(FP), DX
9640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	runtime·aeshashbody(SB)
9650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// AX: data
9670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// BX: length
9680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// DX: address to put return value
9690754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·aeshashbody(SB),NOSPLIT,$0-0
9700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	h+4(FP), X0	            // 32 bits of per-table hash seed
9710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PINSRW	$4, BX, X0	            // 16 bits of length
9720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PSHUFHW	$0, X0, X0	            // replace size with its low 2 bytes repeated 4 times
9730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVO	X0, X1                      // save unscrambled seed
9740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	runtime·aeskeysched(SB), X0 // xor in per-process seed
9750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X0, X0                      // scramble seed
9760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BX, $16
9780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JB	aes0to15
9790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JE	aes16
9800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BX, $32
9810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JBE	aes17to32
9820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BX, $64
9830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JBE	aes33to64
9840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	aes65plus
9850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotaes0to15:
9870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	BX, BX
9880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JE	aes0
9890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	$16, AX
9910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTW	$0xff0, AX
9920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JE	endofpage
9930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
9940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// 16 bytes loaded at this address won't cross
9950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// a page boundary, so we can load it directly.
9960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	-16(AX), X1
9970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	BX, BX
9980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PAND	masks<>(SB)(BX*8), X1
9990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotfinal1:
10010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X0, X1  // scramble input, xor in seed
10020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X1, X1  // scramble combo 2 times
10030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X1, X1
10040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	X1, (DX)
10050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
10060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotendofpage:
10080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// address ends in 1111xxxx. Might be up against
10090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// a page boundary, so load ending at last byte.
10100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Then shift bytes down using pshufb.
10110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	-32(AX)(BX*1), X1
10120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	BX, BX
10130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PSHUFB	shifts<>(SB)(BX*8), X1
10140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	final1
10150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotaes0:
10170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// Return scrambled input seed
10180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X0, X0
10190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	X0, (DX)
10200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
10210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotaes16:
10230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	(AX), X1
10240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	final1
10250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotaes17to32:
10270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// make second starting seed
10280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	runtime·aeskeysched+16(SB), X1
10290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X1, X1
10300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// load data to be hashed
10320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	(AX), X2
10330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	-16(AX)(BX*1), X3
10340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// scramble 3 times
10360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X0, X2
10370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X1, X3
10380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X2, X2
10390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X3, X3
10400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X2, X2
10410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X3, X3
10420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// combine results
10440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	X3, X2
10450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	X2, (DX)
10460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
10470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotaes33to64:
10490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// make 3 more starting seeds
10500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVO	X1, X2
10510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVO	X1, X3
10520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	runtime·aeskeysched+16(SB), X1
10530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	runtime·aeskeysched+32(SB), X2
10540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	runtime·aeskeysched+48(SB), X3
10550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X1, X1
10560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X2, X2
10570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X3, X3
10580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	(AX), X4
10600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	16(AX), X5
10610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	-32(AX)(BX*1), X6
10620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	-16(AX)(BX*1), X7
10630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X0, X4
10650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X1, X5
10660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X2, X6
10670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X3, X7
10680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X4, X4
10700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X5, X5
10710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X6, X6
10720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X7, X7
10730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X4, X4
10750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X5, X5
10760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X6, X6
10770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X7, X7
10780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	X6, X4
10800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	X7, X5
10810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	X5, X4
10820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	X4, (DX)
10830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
10840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotaes65plus:
10860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// make 3 more starting seeds
10870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVO	X1, X2
10880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVO	X1, X3
10890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	runtime·aeskeysched+16(SB), X1
10900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	runtime·aeskeysched+32(SB), X2
10910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	runtime·aeskeysched+48(SB), X3
10920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X1, X1
10930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X2, X2
10940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X3, X3
10950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
10960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// start with last (possibly overlapping) block
10970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	-64(AX)(BX*1), X4
10980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	-48(AX)(BX*1), X5
10990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	-32(AX)(BX*1), X6
11000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	-16(AX)(BX*1), X7
11010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// scramble state once
11030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X0, X4
11040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X1, X5
11050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X2, X6
11060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X3, X7
11070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// compute number of remaining 64-byte blocks
11090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DECL	BX
11100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SHRL	$6, BX
11110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotaesloop:
11130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// scramble state, xor in a block
11140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	(AX), X0
11150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	16(AX), X1
11160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	32(AX), X2
11170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	48(AX), X3
11180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X0, X4
11190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X1, X5
11200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X2, X6
11210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X3, X7
11220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// scramble state
11240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X4, X4
11250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X5, X5
11260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X6, X6
11270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X7, X7
11280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	$64, AX
11300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	DECL	BX
11310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	aesloop
11320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// 2 more scrambles to finish
11340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X4, X4
11350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X5, X5
11360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X6, X6
11370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X7, X7
11380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X4, X4
11400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X5, X5
11410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X6, X6
11420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	X7, X7
11430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	X6, X4
11450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	X7, X5
11460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PXOR	X5, X4
11470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	X4, (DX)
11480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
11490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11500754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·aeshash32(SB),NOSPLIT,$0-12
11510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	p+0(FP), AX	// ptr to data
11520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	h+4(FP), X0	// seed
11530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PINSRD	$1, (AX), X0	// data
11540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	runtime·aeskeysched+0(SB), X0
11550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	runtime·aeskeysched+16(SB), X0
11560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	runtime·aeskeysched+32(SB), X0
11570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	X0, ret+8(FP)
11580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
11590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11600754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·aeshash64(SB),NOSPLIT,$0-12
11610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	p+0(FP), AX	// ptr to data
11620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVQ	(AX), X0	// data
11630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PINSRD	$2, h+4(FP), X0	// seed
11640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	runtime·aeskeysched+0(SB), X0
11650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	runtime·aeskeysched+16(SB), X0
11660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	AESENC	runtime·aeskeysched+32(SB), X0
11670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	X0, ret+8(FP)
11680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
11690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// simple mask to get rid of data in the high part of the register.
11710754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x00(SB)/4, $0x00000000
11720754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x04(SB)/4, $0x00000000
11730754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x08(SB)/4, $0x00000000
11740754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x0c(SB)/4, $0x00000000
11750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11760754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x10(SB)/4, $0x000000ff
11770754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x14(SB)/4, $0x00000000
11780754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x18(SB)/4, $0x00000000
11790754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x1c(SB)/4, $0x00000000
11800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11810754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x20(SB)/4, $0x0000ffff
11820754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x24(SB)/4, $0x00000000
11830754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x28(SB)/4, $0x00000000
11840754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x2c(SB)/4, $0x00000000
11850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11860754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x30(SB)/4, $0x00ffffff
11870754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x34(SB)/4, $0x00000000
11880754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x38(SB)/4, $0x00000000
11890754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x3c(SB)/4, $0x00000000
11900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11910754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x40(SB)/4, $0xffffffff
11920754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x44(SB)/4, $0x00000000
11930754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x48(SB)/4, $0x00000000
11940754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x4c(SB)/4, $0x00000000
11950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
11960754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x50(SB)/4, $0xffffffff
11970754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x54(SB)/4, $0x000000ff
11980754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x58(SB)/4, $0x00000000
11990754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x5c(SB)/4, $0x00000000
12000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12010754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x60(SB)/4, $0xffffffff
12020754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x64(SB)/4, $0x0000ffff
12030754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x68(SB)/4, $0x00000000
12040754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x6c(SB)/4, $0x00000000
12050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12060754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x70(SB)/4, $0xffffffff
12070754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x74(SB)/4, $0x00ffffff
12080754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x78(SB)/4, $0x00000000
12090754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x7c(SB)/4, $0x00000000
12100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12110754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x80(SB)/4, $0xffffffff
12120754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x84(SB)/4, $0xffffffff
12130754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x88(SB)/4, $0x00000000
12140754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x8c(SB)/4, $0x00000000
12150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12160754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x90(SB)/4, $0xffffffff
12170754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x94(SB)/4, $0xffffffff
12180754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x98(SB)/4, $0x000000ff
12190754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0x9c(SB)/4, $0x00000000
12200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12210754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xa0(SB)/4, $0xffffffff
12220754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xa4(SB)/4, $0xffffffff
12230754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xa8(SB)/4, $0x0000ffff
12240754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xac(SB)/4, $0x00000000
12250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12260754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xb0(SB)/4, $0xffffffff
12270754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xb4(SB)/4, $0xffffffff
12280754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xb8(SB)/4, $0x00ffffff
12290754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xbc(SB)/4, $0x00000000
12300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12310754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xc0(SB)/4, $0xffffffff
12320754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xc4(SB)/4, $0xffffffff
12330754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xc8(SB)/4, $0xffffffff
12340754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xcc(SB)/4, $0x00000000
12350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12360754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xd0(SB)/4, $0xffffffff
12370754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xd4(SB)/4, $0xffffffff
12380754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xd8(SB)/4, $0xffffffff
12390754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xdc(SB)/4, $0x000000ff
12400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12410754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xe0(SB)/4, $0xffffffff
12420754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xe4(SB)/4, $0xffffffff
12430754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xe8(SB)/4, $0xffffffff
12440754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xec(SB)/4, $0x0000ffff
12450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12460754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xf0(SB)/4, $0xffffffff
12470754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xf4(SB)/4, $0xffffffff
12480754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xf8(SB)/4, $0xffffffff
12490754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA masks<>+0xfc(SB)/4, $0x00ffffff
12500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12510754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotGLOBL masks<>(SB),RODATA,$256
12520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// these are arguments to pshufb. They move data down from
12540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// the high bytes of the register to the low bytes of the register.
12550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// index is how many bytes to move.
12560754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x00(SB)/4, $0x00000000
12570754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x04(SB)/4, $0x00000000
12580754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x08(SB)/4, $0x00000000
12590754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x0c(SB)/4, $0x00000000
12600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12610754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x10(SB)/4, $0xffffff0f
12620754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x14(SB)/4, $0xffffffff
12630754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x18(SB)/4, $0xffffffff
12640754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x1c(SB)/4, $0xffffffff
12650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12660754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x20(SB)/4, $0xffff0f0e
12670754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x24(SB)/4, $0xffffffff
12680754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x28(SB)/4, $0xffffffff
12690754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x2c(SB)/4, $0xffffffff
12700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12710754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x30(SB)/4, $0xff0f0e0d
12720754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x34(SB)/4, $0xffffffff
12730754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x38(SB)/4, $0xffffffff
12740754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x3c(SB)/4, $0xffffffff
12750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12760754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x40(SB)/4, $0x0f0e0d0c
12770754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x44(SB)/4, $0xffffffff
12780754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x48(SB)/4, $0xffffffff
12790754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x4c(SB)/4, $0xffffffff
12800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12810754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x50(SB)/4, $0x0e0d0c0b
12820754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x54(SB)/4, $0xffffff0f
12830754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x58(SB)/4, $0xffffffff
12840754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x5c(SB)/4, $0xffffffff
12850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12860754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x60(SB)/4, $0x0d0c0b0a
12870754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x64(SB)/4, $0xffff0f0e
12880754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x68(SB)/4, $0xffffffff
12890754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x6c(SB)/4, $0xffffffff
12900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12910754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x70(SB)/4, $0x0c0b0a09
12920754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x74(SB)/4, $0xff0f0e0d
12930754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x78(SB)/4, $0xffffffff
12940754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x7c(SB)/4, $0xffffffff
12950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
12960754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x80(SB)/4, $0x0b0a0908
12970754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x84(SB)/4, $0x0f0e0d0c
12980754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x88(SB)/4, $0xffffffff
12990754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x8c(SB)/4, $0xffffffff
13000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
13010754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x90(SB)/4, $0x0a090807
13020754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x94(SB)/4, $0x0e0d0c0b
13030754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x98(SB)/4, $0xffffff0f
13040754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0x9c(SB)/4, $0xffffffff
13050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
13060754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xa0(SB)/4, $0x09080706
13070754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xa4(SB)/4, $0x0d0c0b0a
13080754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xa8(SB)/4, $0xffff0f0e
13090754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xac(SB)/4, $0xffffffff
13100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
13110754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xb0(SB)/4, $0x08070605
13120754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xb4(SB)/4, $0x0c0b0a09
13130754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xb8(SB)/4, $0xff0f0e0d
13140754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xbc(SB)/4, $0xffffffff
13150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
13160754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xc0(SB)/4, $0x07060504
13170754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xc4(SB)/4, $0x0b0a0908
13180754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xc8(SB)/4, $0x0f0e0d0c
13190754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xcc(SB)/4, $0xffffffff
13200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
13210754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xd0(SB)/4, $0x06050403
13220754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xd4(SB)/4, $0x0a090807
13230754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xd8(SB)/4, $0x0e0d0c0b
13240754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xdc(SB)/4, $0xffffff0f
13250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
13260754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xe0(SB)/4, $0x05040302
13270754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xe4(SB)/4, $0x09080706
13280754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xe8(SB)/4, $0x0d0c0b0a
13290754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xec(SB)/4, $0xffff0f0e
13300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
13310754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xf0(SB)/4, $0x04030201
13320754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xf4(SB)/4, $0x08070605
13330754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xf8(SB)/4, $0x0c0b0a09
13340754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotDATA shifts<>+0xfc(SB)/4, $0xff0f0e0d
13350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
13360754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotGLOBL shifts<>(SB),RODATA,$256
13370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
13380754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT ·checkASM(SB),NOSPLIT,$0-1
13390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// check that masks<>(SB) and shifts<>(SB) are aligned to 16-byte
13400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$masks<>(SB), AX
13410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$shifts<>(SB), BX
13420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ORL	BX, AX
13430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	$15, AX
13440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETEQ	ret+0(FP)
13450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
13460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
13470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// memequal(p, q unsafe.Pointer, size uintptr) bool
13480754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·memequal(SB),NOSPLIT,$0-13
13490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	a+0(FP), SI
13500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	b+4(FP), DI
13510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	SI, DI
13520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	eq
13530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	size+8(FP), BX
13540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	ret+12(FP), AX
13550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	runtime·memeqbody(SB)
13560754ce079d936daf401bbf49cb69a318aa79828android-build-team Roboteq:
13570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB    $1, ret+12(FP)
13580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
13590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
13600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// memequal_varlen(a, b unsafe.Pointer) bool
13610754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·memequal_varlen(SB),NOSPLIT,$0-9
13620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL    a+0(FP), SI
13630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL    b+4(FP), DI
13640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL    SI, DI
13650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ     eq
13660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL    4(DX), BX    // compiler stores size at offset 4 in the closure
13670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	ret+8(FP), AX
13680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	runtime·memeqbody(SB)
13690754ce079d936daf401bbf49cb69a318aa79828android-build-team Roboteq:
13700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB    $1, ret+8(FP)
13710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
13720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
13730754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT bytes·Equal(SB),NOSPLIT,$0-25
13740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	a_len+4(FP), BX
13750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	b_len+16(FP), CX
13760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BX, CX
13770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	eqret
13780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	a+0(FP), SI
13790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	b+12(FP), DI
13800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	ret+24(FP), AX
13810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	runtime·memeqbody(SB)
13820754ce079d936daf401bbf49cb69a318aa79828android-build-team Roboteqret:
13830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	$0, ret+24(FP)
13840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
13850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
13860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// a in SI
13870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// b in DI
13880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// count in BX
13890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// address of result byte in AX
13900754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·memeqbody(SB),NOSPLIT,$0-0
13910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BX, $4
13920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JB	small
13930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
13940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// 64 bytes at a time using xmm registers
13950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robothugeloop:
13960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BX, $64
13970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JB	bigloop
13980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPB	runtime·support_sse2(SB), $1
13990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	bigloop
14000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	(SI), X0
14010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	(DI), X1
14020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	16(SI), X2
14030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	16(DI), X3
14040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	32(SI), X4
14050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	32(DI), X5
14060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	48(SI), X6
14070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	48(DI), X7
14080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PCMPEQB	X1, X0
14090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PCMPEQB	X3, X2
14100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PCMPEQB	X5, X4
14110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PCMPEQB	X7, X6
14120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PAND	X2, X0
14130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PAND	X6, X4
14140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PAND	X4, X0
14150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PMOVMSKB X0, DX
14160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	$64, SI
14170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	$64, DI
14180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	$64, BX
14190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	DX, $0xffff
14200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	hugeloop
14210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	$0, (AX)
14220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
14230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
14240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// 4 bytes at a time using 32-bit register
14250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotbigloop:
14260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BX, $4
14270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JBE	leftover
14280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(SI), CX
14290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(DI), DX
14300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	$4, SI
14310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	$4, DI
14320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	$4, BX
14330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	CX, DX
14340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	bigloop
14350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	$0, (AX)
14360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
14370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
14380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// remaining 0-4 bytes
14390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotleftover:
14400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	-4(SI)(BX*1), CX
14410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	-4(DI)(BX*1), DX
14420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	CX, DX
14430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETEQ	(AX)
14440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
14450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
14460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotsmall:
14470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BX, $0
14480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	equal
14490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
14500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	0(BX*8), CX
14510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	NEGL	CX
14520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
14530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SI, DX
14540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPB	DX, $0xfc
14550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JA	si_high
14560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
14570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// load at SI won't cross a page boundary.
14580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(SI), SI
14590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	si_finish
14600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotsi_high:
14610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// address ends in 111111xx. Load up to bytes we want, move to correct position.
14620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	-4(SI)(BX*1), SI
14630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SHRL	CX, SI
14640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotsi_finish:
14650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
14660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// same for DI.
14670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DI, DX
14680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPB	DX, $0xfc
14690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JA	di_high
14700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(DI), DI
14710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	di_finish
14720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotdi_high:
14730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	-4(DI)(BX*1), DI
14740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SHRL	CX, DI
14750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotdi_finish:
14760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
14770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	SI, DI
14780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SHLL	CX, DI
14790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotequal:
14800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETEQ	(AX)
14810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
14820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
14830754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·cmpstring(SB),NOSPLIT,$0-20
14840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	s1_base+0(FP), SI
14850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	s1_len+4(FP), BX
14860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	s2_base+8(FP), DI
14870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	s2_len+12(FP), DX
14880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	ret+16(FP), AX
14890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	runtime·cmpbody(SB)
14900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
14910754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT bytes·Compare(SB),NOSPLIT,$0-28
14920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	s1+0(FP), SI
14930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	s1+4(FP), BX
14940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	s2+12(FP), DI
14950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	s2+16(FP), DX
14960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	ret+24(FP), AX
14970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	runtime·cmpbody(SB)
14980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
14990754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT bytes·IndexByte(SB),NOSPLIT,$0-20
15000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	s+0(FP), SI
15010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	s_len+4(FP), CX
15020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	c+12(FP), AL
15030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SI, DI
15040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CLD; REPN; SCASB
15050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JZ 3(PC)
15060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$-1, ret+16(FP)
15070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
15080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	SI, DI
15090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	$1, DI
15100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DI, ret+16(FP)
15110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
15120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
15130754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT strings·IndexByte(SB),NOSPLIT,$0-16
15140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	s+0(FP), SI
15150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	s_len+4(FP), CX
15160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	c+8(FP), AL
15170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	SI, DI
15180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CLD; REPN; SCASB
15190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JZ 3(PC)
15200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$-1, ret+12(FP)
15210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
15220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	SI, DI
15230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	$1, DI
15240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DI, ret+12(FP)
15250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
15260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
15270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// input:
15280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//   SI = a
15290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//   DI = b
15300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//   BX = alen
15310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//   DX = blen
15320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot//   AX = address of return word (set to 1/0/-1)
15330754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·cmpbody(SB),NOSPLIT,$0-0
15340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DX, BP
15350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	BX, DX // DX = blen-alen
15360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JLE	2(PC)
15370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, BP // BP = min(alen, blen)
15380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	SI, DI
15390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	allsame
15400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BP, $4
15410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JB	small
15420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPB	runtime·support_sse2(SB), $1
15430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	mediumloop
15440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotlargeloop:
15450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BP, $16
15460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JB	mediumloop
15470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	(SI), X0
15480754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVOU	(DI), X1
15490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PCMPEQB X0, X1
15500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	PMOVMSKB X1, BX
15510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	XORL	$0xffff, BX	// convert EQ to NE
15520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	diff16	// branch if at least one byte is not equal
15530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	$16, SI
15540754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	$16, DI
15550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	$16, BP
15560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	largeloop
15570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
15580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotdiff16:
15590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BSFL	BX, BX	// index of first byte that differs
15600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	XORL	DX, DX
15610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVB	(SI)(BX*1), CX
15620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPB	CX, (DI)(BX*1)
15630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETHI	DX
15640754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	-1(DX*2), DX	// convert 1/0 to +1/-1
15650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	DX, (AX)
15660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
15670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
15680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotmediumloop:
15690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BP, $4
15700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JBE	_0through4
15710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(SI), BX
15720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(DI), CX
15730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BX, CX
15740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JNE	diff4
15750754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	$4, SI
15760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ADDL	$4, DI
15770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SUBL	$4, BP
15780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	mediumloop
15790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
15800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot_0through4:
15810754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	-4(SI)(BP*1), BX
15820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	-4(DI)(BP*1), CX
15830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPL	BX, CX
15840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	allsame
15850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
15860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotdiff4:
15870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BSWAPL	BX	// reverse order of bytes
15880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BSWAPL	CX
15890754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	XORL	BX, CX	// find bit differences
15900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BSRL	CX, CX	// index of highest bit difference
15910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SHRL	CX, BX	// move a's bit to bottom
15920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ANDL	$1, BX	// mask bit
15930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	-1(BX*2), BX // 1/0 => +1/-1
15940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, (AX)
15950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
15960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
15970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// 0-3 bytes in common
15980754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotsmall:
15990754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	(BP*8), CX
16000754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	NEGL	CX
16010754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	allsame
16020754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
16030754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// load si
16040754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPB	SI, $0xfc
16050754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JA	si_high
16060754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(SI), SI
16070754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	si_finish
16080754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotsi_high:
16090754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	-4(SI)(BP*1), SI
16100754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SHRL	CX, SI
16110754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotsi_finish:
16120754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SHLL	CX, SI
16130754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
16140754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// same for di
16150754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CMPB	DI, $0xfc
16160754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JA	di_high
16170754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(DI), DI
16180754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JMP	di_finish
16190754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotdi_high:
16200754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	-4(DI)(BP*1), DI
16210754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SHRL	CX, DI
16220754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotdi_finish:
16230754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SHLL	CX, DI
16240754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
16250754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BSWAPL	SI	// reverse order of bytes
16260754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BSWAPL	DI
16270754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	XORL	SI, DI	// find bit differences
16280754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	JEQ	allsame
16290754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BSRL	DI, CX	// index of highest bit difference
16300754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SHRL	CX, SI	// move a's bit to bottom
16310754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	ANDL	$1, SI	// mask bit
16320754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	-1(SI*2), BX // 1/0 => +1/-1
16330754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, (AX)
16340754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
16350754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
16360754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// all the bytes in common are the same, so we just need
16370754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// to compare the lengths.
16380754ce079d936daf401bbf49cb69a318aa79828android-build-team Robotallsame:
16390754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	XORL	BX, BX
16400754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	XORL	CX, CX
16410754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	TESTL	DX, DX
16420754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETLT	BX	// 1 if alen > blen
16430754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	SETEQ	CX	// 1 if alen == blen
16440754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	LEAL	-1(CX)(BX*2), BX	// 1,0,-1 result
16450754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	BX, (AX)
16460754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
16470754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
16480754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·return0(SB), NOSPLIT, $0
16490754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, AX
16500754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
16510754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
16520754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Called from cgo wrappers, this function returns g->m->curg.stack.hi.
16530754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Must obey the gcc calling convention.
16540754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT _cgo_topofstack(SB),NOSPLIT,$0
16550754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	get_tls(CX)
16560754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g(CX), AX
16570754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	g_m(AX), AX
16580754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	m_curg(AX), AX
16590754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	(g_stack+stack_hi)(AX), AX
16600754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
16610754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
16620754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// The top-most function running on a goroutine
16630754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// returns to goexit+PCQuantum.
16640754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·goexit(SB),NOSPLIT,$0-0
16650754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BYTE	$0x90	// NOP
16660754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	CALL	runtime·goexit1(SB)	// does not return
16670754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	// traceback from goexit1 must hit code range of goexit
16680754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	BYTE	$0x90	// NOP
16690754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
16700754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// Add a module's moduledata to the linked list of moduledata objects. This
16710754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// is called from .init_array by a function generated in the linker and so
16720754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// follows the platform ABI wrt register preservation -- it only touches AX,
16730754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// CX (implicitly) and DX, but it does not follow the ABI wrt arguments:
16740754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot// instead the pointer to the moduledata is passed in AX.
16750754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·addmoduledata(SB),NOSPLIT,$0-0
16760754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot       MOVL    runtime·lastmoduledatap(SB), DX
16770754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot       MOVL    AX, moduledata_next(DX)
16780754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot       MOVL    AX, runtime·lastmoduledatap(SB)
16790754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot       RET
16800754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
16810754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·uint32tofloat64(SB),NOSPLIT,$8-12
16820754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	a+0(FP), AX
16830754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, 0(SP)
16840754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	$0, 4(SP)
16850754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	FMOVV	0(SP), F0
16860754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	FMOVDP	F0, ret+4(FP)
16870754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
16880754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot
16890754ce079d936daf401bbf49cb69a318aa79828android-build-team RobotTEXT runtime·float64touint32(SB),NOSPLIT,$12-12
16900754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	FMOVD	a+0(FP), F0
16910754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	FSTCW	0(SP)
16920754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	FLDCW	runtime·controlWord64trunc(SB)
16930754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	FMOVVP	F0, 4(SP)
16940754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	FLDCW	0(SP)
16950754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	4(SP), AX
16960754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	MOVL	AX, ret+8(FP)
16970754ce079d936daf401bbf49cb69a318aa79828android-build-team Robot	RET
1698