Black Lives Matter. Support the Equal Justice Initiative.

Text file src/runtime/libfuzzer_arm64.s

Documentation: runtime

     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  // +build libfuzzer
     7  
     8  #include "go_asm.h"
     9  #include "textflag.h"
    10  
    11  // Based on race_arm64.s; see commentary there.
    12  
    13  // func runtime·libfuzzerCall(fn, arg0, arg1 uintptr)
    14  // Calls C function fn from libFuzzer and passes 2 arguments to it.
    15  TEXT	runtime·libfuzzerCall(SB), NOSPLIT, $0-24
    16  	MOVD	fn+0(FP), R9
    17  	MOVD	arg0+8(FP), R0
    18  	MOVD	arg1+16(FP), R1
    19  
    20  	MOVD	g_m(g), R10
    21  
    22  	// Switch to g0 stack.
    23  	MOVD	RSP, R19	// callee-saved, preserved across the CALL
    24  	MOVD	m_g0(R10), R11
    25  	CMP	R11, g
    26  	BEQ	call	// already on g0
    27  	MOVD	(g_sched+gobuf_sp)(R11), R12
    28  	MOVD	R12, RSP
    29  call:
    30  	BL	R9
    31  	MOVD	R19, RSP
    32  	RET
    33  

View as plain text