github.com/flyinox/gosm@v0.0.0-20171117061539-16768cb62077/src/runtime/signal_solaris_amd64.go (about)

     1  // Copyright 2014 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 {
    17  	return (*mcontext)(unsafe.Pointer(&(*ucontext)(c.ctxt).uc_mcontext))
    18  }
    19  
    20  func (c *sigctxt) rax() uint64 { return uint64(c.regs().gregs[_REG_RAX]) }
    21  func (c *sigctxt) rbx() uint64 { return uint64(c.regs().gregs[_REG_RBX]) }
    22  func (c *sigctxt) rcx() uint64 { return uint64(c.regs().gregs[_REG_RCX]) }
    23  func (c *sigctxt) rdx() uint64 { return uint64(c.regs().gregs[_REG_RDX]) }
    24  func (c *sigctxt) rdi() uint64 { return uint64(c.regs().gregs[_REG_RDI]) }
    25  func (c *sigctxt) rsi() uint64 { return uint64(c.regs().gregs[_REG_RSI]) }
    26  func (c *sigctxt) rbp() uint64 { return uint64(c.regs().gregs[_REG_RBP]) }
    27  func (c *sigctxt) rsp() uint64 { return uint64(c.regs().gregs[_REG_RSP]) }
    28  func (c *sigctxt) r8() uint64  { return uint64(c.regs().gregs[_REG_R8]) }
    29  func (c *sigctxt) r9() uint64  { return uint64(c.regs().gregs[_REG_R9]) }
    30  func (c *sigctxt) r10() uint64 { return uint64(c.regs().gregs[_REG_R10]) }
    31  func (c *sigctxt) r11() uint64 { return uint64(c.regs().gregs[_REG_R11]) }
    32  func (c *sigctxt) r12() uint64 { return uint64(c.regs().gregs[_REG_R12]) }
    33  func (c *sigctxt) r13() uint64 { return uint64(c.regs().gregs[_REG_R13]) }
    34  func (c *sigctxt) r14() uint64 { return uint64(c.regs().gregs[_REG_R14]) }
    35  func (c *sigctxt) r15() uint64 { return uint64(c.regs().gregs[_REG_R15]) }
    36  
    37  //go:nosplit
    38  //go:nowritebarrierrec
    39  func (c *sigctxt) rip() uint64 { return uint64(c.regs().gregs[_REG_RIP]) }
    40  
    41  func (c *sigctxt) rflags() uint64  { return uint64(c.regs().gregs[_REG_RFLAGS]) }
    42  func (c *sigctxt) cs() uint64      { return uint64(c.regs().gregs[_REG_CS]) }
    43  func (c *sigctxt) fs() uint64      { return uint64(c.regs().gregs[_REG_FS]) }
    44  func (c *sigctxt) gs() uint64      { return uint64(c.regs().gregs[_REG_GS]) }
    45  func (c *sigctxt) sigcode() uint64 { return uint64(c.info.si_code) }
    46  func (c *sigctxt) sigaddr() uint64 { return *(*uint64)(unsafe.Pointer(&c.info.__data[0])) }
    47  
    48  func (c *sigctxt) set_rip(x uint64)     { c.regs().gregs[_REG_RIP] = int64(x) }
    49  func (c *sigctxt) set_rsp(x uint64)     { c.regs().gregs[_REG_RSP] = int64(x) }
    50  func (c *sigctxt) set_sigcode(x uint64) { c.info.si_code = int32(x) }
    51  func (c *sigctxt) set_sigaddr(x uint64) {
    52  	*(*uintptr)(unsafe.Pointer(&c.info.__data[0])) = uintptr(x)
    53  }