]> Cypherpunks repositories - gostls13.git/commit
cmd/asm, cmd/internal/obj: add riscv64 generic CSR ops
authorMark Ryan <markdryan@rivosinc.com>
Wed, 18 Sep 2024 08:14:04 +0000 (10:14 +0200)
committerMark Ryan <markdryan@rivosinc.com>
Fri, 12 Sep 2025 08:12:45 +0000 (01:12 -0700)
commitdd8276657f2244193d399f01941ee1d76a79529d
tree877098f761a79bb62ceb8412ca90facf999c4907
parentf37d75472dde87008b94d32a22495368959ac4d3
cmd/asm, cmd/internal/obj: add riscv64 generic CSR ops

Support is added for the generic RISC-V CSR operations; CSRRC, CSRRCI,
CSRRS, CSRRSI, CSRRW, CSRRWI.  These instructions require special
handling as their second operand is a symbolic CSR register name and
not an immediate value or a register.  CSR names are implemented as
special operands.

RISC-V CSRs are not currently saved and restored when a go routine is
asynchronously pre-empted so it is only safe to use these instructions
in hand written assembler.  Note that CSRRS was already partially
supported by the assembler so this restriction predates this commit.
We mention it here as this commit makes CSRRS much easier to use.

Change-Id: I9ff8d804328b418a879d463e7d9cc31f489c7a00
Reviewed-on: https://go-review.googlesource.com/c/go/+/630519
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/cmd/asm/internal/arch/riscv64.go
src/cmd/asm/internal/asm/asm.go
src/cmd/asm/internal/asm/testdata/riscv64.s
src/cmd/asm/internal/asm/testdata/riscv64error.s
src/cmd/internal/obj/link.go
src/cmd/internal/obj/riscv/cpu.go
src/cmd/internal/obj/riscv/list.go
src/cmd/internal/obj/riscv/obj.go