| 1 |
// Copyright 2013 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
package runtime |
| 6 |
|
| 7 |
import "unsafe" |
| 8 |
|
| 9 |
type sigctxt struct { |
| 10 |
info *siginfo |
| 11 |
ctxt unsafe.Pointer |
| 12 |
} |
| 13 |
|
| 14 |
//go:nosplit |
| 15 |
//go:nowritebarrierrec |
| 16 |
func (c *sigctxt) regs() *mcontext { return &(*ucontext)(c.ctxt).uc_mcontext } |
| 17 |
|
| 18 |
func (c *sigctxt) eax() uint32 { return c.regs().mc_eax } |
| 19 |
func (c *sigctxt) ebx() uint32 { return c.regs().mc_ebx } |
| 20 |
func (c *sigctxt) ecx() uint32 { return c.regs().mc_ecx } |
| 21 |
func (c *sigctxt) edx() uint32 { return c.regs().mc_edx } |
| 22 |
func (c *sigctxt) edi() uint32 { return c.regs().mc_edi } |
| 23 |
func (c *sigctxt) esi() uint32 { return c.regs().mc_esi } |
| 24 |
func (c *sigctxt) ebp() uint32 { return c.regs().mc_ebp } |
| 25 |
func (c *sigctxt) esp() uint32 { return c.regs().mc_esp } |
| 26 |
|
| 27 |
//go:nosplit |
| 28 |
//go:nowritebarrierrec |
| 29 |
func (c *sigctxt) eip() uint32 { return c.regs().mc_eip } |
| 30 |
|
| 31 |
func (c *sigctxt) eflags() uint32 { return c.regs().mc_eflags } |
| 32 |
func (c *sigctxt) cs() uint32 { return c.regs().mc_cs } |
| 33 |
func (c *sigctxt) fs() uint32 { return c.regs().mc_fs } |
| 34 |
func (c *sigctxt) gs() uint32 { return c.regs().mc_gs } |
| 35 |
func (c *sigctxt) sigcode() uint32 { return uint32(c.info.si_code) } |
| 36 |
func (c *sigctxt) sigaddr() uint32 { return uint32(c.info.si_addr) } |
| 37 |
|
| 38 |
func (c *sigctxt) set_eip(x uint32) { c.regs().mc_eip = x } |
| 39 |
func (c *sigctxt) set_esp(x uint32) { c.regs().mc_esp = x } |
| 40 |
func (c *sigctxt) set_sigcode(x uint32) { c.info.si_code = int32(x) } |
| 41 |
func (c *sigctxt) set_sigaddr(x uint32) { c.info.si_addr = uintptr(x) } |