From f6ad4dcef54c5ce997a4bad5a6d86de229015700 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 16 Apr 2024 21:25:22 +0200 Subject: Adding upstream version 1.22.1. Signed-off-by: Daniel Baumann --- src/runtime/signal_freebsd_riscv64.go | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/runtime/signal_freebsd_riscv64.go (limited to 'src/runtime/signal_freebsd_riscv64.go') diff --git a/src/runtime/signal_freebsd_riscv64.go b/src/runtime/signal_freebsd_riscv64.go new file mode 100644 index 0000000..fbf6c63 --- /dev/null +++ b/src/runtime/signal_freebsd_riscv64.go @@ -0,0 +1,63 @@ +// 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. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} + +//go:nosplit +//go:nowritebarrierrec +func (c *sigctxt) regs() *mcontext { return &(*ucontext)(c.ctxt).uc_mcontext } + +func (c *sigctxt) ra() uint64 { return c.regs().mc_gpregs.gp_ra } +func (c *sigctxt) sp() uint64 { return c.regs().mc_gpregs.gp_sp } +func (c *sigctxt) gp() uint64 { return c.regs().mc_gpregs.gp_gp } +func (c *sigctxt) tp() uint64 { return c.regs().mc_gpregs.gp_tp } +func (c *sigctxt) t0() uint64 { return c.regs().mc_gpregs.gp_t[0] } +func (c *sigctxt) t1() uint64 { return c.regs().mc_gpregs.gp_t[1] } +func (c *sigctxt) t2() uint64 { return c.regs().mc_gpregs.gp_t[2] } +func (c *sigctxt) s0() uint64 { return c.regs().mc_gpregs.gp_s[0] } +func (c *sigctxt) s1() uint64 { return c.regs().mc_gpregs.gp_s[1] } +func (c *sigctxt) a0() uint64 { return c.regs().mc_gpregs.gp_a[0] } +func (c *sigctxt) a1() uint64 { return c.regs().mc_gpregs.gp_a[1] } +func (c *sigctxt) a2() uint64 { return c.regs().mc_gpregs.gp_a[2] } +func (c *sigctxt) a3() uint64 { return c.regs().mc_gpregs.gp_a[3] } +func (c *sigctxt) a4() uint64 { return c.regs().mc_gpregs.gp_a[4] } +func (c *sigctxt) a5() uint64 { return c.regs().mc_gpregs.gp_a[5] } +func (c *sigctxt) a6() uint64 { return c.regs().mc_gpregs.gp_a[6] } +func (c *sigctxt) a7() uint64 { return c.regs().mc_gpregs.gp_a[7] } +func (c *sigctxt) s2() uint64 { return c.regs().mc_gpregs.gp_s[2] } +func (c *sigctxt) s3() uint64 { return c.regs().mc_gpregs.gp_s[3] } +func (c *sigctxt) s4() uint64 { return c.regs().mc_gpregs.gp_s[4] } +func (c *sigctxt) s5() uint64 { return c.regs().mc_gpregs.gp_s[5] } +func (c *sigctxt) s6() uint64 { return c.regs().mc_gpregs.gp_s[6] } +func (c *sigctxt) s7() uint64 { return c.regs().mc_gpregs.gp_s[7] } +func (c *sigctxt) s8() uint64 { return c.regs().mc_gpregs.gp_s[8] } +func (c *sigctxt) s9() uint64 { return c.regs().mc_gpregs.gp_s[9] } +func (c *sigctxt) s10() uint64 { return c.regs().mc_gpregs.gp_s[10] } +func (c *sigctxt) s11() uint64 { return c.regs().mc_gpregs.gp_s[11] } +func (c *sigctxt) t3() uint64 { return c.regs().mc_gpregs.gp_t[3] } +func (c *sigctxt) t4() uint64 { return c.regs().mc_gpregs.gp_t[4] } +func (c *sigctxt) t5() uint64 { return c.regs().mc_gpregs.gp_t[5] } +func (c *sigctxt) t6() uint64 { return c.regs().mc_gpregs.gp_t[6] } + +//go:nosplit +//go:nowritebarrierrec +func (c *sigctxt) pc() uint64 { return c.regs().mc_gpregs.gp_sepc } + +func (c *sigctxt) sigcode() uint64 { return uint64(c.info.si_code) } +func (c *sigctxt) sigaddr() uint64 { return c.info.si_addr } + +func (c *sigctxt) set_pc(x uint64) { c.regs().mc_gpregs.gp_sepc = x } +func (c *sigctxt) set_ra(x uint64) { c.regs().mc_gpregs.gp_ra = x } +func (c *sigctxt) set_sp(x uint64) { c.regs().mc_gpregs.gp_sp = x } +func (c *sigctxt) set_gp(x uint64) { c.regs().mc_gpregs.gp_gp = x } + +func (c *sigctxt) set_sigcode(x uint64) { c.info.si_code = int32(x) } +func (c *sigctxt) set_sigaddr(x uint64) { c.info.si_addr = x } -- cgit v1.2.3