...

Text file src/runtime/msan_arm64.s

Documentation: runtime

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

View as plain text