...
Run Format

Source file src/runtime/signal_linux_amd64.go

     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 (
     8		"runtime/internal/sys"
     9		"unsafe"
    10	)
    11	
    12	type sigctxt struct {
    13		info *siginfo
    14		ctxt unsafe.Pointer
    15	}
    16	
    17	//go:nosplit
    18	//go:nowritebarrierrec
    19	func (c *sigctxt) regs() *sigcontext {
    20		return (*sigcontext)(unsafe.Pointer(&(*ucontext)(c.ctxt).uc_mcontext))
    21	}
    22	
    23	func (c *sigctxt) rax() uint64 { return c.regs().rax }
    24	func (c *sigctxt) rbx() uint64 { return c.regs().rbx }
    25	func (c *sigctxt) rcx() uint64 { return c.regs().rcx }
    26	func (c *sigctxt) rdx() uint64 { return c.regs().rdx }
    27	func (c *sigctxt) rdi() uint64 { return c.regs().rdi }
    28	func (c *sigctxt) rsi() uint64 { return c.regs().rsi }
    29	func (c *sigctxt) rbp() uint64 { return c.regs().rbp }
    30	func (c *sigctxt) rsp() uint64 { return c.regs().rsp }
    31	func (c *sigctxt) r8() uint64  { return c.regs().r8 }
    32	func (c *sigctxt) r9() uint64  { return c.regs().r9 }
    33	func (c *sigctxt) r10() uint64 { return c.regs().r10 }
    34	func (c *sigctxt) r11() uint64 { return c.regs().r11 }
    35	func (c *sigctxt) r12() uint64 { return c.regs().r12 }
    36	func (c *sigctxt) r13() uint64 { return c.regs().r13 }
    37	func (c *sigctxt) r14() uint64 { return c.regs().r14 }
    38	func (c *sigctxt) r15() uint64 { return c.regs().r15 }
    39	
    40	//go:nosplit
    41	//go:nowritebarrierrec
    42	func (c *sigctxt) rip() uint64 { return c.regs().rip }
    43	
    44	func (c *sigctxt) rflags() uint64  { return c.regs().eflags }
    45	func (c *sigctxt) cs() uint64      { return uint64(c.regs().cs) }
    46	func (c *sigctxt) fs() uint64      { return uint64(c.regs().fs) }
    47	func (c *sigctxt) gs() uint64      { return uint64(c.regs().gs) }
    48	func (c *sigctxt) sigcode() uint64 { return uint64(c.info.si_code) }
    49	func (c *sigctxt) sigaddr() uint64 { return c.info.si_addr }
    50	
    51	func (c *sigctxt) set_rip(x uint64)     { c.regs().rip = x }
    52	func (c *sigctxt) set_rsp(x uint64)     { c.regs().rsp = x }
    53	func (c *sigctxt) set_sigcode(x uint64) { c.info.si_code = int32(x) }
    54	func (c *sigctxt) set_sigaddr(x uint64) {
    55		*(*uintptr)(add(unsafe.Pointer(c.info), 2*sys.PtrSize)) = uintptr(x)
    56	}
    57	

View as plain text