Text file
src/runtime/libfuzzer_arm64.s
1 // Copyright 2019 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 //go:build libfuzzer
6
7 #include "go_asm.h"
8 #include "textflag.h"
9
10 // Based on race_arm64.s; see commentary there.
11
12 // func runtime·libfuzzerCall(fn, arg0, arg1 uintptr)
13 // Calls C function fn from libFuzzer and passes 2 arguments to it.
14 TEXT runtime·libfuzzerCall(SB), NOSPLIT, $0-24
15 MOVD fn+0(FP), R9
16 MOVD arg0+8(FP), R0
17 MOVD arg1+16(FP), R1
18
19 MOVD g_m(g), R10
20
21 // Switch to g0 stack.
22 MOVD RSP, R19 // callee-saved, preserved across the CALL
23 MOVD m_g0(R10), R11
24 CMP R11, g
25 BEQ call // already on g0
26 MOVD (g_sched+gobuf_sp)(R11), R12
27 MOVD R12, RSP
28 call:
29 BL R9
30 MOVD R19, RSP
31 RET
32
View as plain text