From 82a2f825b7163eafebbf9b8640ef6406e4dda9a9 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Thu, 23 Jan 2020 03:42:07 +1100 Subject: [PATCH] runtime: add missing code for linux/riscv64 Makes linux/riscv64 runtime buildable. Updates #27532 Change-Id: I91bcadaaecb8ff3ffd70fcb437b2b6e4bbe11eda Reviewed-on: https://go-review.googlesource.com/c/go/+/215839 Run-TryBot: Joel Sing TryBot-Result: Gobot Gobot Reviewed-by: Cherry Zhang --- src/runtime/mkpreempt.go | 6 ++++++ src/runtime/mpagealloc_64bit.go | 2 +- src/runtime/os_linux_riscv64.go | 7 +++++++ src/runtime/preempt_riscv64.s | 8 ++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/runtime/os_linux_riscv64.go create mode 100644 src/runtime/preempt_riscv64.s diff --git a/src/runtime/mkpreempt.go b/src/runtime/mkpreempt.go index 615ec1868c..64e220772e 100644 --- a/src/runtime/mkpreempt.go +++ b/src/runtime/mkpreempt.go @@ -83,6 +83,7 @@ var arches = map[string]func(){ "mips64x": func() { genMIPS(true) }, "mipsx": func() { genMIPS(false) }, "ppc64x": genPPC64, + "riscv64": genRISCV64, "s390x": genS390X, "wasm": genWasm, } @@ -478,6 +479,11 @@ func genPPC64() { p("JMP (CTR)") } +func genRISCV64() { + p("// No async preemption on riscv64 - see issue 36711") + p("UNDEF") +} + func genS390X() { // Add integer registers R0-R12 // R13 (g), R14 (LR), R15 (SP) are special, and not saved here. diff --git a/src/runtime/mpagealloc_64bit.go b/src/runtime/mpagealloc_64bit.go index 86883bef35..0b475ed206 100644 --- a/src/runtime/mpagealloc_64bit.go +++ b/src/runtime/mpagealloc_64bit.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64 !darwin,arm64 mips64 mips64le ppc64 ppc64le s390x +// +build amd64 !darwin,arm64 mips64 mips64le ppc64 ppc64le riscv64 s390x // See mpagealloc_32bit.go for why darwin/arm64 is excluded here. diff --git a/src/runtime/os_linux_riscv64.go b/src/runtime/os_linux_riscv64.go new file mode 100644 index 0000000000..9be88a5ad2 --- /dev/null +++ b/src/runtime/os_linux_riscv64.go @@ -0,0 +1,7 @@ +// Copyright 2019 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. + +package runtime + +func osArchInit() {} diff --git a/src/runtime/preempt_riscv64.s b/src/runtime/preempt_riscv64.s new file mode 100644 index 0000000000..80c0636c7a --- /dev/null +++ b/src/runtime/preempt_riscv64.s @@ -0,0 +1,8 @@ +// Code generated by mkpreempt.go; DO NOT EDIT. + +#include "go_asm.h" +#include "textflag.h" + +TEXT ·asyncPreempt(SB),NOSPLIT|NOFRAME,$0-0 + // No async preemption on riscv64 - see issue 36711 + UNDEF -- 2.50.0