aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXiaodong Liu <liuxiaodong@loongson.cn>2021-12-01 15:48:53 +0800
committerIan Lance Taylor <iant@golang.org>2022-05-17 20:18:25 +0000
commit7607888df0eca35dadb0529960d7965d0d6f4072 (patch)
tree143a0ee002eb6c58be66a0fb8984baadae2294d7 /src
parent13147f744c4ed7900ef9b1c1ffb8bf674f06b052 (diff)
downloadgo-7607888df0eca35dadb0529960d7965d0d6f4072.tar.xz
runtime: load/save TLS variable g on loong64
Contributors to the loong64 port are: Weining Lu <luweining@loongson.cn> Lei Wang <wanglei@loongson.cn> Lingqin Gong <gonglingqin@loongson.cn> Xiaolin Zhao <zhaoxiaolin@loongson.cn> Meidan Li <limeidan@loongson.cn> Xiaojuan Zhai <zhaixiaojuan@loongson.cn> Qiyuan Pu <puqiyuan@loongson.cn> Guoqi Chen <chenguoqi@loongson.cn> This port has been updated to Go 1.15.6: https://github.com/loongson/go Updates #46229 Change-Id: I5e09759ce9201596e89a01fc4a6f7fd7e205449f Reviewed-on: https://go-review.googlesource.com/c/go/+/368074 Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/runtime/stubs_loong64.go11
-rw-r--r--src/runtime/tls_loong64.s26
2 files changed, 37 insertions, 0 deletions
diff --git a/src/runtime/stubs_loong64.go b/src/runtime/stubs_loong64.go
new file mode 100644
index 0000000000..22366f508c
--- /dev/null
+++ b/src/runtime/stubs_loong64.go
@@ -0,0 +1,11 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build loong64
+
+package runtime
+
+// Called from assembly only; declared for go vet.
+func load_g()
+func save_g()
diff --git a/src/runtime/tls_loong64.s b/src/runtime/tls_loong64.s
new file mode 100644
index 0000000000..bc3be3da1b
--- /dev/null
+++ b/src/runtime/tls_loong64.s
@@ -0,0 +1,26 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#include "go_asm.h"
+#include "go_tls.h"
+#include "funcdata.h"
+#include "textflag.h"
+
+// If !iscgo, this is a no-op.
+//
+// NOTE: mcall() assumes this clobbers only R30 (REGTMP).
+TEXT runtime·save_g(SB),NOSPLIT|NOFRAME,$0-0
+ MOVB runtime·iscgo(SB), R30
+ BEQ R30, nocgo
+
+ MOVV g, runtime·tls_g(SB)
+
+nocgo:
+ RET
+
+TEXT runtime·load_g(SB),NOSPLIT|NOFRAME,$0-0
+ MOVV runtime·tls_g(SB), g
+ RET
+
+GLOBL runtime·tls_g(SB), TLSBSS, $8