github.com/lzhfromustc/gofuzz@v0.0.0-20211116160056-151b3108bbd1/runtime/libfuzzer_arm64.s (about) 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 // +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