Source file
src/runtime/defs_windows_386.go
1
2
3
4
5 package runtime
6
7 import (
8 "internal/goarch"
9 "unsafe"
10 )
11
12 const _CONTEXT_CONTROL = 0x10001
13
14 type floatingsavearea struct {
15 controlword uint32
16 statusword uint32
17 tagword uint32
18 erroroffset uint32
19 errorselector uint32
20 dataoffset uint32
21 dataselector uint32
22 registerarea [80]uint8
23 cr0npxstate uint32
24 }
25
26 type context struct {
27 contextflags uint32
28 dr0 uint32
29 dr1 uint32
30 dr2 uint32
31 dr3 uint32
32 dr6 uint32
33 dr7 uint32
34 floatsave floatingsavearea
35 seggs uint32
36 segfs uint32
37 seges uint32
38 segds uint32
39 edi uint32
40 esi uint32
41 ebx uint32
42 edx uint32
43 ecx uint32
44 eax uint32
45 ebp uint32
46 eip uint32
47 segcs uint32
48 eflags uint32
49 esp uint32
50 segss uint32
51 extendedregisters [512]uint8
52 }
53
54 func (c *context) ip() uintptr { return uintptr(c.eip) }
55 func (c *context) sp() uintptr { return uintptr(c.esp) }
56
57
58 func (c *context) lr() uintptr { return 0 }
59 func (c *context) set_lr(x uintptr) {}
60
61 func (c *context) set_ip(x uintptr) { c.eip = uint32(x) }
62 func (c *context) set_sp(x uintptr) { c.esp = uint32(x) }
63
64
65 func (c *context) set_fp(x uintptr) {}
66
67 func (c *context) pushCall(targetPC, resumePC uintptr) {
68 sp := c.sp() - goarch.StackAlign
69 *(*uintptr)(unsafe.Pointer(sp)) = resumePC
70 c.set_sp(sp)
71 c.set_ip(targetPC)
72 }
73
74 func prepareContextForSigResume(c *context) {
75 c.edx = c.esp
76 c.ecx = c.eip
77 }
78
79 func dumpregs(r *context) {
80 print("eax ", hex(r.eax), "\n")
81 print("ebx ", hex(r.ebx), "\n")
82 print("ecx ", hex(r.ecx), "\n")
83 print("edx ", hex(r.edx), "\n")
84 print("edi ", hex(r.edi), "\n")
85 print("esi ", hex(r.esi), "\n")
86 print("ebp ", hex(r.ebp), "\n")
87 print("esp ", hex(r.esp), "\n")
88 print("eip ", hex(r.eip), "\n")
89 print("eflags ", hex(r.eflags), "\n")
90 print("cs ", hex(r.segcs), "\n")
91 print("fs ", hex(r.segfs), "\n")
92 print("gs ", hex(r.seggs), "\n")
93 }
94
95
96 type _DISPATCHER_CONTEXT struct{}
97
98 func (c *_DISPATCHER_CONTEXT) ctx() *context {
99 return nil
100 }
101
View as plain text