]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: load/save TLS variable g on loong64
authorXiaodong Liu <liuxiaodong@loongson.cn>
Wed, 1 Dec 2021 07:48:53 +0000 (15:48 +0800)
committerIan Lance Taylor <iant@golang.org>
Tue, 17 May 2022 20:18:25 +0000 (20:18 +0000)
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>

src/runtime/stubs_loong64.go [new file with mode: 0644]
src/runtime/tls_loong64.s [new file with mode: 0644]

diff --git a/src/runtime/stubs_loong64.go b/src/runtime/stubs_loong64.go
new file mode 100644 (file)
index 0000000..22366f5
--- /dev/null
@@ -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 (file)
index 0000000..bc3be3d
--- /dev/null
@@ -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