src/runtime/sys_linux_arm64.s 847 lines View on github.com → Search inside
1// Copyright 2014 The Go Authors. All rights reserved.2// Use of this source code is governed by a BSD-style3// license that can be found in the LICENSE file.45//6// System calls and other sys.stuff for arm64, Linux7//89#include "go_asm.h"10#include "go_tls.h"11#include "textflag.h"12#include "cgo/abi_arm64.h"1314#define AT_FDCWD -1001516#define CLOCK_REALTIME 017#define CLOCK_MONOTONIC 11819#define SYS_exit		9320#define SYS_read		6321#define SYS_write		6422#define SYS_openat		5623#define SYS_close		5724#define SYS_pipe2		5925#define SYS_nanosleep		10126#define SYS_mmap		22227#define SYS_munmap		21528#define SYS_setitimer		10329#define SYS_clone		22030#define SYS_sched_yield		12431#define SYS_rt_sigreturn	13932#define SYS_rt_sigaction	13433#define SYS_rt_sigprocmask	13534#define SYS_sigaltstack		13235#define SYS_madvise		23336#define SYS_mincore		23237#define SYS_getpid		17238#define SYS_gettid		17839#define SYS_kill		12940#define SYS_tgkill		13141#define SYS_futex		9842#define SYS_sched_getaffinity	12343#define SYS_exit_group		9444#define SYS_clock_gettime	11345#define SYS_faccessat		4846#define SYS_socket		19847#define SYS_connect		20348#define SYS_brk			21449#define SYS_timer_create	10750#define SYS_timer_settime	11051#define SYS_timer_delete	1115253TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0-454	MOVW	code+0(FP), R055	MOVD	$SYS_exit_group, R856	SVC57	RET5859// func exitThread(wait *atomic.Uint32)60TEXT runtime·exitThread(SB),NOSPLIT|NOFRAME,$0-861	MOVD	wait+0(FP), R062	// We're done using the stack.63	MOVW	$0, R164	STLRW	R1, (R0)65	MOVW	$0, R0	// exit code66	MOVD	$SYS_exit, R867	SVC68	JMP	0(PC)6970TEXT runtime·open(SB),NOSPLIT|NOFRAME,$0-2071	MOVD	$AT_FDCWD, R072	MOVD	name+0(FP), R173	MOVW	mode+8(FP), R274	MOVW	perm+12(FP), R375	MOVD	$SYS_openat, R876	SVC77	CMN	$4095, R078	BCC	done79	MOVW	$-1, R080done:81	MOVW	R0, ret+16(FP)82	RET8384TEXT runtime·closefd(SB),NOSPLIT|NOFRAME,$0-1285	MOVW	fd+0(FP), R086	MOVD	$SYS_close, R887	SVC88	CMN	$4095, R089	BCC	done90	MOVW	$-1, R091done:92	MOVW	R0, ret+8(FP)93	RET9495TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0-2896	MOVD	fd+0(FP), R097	MOVD	p+8(FP), R198	MOVW	n+16(FP), R299	MOVD	$SYS_write, R8100	SVC101	MOVW	R0, ret+24(FP)102	RET103104TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0-28105	MOVW	fd+0(FP), R0106	MOVD	p+8(FP), R1107	MOVW	n+16(FP), R2108	MOVD	$SYS_read, R8109	SVC110	MOVW	R0, ret+24(FP)111	RET112113// func pipe2(flags int32) (r, w int32, errno int32)114TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20115	MOVD	$r+8(FP), R0116	MOVW	flags+0(FP), R1117	MOVW	$SYS_pipe2, R8118	SVC119	MOVW	R0, errno+16(FP)120	RET121122TEXT runtime·usleep(SB),NOSPLIT,$24-4123	MOVWU	usec+0(FP), R3124	MOVD	R3, R5125	MOVW	$1000000, R4126	UDIV	R4, R3127	MOVD	R3, 8(RSP)128	MUL	R3, R4129	SUB	R4, R5130	MOVW	$1000, R4131	MUL	R4, R5132	MOVD	R5, 16(RSP)133134	// nanosleep(&ts, 0)135	ADD	$8, RSP, R0136	MOVD	$0, R1137	MOVD	$SYS_nanosleep, R8138	SVC139	RET140141TEXT runtime·gettid(SB),NOSPLIT,$0-4142	MOVD	$SYS_gettid, R8143	SVC144	MOVW	R0, ret+0(FP)145	RET146147TEXT runtime·raise(SB),NOSPLIT|NOFRAME,$0148	MOVD	$SYS_getpid, R8149	SVC150	MOVW	R0, R19151	MOVD	$SYS_gettid, R8152	SVC153	MOVW	R0, R1	// arg 2 tid154	MOVW	R19, R0	// arg 1 pid155	MOVW	sig+0(FP), R2	// arg 3156	MOVD	$SYS_tgkill, R8157	SVC158	RET159160TEXT runtime·raiseproc(SB),NOSPLIT|NOFRAME,$0161	MOVD	$SYS_getpid, R8162	SVC163	MOVW	R0, R0		// arg 1 pid164	MOVW	sig+0(FP), R1	// arg 2165	MOVD	$SYS_kill, R8166	SVC167	RET168169TEXT ·getpid(SB),NOSPLIT|NOFRAME,$0-8170	MOVD	$SYS_getpid, R8171	SVC172	MOVD	R0, ret+0(FP)173	RET174175TEXT ·tgkill(SB),NOSPLIT,$0-24176	MOVD	tgid+0(FP), R0177	MOVD	tid+8(FP), R1178	MOVD	sig+16(FP), R2179	MOVD	$SYS_tgkill, R8180	SVC181	RET182183TEXT runtime·setitimer(SB),NOSPLIT|NOFRAME,$0-24184	MOVW	mode+0(FP), R0185	MOVD	new+8(FP), R1186	MOVD	old+16(FP), R2187	MOVD	$SYS_setitimer, R8188	SVC189	RET190191TEXT runtime·timer_create(SB),NOSPLIT,$0-28192	MOVW	clockid+0(FP), R0193	MOVD	sevp+8(FP), R1194	MOVD	timerid+16(FP), R2195	MOVD	$SYS_timer_create, R8196	SVC197	MOVW	R0, ret+24(FP)198	RET199200TEXT runtime·timer_settime(SB),NOSPLIT,$0-28201	MOVW	timerid+0(FP), R0202	MOVW	flags+4(FP), R1203	MOVD	new+8(FP), R2204	MOVD	old+16(FP), R3205	MOVD	$SYS_timer_settime, R8206	SVC207	MOVW	R0, ret+24(FP)208	RET209210TEXT runtime·timer_delete(SB),NOSPLIT,$0-12211	MOVW	timerid+0(FP), R0212	MOVD	$SYS_timer_delete, R8213	SVC214	MOVW	R0, ret+8(FP)215	RET216217TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28218	MOVD	addr+0(FP), R0219	MOVD	n+8(FP), R1220	MOVD	dst+16(FP), R2221	MOVD	$SYS_mincore, R8222	SVC223	MOVW	R0, ret+24(FP)224	RET225226// func walltime() (sec int64, nsec int32)227TEXT runtime·walltime(SB),NOSPLIT,$24-12228#ifdef GOEXPERIMENT_runtimesecret229	MOVW 	g_secret(g), R20230	CBZ 	R20, nosecret231	BL	·secretEraseRegisters(SB)232233nosecret:234#endif235	MOVD	RSP, R20	// R20 is unchanged by C code236	MOVD	RSP, R1237238	MOVD	g_m(g), R21	// R21 = m239240	// Set vdsoPC and vdsoSP for SIGPROF traceback.241	// Save the old values on stack and restore them on exit,242	// so this function is reentrant.243	MOVD	m_vdsoPC(R21), R2244	MOVD	m_vdsoSP(R21), R3245	MOVD	R2, 8(RSP)246	MOVD	R3, 16(RSP)247248	MOVD	$ret-8(FP), R2 // caller's SP249	MOVD	LR, m_vdsoPC(R21)250	MOVD	R2, m_vdsoSP(R21)251252	MOVD	m_curg(R21), R0253	CMP	g, R0254	BNE	noswitch255256	MOVD	m_g0(R21), R3257	MOVD	(g_sched+gobuf_sp)(R3), R1	// Set RSP to g0 stack258259noswitch:260	SUB	$16, R1261	BIC	$15, R1	// Align for C code262	MOVD	R1, RSP263264	MOVW	$CLOCK_REALTIME, R0265	MOVD	runtime·vdsoClockgettimeSym(SB), R2266	CBZ	R2, fallback267268	// Store g on gsignal's stack, so if we receive a signal269	// during VDSO code we can find the g.270	// If we don't have a signal stack, we won't receive signal,271	// so don't bother saving g.272	// When using cgo, we already saved g on TLS, also don't save273	// g here.274	// Also don't save g if we are already on the signal stack.275	// We won't get a nested signal.276	MOVBU	runtime·iscgo(SB), R22277	CBNZ	R22, nosaveg278	MOVD	m_gsignal(R21), R22          // g.m.gsignal279	CBZ	R22, nosaveg280	CMP	g, R22281	BEQ	nosaveg282	MOVD	(g_stack+stack_lo)(R22), R22 // g.m.gsignal.stack.lo283	MOVD	g, (R22)284285	BL	(R2)286287	MOVD	ZR, (R22)  // clear g slot, R22 is unchanged by C code288289	B	finish290291nosaveg:292	BL	(R2)293	B	finish294295fallback:296	MOVD	$SYS_clock_gettime, R8297	SVC298299finish:300	MOVD	0(RSP), R3	// sec301	MOVD	8(RSP), R5	// nsec302303	MOVD	R20, RSP	// restore SP304	// Restore vdsoPC, vdsoSP305	// We don't worry about being signaled between the two stores.306	// If we are not in a signal handler, we'll restore vdsoSP to 0,307	// and no one will care about vdsoPC. If we are in a signal handler,308	// we cannot receive another signal.309	MOVD	16(RSP), R1310	MOVD	R1, m_vdsoSP(R21)311	MOVD	8(RSP), R1312	MOVD	R1, m_vdsoPC(R21)313314	MOVD	R3, sec+0(FP)315	MOVW	R5, nsec+8(FP)316	RET317318TEXT runtime·nanotime1(SB),NOSPLIT,$24-8319#ifdef GOEXPERIMENT_runtimesecret320	MOVW	g_secret(g), R20321	CBZ	R20, nosecret322	BL	·secretEraseRegisters(SB)323324nosecret:325#endif326	MOVD	RSP, R20	// R20 is unchanged by C code327	MOVD	RSP, R1328329	MOVD	g_m(g), R21	// R21 = m330331	// Set vdsoPC and vdsoSP for SIGPROF traceback.332	// Save the old values on stack and restore them on exit,333	// so this function is reentrant.334	MOVD	m_vdsoPC(R21), R2335	MOVD	m_vdsoSP(R21), R3336	MOVD	R2, 8(RSP)337	MOVD	R3, 16(RSP)338339	MOVD	$ret-8(FP), R2 // caller's SP340	MOVD	LR, m_vdsoPC(R21)341	MOVD	R2, m_vdsoSP(R21)342343	MOVD	m_curg(R21), R0344	CMP	g, R0345	BNE	noswitch346347	MOVD	m_g0(R21), R3348	MOVD	(g_sched+gobuf_sp)(R3), R1	// Set RSP to g0 stack349350noswitch:351	SUB	$32, R1352	BIC	$15, R1353	MOVD	R1, RSP354355	MOVW	$CLOCK_MONOTONIC, R0356	MOVD	runtime·vdsoClockgettimeSym(SB), R2357	CBZ	R2, fallback358359	// Store g on gsignal's stack, so if we receive a signal360	// during VDSO code we can find the g.361	// If we don't have a signal stack, we won't receive signal,362	// so don't bother saving g.363	// When using cgo, we already saved g on TLS, also don't save364	// g here.365	// Also don't save g if we are already on the signal stack.366	// We won't get a nested signal.367	MOVBU	runtime·iscgo(SB), R22368	CBNZ	R22, nosaveg369	MOVD	m_gsignal(R21), R22          // g.m.gsignal370	CBZ	R22, nosaveg371	CMP	g, R22372	BEQ	nosaveg373	MOVD	(g_stack+stack_lo)(R22), R22 // g.m.gsignal.stack.lo374	MOVD	g, (R22)375376	BL	(R2)377378	MOVD	ZR, (R22)  // clear g slot, R22 is unchanged by C code379380	B	finish381382nosaveg:383	BL	(R2)384	B	finish385386fallback:387	MOVD	$SYS_clock_gettime, R8388	SVC389390finish:391	MOVD	0(RSP), R3	// sec392	MOVD	8(RSP), R5	// nsec393394	MOVD	R20, RSP	// restore SP395	// Restore vdsoPC, vdsoSP396	// We don't worry about being signaled between the two stores.397	// If we are not in a signal handler, we'll restore vdsoSP to 0,398	// and no one will care about vdsoPC. If we are in a signal handler,399	// we cannot receive another signal.400	MOVD	16(RSP), R1401	MOVD	R1, m_vdsoSP(R21)402	MOVD	8(RSP), R1403	MOVD	R1, m_vdsoPC(R21)404405	// sec is in R3, nsec in R5406	// return nsec in R3407	MOVD	$1000000000, R4408	MUL	R4, R3409	ADD	R5, R3410	MOVD	R3, ret+0(FP)411	RET412413TEXT runtime·rtsigprocmask(SB),NOSPLIT|NOFRAME,$0-28414	MOVW	how+0(FP), R0415	MOVD	new+8(FP), R1416	MOVD	old+16(FP), R2417	MOVW	size+24(FP), R3418	MOVD	$SYS_rt_sigprocmask, R8419	SVC420	CMN	$4095, R0421	BCC	done422	MOVD	$0, R0423	MOVD	R0, (R0)	// crash424done:425	RET426427TEXT runtime·rt_sigaction(SB),NOSPLIT|NOFRAME,$0-36428	MOVD	sig+0(FP), R0429	MOVD	new+8(FP), R1430	MOVD	old+16(FP), R2431	MOVD	size+24(FP), R3432	MOVD	$SYS_rt_sigaction, R8433	SVC434	MOVW	R0, ret+32(FP)435	RET436437// Call the function stored in _cgo_sigaction using the GCC calling convention.438TEXT runtime·callCgoSigaction(SB),NOSPLIT,$0439	MOVD	sig+0(FP), R0440	MOVD	new+8(FP), R1441	MOVD	old+16(FP), R2442	MOVD	 _cgo_sigaction(SB), R3443	SUB	$16, RSP		// reserve 16 bytes for sp-8 where fp may be saved.444	BL	R3445	ADD	$16, RSP446	MOVW	R0, ret+24(FP)447	RET448449TEXT runtime·sigfwd(SB),NOSPLIT,$0-32450	MOVW	sig+8(FP), R0451	MOVD	info+16(FP), R1452	MOVD	ctx+24(FP), R2453	MOVD	fn+0(FP), R11454	BL	(R11)455	RET456457// Called from c-abi, R0: sig, R1: info, R2: cxt458TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$176459	// Save callee-save registers in the case of signal forwarding.460	// Please refer to https://golang.org/issue/31827 .461	SAVE_R19_TO_R28(8*4)462	SAVE_F8_TO_F15(8*14)463464	// this might be called in external code context,465	// where g is not set.466	// first save R0, because runtime·load_g will clobber it467	MOVW	R0, 8(RSP)468	MOVBU	runtime·iscgo(SB), R0469	CBZ	R0, 2(PC)470	BL	runtime·load_g(SB)471472	// Restore signum to R0.473	MOVW	8(RSP), R0474	// R1 and R2 already contain info and ctx, respectively.475	MOVD	$runtime·sigtrampgo<ABIInternal>(SB), R3476	BL	(R3)477478	// Restore callee-save registers.479	RESTORE_R19_TO_R28(8*4)480	RESTORE_F8_TO_F15(8*14)481482	RET483484// Called from c-abi, R0: sig, R1: info, R2: cxt485TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT,$176486	// Save callee-save registers because it's a callback from c code.487	SAVE_R19_TO_R28(8*4)488	SAVE_F8_TO_F15(8*14)489490	// R0, R1 and R2 already contain sig, info and ctx, respectively.491	CALL	runtime·sigprofNonGo<ABIInternal>(SB)492493	// Restore callee-save registers.494	RESTORE_R19_TO_R28(8*4)495	RESTORE_F8_TO_F15(8*14)496	RET497498// Called from c-abi, R0: sig, R1: info, R2: cxt499TEXT runtime·cgoSigtramp(SB),NOSPLIT|NOFRAME,$0500	// The stack unwinder, presumably written in C, may not be able to501	// handle Go frame correctly. So, this function is NOFRAME, and we502	// save/restore LR manually.503	MOVD	LR, R10504	// Save R27, g because they will be clobbered,505	// we need to restore them before jump to sigtramp.506	MOVD	R27, R11507	MOVD	g, R12508509	// If no traceback function, do usual sigtramp.510	MOVD	runtime·cgoTraceback(SB), R6511	CBZ	R6, sigtramp512513	// If no traceback support function, which means that514	// runtime/cgo was not linked in, do usual sigtramp.515	MOVD	_cgo_callers(SB), R7516	CBZ	R7, sigtramp517518	// Figure out if we are currently in a cgo call.519	// If not, just do usual sigtramp.520	// first save R0, because runtime·load_g will clobber it.521	MOVD	R0, R8522	// Set up g register.523	CALL	runtime·load_g(SB)524	MOVD	R8, R0525526	CBZ	g, sigtrampnog // g == nil527	MOVD	g_m(g), R6528	CBZ	R6, sigtramp    // g.m == nil529	MOVW	m_ncgo(R6), R7530	CBZW	R7, sigtramp    // g.m.ncgo = 0531	MOVD	m_curg(R6), R8532	CBZ	R8, sigtramp    // g.m.curg == nil533	MOVD	g_syscallsp(R8), R7534	CBZ	R7,	sigtramp    // g.m.curg.syscallsp == 0535	MOVD	m_cgoCallers(R6), R4 // R4 is the fifth arg in C calling convention.536	CBZ	R4,	sigtramp    // g.m.cgoCallers == nil537	MOVW	m_cgoCallersUse(R6), R8538	CBNZW	R8, sigtramp    // g.m.cgoCallersUse != 0539540	// Jump to a function in runtime/cgo.541	// That function, written in C, will call the user's traceback542	// function with proper unwind info, and will then call back here.543	// The first three arguments, and the fifth, are already in registers.544	// Set the two remaining arguments now.545	MOVD	runtime·cgoTraceback(SB), R3546	MOVD	$runtime·sigtramp(SB), R5547	MOVD	_cgo_callers(SB), R13548	MOVD	R10, LR // restore549	MOVD	R11, R27550	MOVD	R12, g551	B	(R13)552553sigtramp:554	MOVD	R10, LR // restore555	MOVD	R11, R27556	MOVD	R12, g557	B	runtime·sigtramp(SB)558559sigtrampnog:560	// Signal arrived on a non-Go thread. If this is SIGPROF, get a561	// stack trace.562	CMPW	$27, R0 // 27 == SIGPROF563	BNE	sigtramp564565	// Lock sigprofCallersUse (cas from 0 to 1).566	MOVW	$1, R7567	MOVD	$runtime·sigprofCallersUse(SB), R8568load_store_loop:569	LDAXRW	(R8), R9570	CBNZW	R9, sigtramp // Skip stack trace if already locked.571	STLXRW	R7, (R8), R9572	CBNZ	R9, load_store_loop573574	// Jump to the traceback function in runtime/cgo.575	// It will call back to sigprofNonGo, which will ignore the576	// arguments passed in registers.577	// First three arguments to traceback function are in registers already.578	MOVD	runtime·cgoTraceback(SB), R3579	MOVD	$runtime·sigprofCallers(SB), R4580	MOVD	$runtime·sigprofNonGoWrapper<>(SB), R5581	MOVD	_cgo_callers(SB), R13582	MOVD	R10, LR // restore583	MOVD	R11, R27584	MOVD	R12, g585	B	(R13)586587TEXT runtime·sysMmap(SB),NOSPLIT|NOFRAME,$0588	MOVD	addr+0(FP), R0589	MOVD	n+8(FP), R1590	MOVW	prot+16(FP), R2591	MOVW	flags+20(FP), R3592	MOVW	fd+24(FP), R4593	MOVW	off+28(FP), R5594595	MOVD	$SYS_mmap, R8596	SVC597	CMN	$4095, R0598	BCC	ok599	NEG	R0,R0600	MOVD	$0, p+32(FP)601	MOVD	R0, err+40(FP)602	RET603ok:604	MOVD	R0, p+32(FP)605	MOVD	$0, err+40(FP)606	RET607608// Call the function stored in _cgo_mmap using the GCC calling convention.609// This must be called on the system stack.610TEXT runtime·callCgoMmap(SB),NOSPLIT,$0611	MOVD	addr+0(FP), R0612	MOVD	n+8(FP), R1613	MOVW	prot+16(FP), R2614	MOVW	flags+20(FP), R3615	MOVW	fd+24(FP), R4616	MOVW	off+28(FP), R5617	MOVD	_cgo_mmap(SB), R9618	SUB	$16, RSP		// reserve 16 bytes for sp-8 where fp may be saved.619	BL	R9620	ADD	$16, RSP621	MOVD	R0, ret+32(FP)622	RET623624TEXT runtime·sysMunmap(SB),NOSPLIT|NOFRAME,$0625	MOVD	addr+0(FP), R0626	MOVD	n+8(FP), R1627	MOVD	$SYS_munmap, R8628	SVC629	CMN	$4095, R0630	BCC	cool631	MOVD	R0, 0xf0(R0)632cool:633	RET634635// Call the function stored in _cgo_munmap using the GCC calling convention.636// This must be called on the system stack.637TEXT runtime·callCgoMunmap(SB),NOSPLIT,$0638	MOVD	addr+0(FP), R0639	MOVD	n+8(FP), R1640	MOVD	_cgo_munmap(SB), R9641	SUB	$16, RSP		// reserve 16 bytes for sp-8 where fp may be saved.642	BL	R9643	ADD	$16, RSP644	RET645646TEXT runtime·madvise(SB),NOSPLIT|NOFRAME,$0647	MOVD	addr+0(FP), R0648	MOVD	n+8(FP), R1649	MOVW	flags+16(FP), R2650	MOVD	$SYS_madvise, R8651	SVC652	MOVW	R0, ret+24(FP)653	RET654655// int64 futex(int32 *uaddr, int32 op, int32 val,656//	struct timespec *timeout, int32 *uaddr2, int32 val2);657TEXT runtime·futex(SB),NOSPLIT|NOFRAME,$0658	MOVD	addr+0(FP), R0659	MOVW	op+8(FP), R1660	MOVW	val+12(FP), R2661	MOVD	ts+16(FP), R3662	MOVD	addr2+24(FP), R4663	MOVW	val3+32(FP), R5664	MOVD	$SYS_futex, R8665	SVC666	MOVW	R0, ret+40(FP)667	RET668669// int64 clone(int32 flags, void *stk, M *mp, G *gp, void (*fn)(void));670TEXT runtime·clone(SB),NOSPLIT|NOFRAME,$0671	MOVW	flags+0(FP), R0672	MOVD	stk+8(FP), R1673674	// Copy mp, gp, fn off parent stack for use by child.675	MOVD	mp+16(FP), R10676	MOVD	gp+24(FP), R11677	MOVD	fn+32(FP), R12678679	MOVD	R10, -8(R1)680	MOVD	R11, -16(R1)681	MOVD	R12, -24(R1)682	MOVD	$1234, R10683	MOVD	R10, -32(R1)684685	MOVD	$SYS_clone, R8686	SVC687688	// In parent, return.689	CMP	ZR, R0690	BEQ	child691	MOVW	R0, ret+40(FP)692	RET693child:694695	// In child, on new stack.696	MOVD	-32(RSP), R10697	MOVD	$1234, R0698	CMP	R0, R10699	BEQ	good700	MOVD	$0, R0701	MOVD	R0, (R0)	// crash702703good:704	// Initialize m->procid to Linux tid705	MOVD	$SYS_gettid, R8706	SVC707708	MOVD	-24(RSP), R12     // fn709	MOVD	-16(RSP), R11     // g710	MOVD	-8(RSP), R10      // m711712	CMP	$0, R10713	BEQ	nog714	CMP	$0, R11715	BEQ	nog716717	MOVD	R0, m_procid(R10)718719	// TODO: setup TLS.720721	// In child, set up new stack722	MOVD	R10, g_m(R11)723	MOVD	R11, g724	//CALL	runtime·stackcheck(SB)725726nog:727	// Call fn728	MOVD	R12, R0729	BL	(R0)730731	// It shouldn't return.	 If it does, exit that thread.732	MOVW	$111, R0733again:734	MOVD	$SYS_exit, R8735	SVC736	B	again	// keep exiting737738TEXT runtime·sigaltstack(SB),NOSPLIT|NOFRAME,$0739	MOVD	new+0(FP), R0740	MOVD	old+8(FP), R1741	MOVD	$SYS_sigaltstack, R8742	SVC743	CMN	$4095, R0744	BCC	ok745	MOVD	$0, R0746	MOVD	R0, (R0)	// crash747ok:748	RET749750TEXT runtime·osyield(SB),NOSPLIT|NOFRAME,$0751	MOVD	$SYS_sched_yield, R8752	SVC753	RET754755TEXT runtime·sched_getaffinity(SB),NOSPLIT|NOFRAME,$0756	MOVD	pid+0(FP), R0757	MOVD	len+8(FP), R1758	MOVD	buf+16(FP), R2759	MOVD	$SYS_sched_getaffinity, R8760	SVC761	MOVW	R0, ret+24(FP)762	RET763764// int access(const char *name, int mode)765TEXT runtime·access(SB),NOSPLIT,$0-20766	MOVD	$AT_FDCWD, R0767	MOVD	name+0(FP), R1768	MOVW	mode+8(FP), R2769	MOVD	$SYS_faccessat, R8770	SVC771	MOVW	R0, ret+16(FP)772	RET773774// int connect(int fd, const struct sockaddr *addr, socklen_t len)775TEXT runtime·connect(SB),NOSPLIT,$0-28776	MOVW	fd+0(FP), R0777	MOVD	addr+8(FP), R1778	MOVW	len+16(FP), R2779	MOVD	$SYS_connect, R8780	SVC781	MOVW	R0, ret+24(FP)782	RET783784// int socket(int domain, int typ, int prot)785TEXT runtime·socket(SB),NOSPLIT,$0-20786	MOVW	domain+0(FP), R0787	MOVW	typ+4(FP), R1788	MOVW	prot+8(FP), R2789	MOVD	$SYS_socket, R8790	SVC791	MOVW	R0, ret+16(FP)792	RET793794// func sbrk0() uintptr795TEXT runtime·sbrk0(SB),NOSPLIT,$0-8796	// Implemented as brk(NULL).797	MOVD	$0, R0798	MOVD	$SYS_brk, R8799	SVC800	MOVD	R0, ret+0(FP)801	RET802803// func vgetrandom1(buf *byte, length uintptr, flags uint32, state uintptr, stateSize uintptr) int804TEXT runtime·vgetrandom1<ABIInternal>(SB),NOSPLIT,$16-48805	MOVD	RSP, R20806807	MOVD	runtime·vdsoGetrandomSym(SB), R8808	MOVD	g_m(g), R21809810	MOVD	m_vdsoPC(R21), R9811	MOVD	R9, 8(RSP)812	MOVD	m_vdsoSP(R21), R9813	MOVD	R9, 16(RSP)814	MOVD	LR, m_vdsoPC(R21)815	MOVD	$buf-8(FP), R9816	MOVD	R9, m_vdsoSP(R21)817818	MOVD	RSP, R9819	BIC	$15, R9820	MOVD	R9, RSP821822	MOVBU	runtime·iscgo(SB), R9823	CBNZ	R9, nosaveg824	MOVD	m_gsignal(R21), R9825	CBZ	R9, nosaveg826	CMP	g, R9827	BEQ	nosaveg828	MOVD	(g_stack+stack_lo)(R9), R22829	MOVD	g, (R22)830831	BL	(R8)832833	MOVD	ZR, (R22)834	B	restore835836nosaveg:837	BL	(R8)838839restore:840	MOVD	R20, RSP841	MOVD	16(RSP), R1842	MOVD	R1, m_vdsoSP(R21)843	MOVD	8(RSP), R1844	MOVD	R1, m_vdsoPC(R21)845	NOP	R0 // Satisfy go vet, since the return value comes from the vDSO function.846	RET

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.