From: Xiaodong Liu Date: Wed, 1 Dec 2021 07:48:53 +0000 (+0800) Subject: runtime: load/save TLS variable g on loong64 X-Git-Tag: go1.19beta1~203 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7607888df0eca35dadb0529960d7965d0d6f4072;p=gostls13.git runtime: load/save TLS variable g on loong64 Contributors to the loong64 port are: Weining Lu Lei Wang Lingqin Gong Xiaolin Zhao Meidan Li Xiaojuan Zhai Qiyuan Pu Guoqi Chen 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 Auto-Submit: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gopher Robot --- 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