| 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 |
const _PAGESIZE = 0x1000 |
| 8 |
|
| 9 |
type ureg struct { |
| 10 |
ax uint64 |
| 11 |
bx uint64 |
| 12 |
cx uint64 |
| 13 |
dx uint64 |
| 14 |
si uint64 |
| 15 |
di uint64 |
| 16 |
bp uint64 |
| 17 |
r8 uint64 |
| 18 |
r9 uint64 |
| 19 |
r10 uint64 |
| 20 |
r11 uint64 |
| 21 |
r12 uint64 |
| 22 |
r13 uint64 |
| 23 |
r14 uint64 |
| 24 |
r15 uint64 |
| 25 |
|
| 26 |
ds uint16 |
| 27 |
es uint16 |
| 28 |
fs uint16 |
| 29 |
gs uint16 |
| 30 |
|
| 31 |
_type uint64 |
| 32 |
error uint64 /* error code (or zero) */ |
| 33 |
ip uint64 /* pc */ |
| 34 |
cs uint64 /* old context */ |
| 35 |
flags uint64 /* old flags */ |
| 36 |
sp uint64 /* sp */ |
| 37 |
ss uint64 /* old stack segment */ |
| 38 |
} |
| 39 |
|
| 40 |
type sigctxt struct { |
| 41 |
u *ureg |
| 42 |
} |
| 43 |
|
| 44 |
//go:nosplit |
| 45 |
//go:nowritebarrierrec |
| 46 |
func (c *sigctxt) pc() uintptr { return uintptr(c.u.ip) } |
| 47 |
|
| 48 |
func (c *sigctxt) sp() uintptr { return uintptr(c.u.sp) } |
| 49 |
func (c *sigctxt) lr() uintptr { return uintptr(0) } |
| 50 |
|
| 51 |
func (c *sigctxt) setpc(x uintptr) { c.u.ip = uint64(x) } |
| 52 |
func (c *sigctxt) setsp(x uintptr) { c.u.sp = uint64(x) } |
| 53 |
func (c *sigctxt) setlr(x uintptr) {} |
| 54 |
|
| 55 |
func (c *sigctxt) savelr(x uintptr) {} |
| 56 |
|
| 57 |
func dumpregs(u *ureg) { |
| 58 |
print("ax ", hex(u.ax), "\n") |
| 59 |
print("bx ", hex(u.bx), "\n") |
| 60 |
print("cx ", hex(u.cx), "\n") |
| 61 |
print("dx ", hex(u.dx), "\n") |
| 62 |
print("di ", hex(u.di), "\n") |
| 63 |
print("si ", hex(u.si), "\n") |
| 64 |
print("bp ", hex(u.bp), "\n") |
| 65 |
print("sp ", hex(u.sp), "\n") |
| 66 |
print("r8 ", hex(u.r8), "\n") |
| 67 |
print("r9 ", hex(u.r9), "\n") |
| 68 |
print("r10 ", hex(u.r10), "\n") |
| 69 |
print("r11 ", hex(u.r11), "\n") |
| 70 |
print("r12 ", hex(u.r12), "\n") |
| 71 |
print("r13 ", hex(u.r13), "\n") |
| 72 |
print("r14 ", hex(u.r14), "\n") |
| 73 |
print("r15 ", hex(u.r15), "\n") |
| 74 |
print("ip ", hex(u.ip), "\n") |
| 75 |
print("flags ", hex(u.flags), "\n") |
| 76 |
print("cs ", hex(u.cs), "\n") |
| 77 |
print("fs ", hex(u.fs), "\n") |
| 78 |
print("gs ", hex(u.gs), "\n") |
| 79 |
} |
| 80 |
|
| 81 |
func sigpanictramp() |