1// Copyright 2016 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 mips mipsle
6
7#include "go_asm.h"
8#include "go_tls.h"
9#include "funcdata.h"
10#include "textflag.h"
11
12// If !iscgo, this is a no-op.
13// NOTE: gogo asumes load_g only clobers g (R30) and REGTMP (R23)
14TEXT runtime·save_g(SB),NOSPLIT|NOFRAME,$0-0
15	MOVB	runtime·iscgo(SB), R23
16	BEQ	R23, nocgo
17
18	MOVW	R3, R23
19	MOVW	g, runtime·tls_g(SB) // TLS relocation clobbers R3
20	MOVW	R23, R3
21
22nocgo:
23	RET
24
25TEXT runtime·load_g(SB),NOSPLIT|NOFRAME,$0-0
26	MOVW	runtime·tls_g(SB), g // TLS relocation clobbers R3
27	RET
28
29GLOBL runtime·tls_g(SB), TLSBSS, $4
30