Source file
src/runtime/defs_windows_arm.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 = 0x200003
19
20 type neon128 struct {
21 low uint64
22 high int64
23 }
24
25 type context struct {
26 contextflags uint32
27 r0 uint32
28 r1 uint32
29 r2 uint32
30 r3 uint32
31 r4 uint32
32 r5 uint32
33 r6 uint32
34 r7 uint32
35 r8 uint32
36 r9 uint32
37 r10 uint32
38 r11 uint32
39 r12 uint32
40
41 spr uint32
42 lrr uint32
43 pc uint32
44 cpsr uint32
45
46 fpscr uint32
47 padding uint32
48
49 floatNeon [16]neon128
50
51 bvr [8]uint32
52 bcr [8]uint32
53 wvr [1]uint32
54 wcr [1]uint32
55 padding2 [2]uint32
56 }
57
58 func (c *context) ip() uintptr { return uintptr(c.pc) }
59 func (c *context) sp() uintptr { return uintptr(c.spr) }
60 func (c *context) lr() uintptr { return uintptr(c.lrr) }
61
62 func (c *context) set_ip(x uintptr) { c.pc = uint32(x) }
63 func (c *context) set_sp(x uintptr) { c.spr = uint32(x) }
64 func (c *context) set_lr(x uintptr) { c.lrr = uint32(x) }
65
66
67 func (c *context) set_fp(x uintptr) {}
68
69 func (c *context) pushCall(targetPC, resumePC uintptr) {
70
71
72
73
74 sp := c.sp() - goarch.StackAlign
75 c.set_sp(sp)
76 *(*uint32)(unsafe.Pointer(sp)) = uint32(c.lr())
77 c.set_lr(resumePC)
78 c.set_ip(targetPC)
79 }
80
81 func prepareContextForSigResume(c *context) {
82 c.r0 = c.spr
83 c.r1 = c.pc
84 }
85
86 func dumpregs(r *context) {
87 print("r0 ", hex(r.r0), "\n")
88 print("r1 ", hex(r.r1), "\n")
89 print("r2 ", hex(r.r2), "\n")
90 print("r3 ", hex(r.r3), "\n")
91 print("r4 ", hex(r.r4), "\n")
92 print("r5 ", hex(r.r5), "\n")
93 print("r6 ", hex(r.r6), "\n")
94 print("r7 ", hex(r.r7), "\n")
95 print("r8 ", hex(r.r8), "\n")
96 print("r9 ", hex(r.r9), "\n")
97 print("r10 ", hex(r.r10), "\n")
98 print("r11 ", hex(r.r11), "\n")
99 print("r12 ", hex(r.r12), "\n")
100 print("sp ", hex(r.spr), "\n")
101 print("lr ", hex(r.lrr), "\n")
102 print("pc ", hex(r.pc), "\n")
103 print("cpsr ", hex(r.cpsr), "\n")
104 }
105
106 func stackcheck() {
107
108 }
109
110 type _DISPATCHER_CONTEXT struct {
111 controlPc uint32
112 imageBase uint32
113 functionEntry uintptr
114 establisherFrame uint32
115 targetIp uint32
116 context *context
117 languageHandler uintptr
118 handlerData uintptr
119 }
120
121 func (c *_DISPATCHER_CONTEXT) ctx() *context {
122 return c.context
123 }
124
View as plain text