diff options
author | Joel Sing <jsing@google.com> | 2014-11-22 22:09:11 +1100 |
---|---|---|
committer | Joel Sing <jsing@google.com> | 2014-11-22 22:09:11 +1100 |
commit | 0d76887433b3034c4dfd8b909f3a4b76b0eabefb (patch) | |
tree | f5de0d8c58b32fe934ab5bf1694073356e18befd /src/runtime/signal_netbsd_386.go | |
parent | cfc8099a9a71bbcdd8b3259be2f50578872c9626 (diff) | |
download | go-0d76887433b3034c4dfd8b909f3a4b76b0eabefb.tar.gz go-0d76887433b3034c4dfd8b909f3a4b76b0eabefb.zip |
[dev.cc] runtime: convert netbsd/386 port to Go
LGTM=minux
R=rsc, minux
CC=golang-codereviews
https://golang.org/cl/177170043
Diffstat (limited to 'src/runtime/signal_netbsd_386.go')
-rw-r--r-- | src/runtime/signal_netbsd_386.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/runtime/signal_netbsd_386.go b/src/runtime/signal_netbsd_386.go new file mode 100644 index 0000000000..6702336abe --- /dev/null +++ b/src/runtime/signal_netbsd_386.go @@ -0,0 +1,38 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +type sigctxt struct { + info *siginfo + ctxt unsafe.Pointer +} + +func (c *sigctxt) regs() *mcontextt { return &(*ucontextt)(c.ctxt).uc_mcontext } +func (c *sigctxt) eax() uint32 { return c.regs().__gregs[_REG_EAX] } +func (c *sigctxt) ebx() uint32 { return c.regs().__gregs[_REG_EBX] } +func (c *sigctxt) ecx() uint32 { return c.regs().__gregs[_REG_ECX] } +func (c *sigctxt) edx() uint32 { return c.regs().__gregs[_REG_EDX] } +func (c *sigctxt) edi() uint32 { return c.regs().__gregs[_REG_EDI] } +func (c *sigctxt) esi() uint32 { return c.regs().__gregs[_REG_ESI] } +func (c *sigctxt) ebp() uint32 { return c.regs().__gregs[_REG_EBP] } +func (c *sigctxt) esp() uint32 { return c.regs().__gregs[_REG_UESP] } +func (c *sigctxt) eip() uint32 { return c.regs().__gregs[_REG_EIP] } +func (c *sigctxt) eflags() uint32 { return c.regs().__gregs[_REG_EFL] } +func (c *sigctxt) cs() uint32 { return uint32(c.regs().__gregs[_REG_CS]) } +func (c *sigctxt) fs() uint32 { return uint32(c.regs().__gregs[_REG_FS]) } +func (c *sigctxt) gs() uint32 { return uint32(c.regs().__gregs[_REG_GS]) } +func (c *sigctxt) sigcode() uint32 { return uint32(c.info._code) } +func (c *sigctxt) sigaddr() uint32 { + return uint32(*(*uint32)(unsafe.Pointer(&c.info._reason[0]))) +} + +func (c *sigctxt) set_eip(x uint32) { c.regs().__gregs[_REG_EIP] = x } +func (c *sigctxt) set_esp(x uint32) { c.regs().__gregs[_REG_UESP] = x } +func (c *sigctxt) set_sigcode(x uint32) { c.info._code = int32(x) } +func (c *sigctxt) set_sigaddr(x uint32) { + *(*uint32)(unsafe.Pointer(&c.info._reason[0])) = x +} |