Source file
src/runtime/defs_windows_amd64.go
1
2
3
4
5 package runtime
6
7 const _CONTEXT_CONTROL = 0x100001
8
9 type m128a struct {
10 low uint64
11 high int64
12 }
13
14 type context struct {
15 p1home uint64
16 p2home uint64
17 p3home uint64
18 p4home uint64
19 p5home uint64
20 p6home uint64
21 contextflags uint32
22 mxcsr uint32
23 segcs uint16
24 segds uint16
25 seges uint16
26 segfs uint16
27 seggs uint16
28 segss uint16
29 eflags uint32
30 dr0 uint64
31 dr1 uint64
32 dr2 uint64
33 dr3 uint64
34 dr6 uint64
35 dr7 uint64
36 rax uint64
37 rcx uint64
38 rdx uint64
39 rbx uint64
40 rsp uint64
41 rbp uint64
42 rsi uint64
43 rdi uint64
44 r8 uint64
45 r9 uint64
46 r10 uint64
47 r11 uint64
48 r12 uint64
49 r13 uint64
50 r14 uint64
51 r15 uint64
52 rip uint64
53 anon0 [512]byte
54 vectorregister [26]m128a
55 vectorcontrol uint64
56 debugcontrol uint64
57 lastbranchtorip uint64
58 lastbranchfromrip uint64
59 lastexceptiontorip uint64
60 lastexceptionfromrip uint64
61 }
62
63 func (c *context) ip() uintptr { return uintptr(c.rip) }
64 func (c *context) sp() uintptr { return uintptr(c.rsp) }
65
66
67 func (c *context) lr() uintptr { return 0 }
68 func (c *context) set_lr(x uintptr) {}
69
70 func (c *context) set_ip(x uintptr) { c.rip = uint64(x) }
71 func (c *context) set_sp(x uintptr) { c.rsp = uint64(x) }
72 func (c *context) set_fp(x uintptr) { c.rbp = uint64(x) }
73
74 func prepareContextForSigResume(c *context) {
75 c.r8 = c.rsp
76 c.r9 = c.rip
77 }
78
79 func dumpregs(r *context) {
80 print("rax ", hex(r.rax), "\n")
81 print("rbx ", hex(r.rbx), "\n")
82 print("rcx ", hex(r.rcx), "\n")
83 print("rdx ", hex(r.rdx), "\n")
84 print("rdi ", hex(r.rdi), "\n")
85 print("rsi ", hex(r.rsi), "\n")
86 print("rbp ", hex(r.rbp), "\n")
87 print("rsp ", hex(r.rsp), "\n")
88 print("r8 ", hex(r.r8), "\n")
89 print("r9 ", hex(r.r9), "\n")
90 print("r10 ", hex(r.r10), "\n")
91 print("r11 ", hex(r.r11), "\n")
92 print("r12 ", hex(r.r12), "\n")
93 print("r13 ", hex(r.r13), "\n")
94 print("r14 ", hex(r.r14), "\n")
95 print("r15 ", hex(r.r15), "\n")
96 print("rip ", hex(r.rip), "\n")
97 print("rflags ", hex(r.eflags), "\n")
98 print("cs ", hex(r.segcs), "\n")
99 print("fs ", hex(r.segfs), "\n")
100 print("gs ", hex(r.seggs), "\n")
101 }
102
103 type _DISPATCHER_CONTEXT struct {
104 controlPc uint64
105 imageBase uint64
106 functionEntry uintptr
107 establisherFrame uint64
108 targetIp uint64
109 context *context
110 languageHandler uintptr
111 handlerData uintptr
112 }
113
114 func (c *_DISPATCHER_CONTEXT) ctx() *context {
115 return c.context
116 }
117
View as plain text