github.com/aloncn/graphics-go@v0.0.1/src/runtime/signal_openbsd_amd64.go (about)

     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  func (c *sigctxt) regs() *sigcontext {
    15  	return (*sigcontext)(c.ctxt)
    16  }
    17  
    18  func (c *sigctxt) rax() uint64     { return c.regs().sc_rax }
    19  func (c *sigctxt) rbx() uint64     { return c.regs().sc_rbx }
    20  func (c *sigctxt) rcx() uint64     { return c.regs().sc_rcx }
    21  func (c *sigctxt) rdx() uint64     { return c.regs().sc_rdx }
    22  func (c *sigctxt) rdi() uint64     { return c.regs().sc_rdi }
    23  func (c *sigctxt) rsi() uint64     { return c.regs().sc_rsi }
    24  func (c *sigctxt) rbp() uint64     { return c.regs().sc_rbp }
    25  func (c *sigctxt) rsp() uint64     { return c.regs().sc_rsp }
    26  func (c *sigctxt) r8() uint64      { return c.regs().sc_r8 }
    27  func (c *sigctxt) r9() uint64      { return c.regs().sc_r9 }
    28  func (c *sigctxt) r10() uint64     { return c.regs().sc_r10 }
    29  func (c *sigctxt) r11() uint64     { return c.regs().sc_r11 }
    30  func (c *sigctxt) r12() uint64     { return c.regs().sc_r12 }
    31  func (c *sigctxt) r13() uint64     { return c.regs().sc_r13 }
    32  func (c *sigctxt) r14() uint64     { return c.regs().sc_r14 }
    33  func (c *sigctxt) r15() uint64     { return c.regs().sc_r15 }
    34  func (c *sigctxt) rip() uint64     { return c.regs().sc_rip }
    35  func (c *sigctxt) rflags() uint64  { return c.regs().sc_rflags }
    36  func (c *sigctxt) cs() uint64      { return c.regs().sc_cs }
    37  func (c *sigctxt) fs() uint64      { return c.regs().sc_fs }
    38  func (c *sigctxt) gs() uint64      { return c.regs().sc_gs }
    39  func (c *sigctxt) sigcode() uint64 { return uint64(c.info.si_code) }
    40  func (c *sigctxt) sigaddr() uint64 {
    41  	return *(*uint64)(add(unsafe.Pointer(c.info), 16))
    42  }
    43  
    44  func (c *sigctxt) set_rip(x uint64)     { c.regs().sc_rip = x }
    45  func (c *sigctxt) set_rsp(x uint64)     { c.regs().sc_rsp = x }
    46  func (c *sigctxt) set_sigcode(x uint64) { c.info.si_code = int32(x) }
    47  func (c *sigctxt) set_sigaddr(x uint64) {
    48  	*(*uint64)(add(unsafe.Pointer(c.info), 16)) = x
    49  }