...

Text file src/pkg/runtime/msan_arm64.s

     1	// Copyright 2018 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 msan
     6	
     7	#include "go_asm.h"
     8	#include "textflag.h"
     9	
    10	#define RARG0 R0
    11	#define RARG1 R1
    12	#define FARG R3
    13	
    14	// func runtime·domsanread(addr unsafe.Pointer, sz uintptr)
    15	// Called from msanread.
    16	TEXT	runtime·domsanread(SB), NOSPLIT, $0-16
    17		MOVD	addr+0(FP), RARG0
    18		MOVD	size+8(FP), RARG1
    19		// void __msan_read_go(void *addr, uintptr_t sz);
    20		MOVD	$__msan_read_go(SB), FARG
    21		JMP	msancall<>(SB)
    22	
    23	// func runtime·msanwrite(addr unsafe.Pointer, sz uintptr)
    24	// Called from instrumented code.
    25	TEXT	runtime·msanwrite(SB), NOSPLIT, $0-16
    26		MOVD	addr+0(FP), RARG0
    27		MOVD	size+8(FP), RARG1
    28		// void __msan_write_go(void *addr, uintptr_t sz);
    29		MOVD	$__msan_write_go(SB), FARG
    30		JMP	msancall<>(SB)
    31	
    32	// func runtime·msanmalloc(addr unsafe.Pointer, sz uintptr)
    33	TEXT	runtime·msanmalloc(SB), NOSPLIT, $0-16
    34		MOVD	addr+0(FP), RARG0
    35		MOVD	size+8(FP), RARG1
    36		// void __msan_malloc_go(void *addr, uintptr_t sz);
    37		MOVD	$__msan_malloc_go(SB), FARG
    38		JMP	msancall<>(SB)
    39	
    40	// func runtime·msanfree(addr unsafe.Pointer, sz uintptr)
    41	TEXT	runtime·msanfree(SB), NOSPLIT, $0-16
    42		MOVD	addr+0(FP), RARG0
    43		MOVD	size+8(FP), RARG1
    44		// void __msan_free_go(void *addr, uintptr_t sz);
    45		MOVD	$__msan_free_go(SB), FARG
    46		JMP	msancall<>(SB)
    47	
    48	// Switches SP to g0 stack and calls (FARG). Arguments already set.
    49	TEXT	msancall<>(SB), NOSPLIT, $0-0
    50		MOVD	g_m(g), R10
    51		MOVD	m_g0(R10), R11
    52		MOVD	RSP, R19	// callee-saved
    53		CMP	R11, g
    54		BEQ	g0stack
    55	
    56		MOVD	(g_sched+gobuf_sp)(R11), R4
    57		MOVD	R4, RSP
    58	
    59	g0stack:
    60		BL	(FARG)
    61		MOVD	R19, RSP
    62		RET

View as plain text