Source file
src/runtime/signal_riscv64.go
Documentation: runtime
1
2
3
4
5
6
7 package runtime
8
9 import (
10 "internal/abi"
11 "internal/goarch"
12 "unsafe"
13 )
14
15 func dumpregs(c *sigctxt) {
16 print("ra ", hex(c.ra()), "\t")
17 print("sp ", hex(c.sp()), "\n")
18 print("gp ", hex(c.gp()), "\t")
19 print("tp ", hex(c.tp()), "\n")
20 print("t0 ", hex(c.t0()), "\t")
21 print("t1 ", hex(c.t1()), "\n")
22 print("t2 ", hex(c.t2()), "\t")
23 print("s0 ", hex(c.s0()), "\n")
24 print("s1 ", hex(c.s1()), "\t")
25 print("a0 ", hex(c.a0()), "\n")
26 print("a1 ", hex(c.a1()), "\t")
27 print("a2 ", hex(c.a2()), "\n")
28 print("a3 ", hex(c.a3()), "\t")
29 print("a4 ", hex(c.a4()), "\n")
30 print("a5 ", hex(c.a5()), "\t")
31 print("a6 ", hex(c.a6()), "\n")
32 print("a7 ", hex(c.a7()), "\t")
33 print("s2 ", hex(c.s2()), "\n")
34 print("s3 ", hex(c.s3()), "\t")
35 print("s4 ", hex(c.s4()), "\n")
36 print("s5 ", hex(c.s5()), "\t")
37 print("s6 ", hex(c.s6()), "\n")
38 print("s7 ", hex(c.s7()), "\t")
39 print("s8 ", hex(c.s8()), "\n")
40 print("s9 ", hex(c.s9()), "\t")
41 print("s10 ", hex(c.s10()), "\n")
42 print("s11 ", hex(c.s11()), "\t")
43 print("t3 ", hex(c.t3()), "\n")
44 print("t4 ", hex(c.t4()), "\t")
45 print("t5 ", hex(c.t5()), "\n")
46 print("t6 ", hex(c.t6()), "\t")
47 print("pc ", hex(c.pc()), "\n")
48 }
49
50
51
52 func (c *sigctxt) sigpc() uintptr { return uintptr(c.pc()) }
53
54 func (c *sigctxt) sigsp() uintptr { return uintptr(c.sp()) }
55 func (c *sigctxt) siglr() uintptr { return uintptr(c.ra()) }
56 func (c *sigctxt) fault() uintptr { return uintptr(c.sigaddr()) }
57
58
59 func (c *sigctxt) preparePanic(sig uint32, gp *g) {
60
61
62
63
64
65
66 sp := c.sp() - goarch.PtrSize
67 c.set_sp(sp)
68 *(*uint64)(unsafe.Pointer(uintptr(sp))) = c.ra()
69
70 pc := gp.sigpc
71
72 if shouldPushSigpanic(gp, pc, uintptr(c.ra())) {
73
74 c.set_ra(uint64(pc))
75 }
76
77
78 c.set_gp(uint64(uintptr(unsafe.Pointer(gp))))
79 c.set_pc(uint64(abi.FuncPCABIInternal(sigpanic)))
80 }
81
82 func (c *sigctxt) pushCall(targetPC, resumePC uintptr) {
83
84
85
86
87 sp := c.sp() - goarch.PtrSize
88 c.set_sp(sp)
89 *(*uint64)(unsafe.Pointer(uintptr(sp))) = c.ra()
90
91
92 c.set_ra(uint64(resumePC))
93 c.set_pc(uint64(targetPC))
94 }
95
View as plain text