...
Source file
src/runtime/signal_linux_386.go
Documentation: runtime
1
2
3
4
5 package runtime
6
7 import (
8 "internal/goarch"
9 "unsafe"
10 )
11
12 type sigctxt struct {
13 info *siginfo
14 ctxt unsafe.Pointer
15 }
16
17
18
19 func (c *sigctxt) regs() *sigcontext { return &(*ucontext)(c.ctxt).uc_mcontext }
20
21 func (c *sigctxt) eax() uint32 { return c.regs().eax }
22 func (c *sigctxt) ebx() uint32 { return c.regs().ebx }
23 func (c *sigctxt) ecx() uint32 { return c.regs().ecx }
24 func (c *sigctxt) edx() uint32 { return c.regs().edx }
25 func (c *sigctxt) edi() uint32 { return c.regs().edi }
26 func (c *sigctxt) esi() uint32 { return c.regs().esi }
27 func (c *sigctxt) ebp() uint32 { return c.regs().ebp }
28 func (c *sigctxt) esp() uint32 { return c.regs().esp }
29
30
31
32 func (c *sigctxt) eip() uint32 { return c.regs().eip }
33
34 func (c *sigctxt) eflags() uint32 { return c.regs().eflags }
35 func (c *sigctxt) cs() uint32 { return uint32(c.regs().cs) }
36 func (c *sigctxt) fs() uint32 { return uint32(c.regs().fs) }
37 func (c *sigctxt) gs() uint32 { return uint32(c.regs().gs) }
38 func (c *sigctxt) sigcode() uint32 { return uint32(c.info.si_code) }
39 func (c *sigctxt) sigaddr() uint32 { return c.info.si_addr }
40
41 func (c *sigctxt) set_eip(x uint32) { c.regs().eip = x }
42 func (c *sigctxt) set_esp(x uint32) { c.regs().esp = x }
43 func (c *sigctxt) set_sigcode(x uint32) { c.info.si_code = int32(x) }
44 func (c *sigctxt) set_sigaddr(x uint32) {
45 *(*uintptr)(add(unsafe.Pointer(c.info), 2*goarch.PtrSize)) = uintptr(x)
46 }
47
View as plain text