Source file
src/runtime/defs_windows_arm64.go
1
2
3
4
5 package runtime
6
7 import (
8 "internal/goarch"
9 "unsafe"
10 )
11
12
13
14
15
16
17
18 const _CONTEXT_CONTROL = 0x400003
19
20 type neon128 struct {
21 low uint64
22 high int64
23 }
24
25
26 type context struct {
27 contextflags uint32
28 cpsr uint32
29 x [31]uint64
30 xsp uint64
31 pc uint64
32 v [32]neon128
33 fpcr uint32
34 fpsr uint32
35 bcr [8]uint32
36 bvr [8]uint64
37 wcr [2]uint32
38 wvr [2]uint64
39 }
40
41 func (c *context) ip() uintptr { return uintptr(c.pc) }
42 func (c *context) sp() uintptr { return uintptr(c.xsp) }
43 func (c *context) lr() uintptr { return uintptr(c.x[30]) }
44
45 func (c *context) set_ip(x uintptr) { c.pc = uint64(x) }
46 func (c *context) set_sp(x uintptr) { c.xsp = uint64(x) }
47 func (c *context) set_lr(x uintptr) { c.x[30] = uint64(x) }
48 func (c *context) set_fp(x uintptr) { c.x[29] = uint64(x) }
49
50 func (c *context) pushCall(targetPC, resumePC uintptr) {
51
52
53
54
55 sp := c.sp() - goarch.StackAlign
56 c.set_sp(sp)
57 *(*uint64)(unsafe.Pointer(sp)) = uint64(c.lr())
58 c.set_lr(resumePC)
59 c.set_ip(targetPC)
60 }
61
62 func prepareContextForSigResume(c *context) {
63 c.x[0] = c.xsp
64 c.x[1] = c.pc
65 }
66
67 func dumpregs(r *context) {
68 print("r0 ", hex(r.x[0]), "\n")
69 print("r1 ", hex(r.x[1]), "\n")
70 print("r2 ", hex(r.x[2]), "\n")
71 print("r3 ", hex(r.x[3]), "\n")
72 print("r4 ", hex(r.x[4]), "\n")
73 print("r5 ", hex(r.x[5]), "\n")
74 print("r6 ", hex(r.x[6]), "\n")
75 print("r7 ", hex(r.x[7]), "\n")
76 print("r8 ", hex(r.x[8]), "\n")
77 print("r9 ", hex(r.x[9]), "\n")
78 print("r10 ", hex(r.x[10]), "\n")
79 print("r11 ", hex(r.x[11]), "\n")
80 print("r12 ", hex(r.x[12]), "\n")
81 print("r13 ", hex(r.x[13]), "\n")
82 print("r14 ", hex(r.x[14]), "\n")
83 print("r15 ", hex(r.x[15]), "\n")
84 print("r16 ", hex(r.x[16]), "\n")
85 print("r17 ", hex(r.x[17]), "\n")
86 print("r18 ", hex(r.x[18]), "\n")
87 print("r19 ", hex(r.x[19]), "\n")
88 print("r20 ", hex(r.x[20]), "\n")
89 print("r21 ", hex(r.x[21]), "\n")
90 print("r22 ", hex(r.x[22]), "\n")
91 print("r23 ", hex(r.x[23]), "\n")
92 print("r24 ", hex(r.x[24]), "\n")
93 print("r25 ", hex(r.x[25]), "\n")
94 print("r26 ", hex(r.x[26]), "\n")
95 print("r27 ", hex(r.x[27]), "\n")
96 print("r28 ", hex(r.x[28]), "\n")
97 print("r29 ", hex(r.x[29]), "\n")
98 print("lr ", hex(r.x[30]), "\n")
99 print("sp ", hex(r.xsp), "\n")
100 print("pc ", hex(r.pc), "\n")
101 print("cpsr ", hex(r.cpsr), "\n")
102 }
103
104 func stackcheck() {
105
106 }
107
108 type _DISPATCHER_CONTEXT struct {
109 controlPc uint64
110 imageBase uint64
111 functionEntry uintptr
112 establisherFrame uint64
113 targetIp uint64
114 context *context
115 languageHandler uintptr
116 handlerData uintptr
117 }
118
119 func (c *_DISPATCHER_CONTEXT) ctx() *context {
120 return c.context
121 }
122
View as plain text