...

Text file src/runtime/msan_loong64.s

Documentation: runtime

     1// Copyright 2023 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 R4
    11#define RARG1 R5
    12#define RARG2 R6
    13#define FARG  R7
    14
    15// func runtime·domsanread(addr unsafe.Pointer, sz uintptr)
    16// Called from msanread.
    17TEXT	runtime·domsanread(SB), NOSPLIT, $0-16
    18	MOVV	addr+0(FP), RARG0
    19	MOVV	sz+8(FP), RARG1
    20	// void __msan_read_go(void *addr, uintptr_t sz);
    21	MOVV	$__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	MOVV	addr+0(FP), RARG0
    28	MOVV	sz+8(FP), RARG1
    29	// void __msan_write_go(void *addr, uintptr_t sz);
    30	MOVV	$__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	MOVV	addr+0(FP), RARG0
    36	MOVV	sz+8(FP), RARG1
    37	// void __msan_malloc_go(void *addr, uintptr_t sz);
    38	MOVV	$__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	MOVV	addr+0(FP), RARG0
    44	MOVV	sz+8(FP), RARG1
    45	// void __msan_free_go(void *addr, uintptr_t sz);
    46	MOVV	$__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	MOVV	dst+0(FP), RARG0
    52	MOVV	src+8(FP), RARG1
    53	MOVV	sz+16(FP), RARG2
    54	// void __msan_memmove(void *dst, void *src, uintptr_t sz);
    55	MOVV	$__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	MOVV	R3, R23         // callee-saved
    61	BEQ	g, g0stack      // no g, still on a system stack
    62	MOVV	g_m(g), R14
    63	MOVV	m_g0(R14), R15
    64	BEQ	R15, g, g0stack
    65
    66	MOVV	(g_sched+gobuf_sp)(R15), R9
    67	MOVV	R9, R3
    68
    69g0stack:
    70	JAL	(FARG)
    71	MOVV	R23, R3
    72	RET

View as plain text