Skip to content

Commit

Permalink
runtime: load/save TLS variable g on loong64
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
XiaodongLoong authored and ianlancetaylor committed May 17, 2022
1 parent 13147f7 commit 7607888
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/runtime/stubs_loong64.go
Original file line number Diff line number Diff line change
@@ -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()
26 changes: 26 additions & 0 deletions src/runtime/tls_loong64.s
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7607888

Please sign in to comment.