1 package runtime 2 3 const _PAGESIZE = 0x1000 4 5 type ureg struct { 6 di uint32 /* general registers */ 7 si uint32 /* ... */ 8 bp uint32 /* ... */ 9 nsp uint32 10 bx uint32 /* ... */ 11 dx uint32 /* ... */ 12 cx uint32 /* ... */ 13 ax uint32 /* ... */ 14 gs uint32 /* data segments */ 15 fs uint32 /* ... */ 16 es uint32 /* ... */ 17 ds uint32 /* ... */ 18 trap uint32 /* trap _type */ 19 ecode uint32 /* error code (or zero) */ 20 pc uint32 /* pc */ 21 cs uint32 /* old context */ 22 flags uint32 /* old flags */ 23 sp uint32 24 ss uint32 /* old stack segment */ 25 } 26 27 type sigctxt struct { 28 u *ureg 29 } 30 31 //go:nosplit 32 //go:nowritebarrierrec 33 func (c *sigctxt) pc() uintptr { return uintptr(c.u.pc) } 34 35 func (c *sigctxt) sp() uintptr { return uintptr(c.u.sp) } 36 func (c *sigctxt) lr() uintptr { return uintptr(0) } 37 38 func (c *sigctxt) setpc(x uintptr) { c.u.pc = uint32(x) } 39 func (c *sigctxt) setsp(x uintptr) { c.u.sp = uint32(x) } 40 func (c *sigctxt) setlr(x uintptr) {} 41 42 func (c *sigctxt) savelr(x uintptr) {} 43 44 func dumpregs(u *ureg) { 45 print("ax ", hex(u.ax), "\n") 46 print("bx ", hex(u.bx), "\n") 47 print("cx ", hex(u.cx), "\n") 48 print("dx ", hex(u.dx), "\n") 49 print("di ", hex(u.di), "\n") 50 print("si ", hex(u.si), "\n") 51 print("bp ", hex(u.bp), "\n") 52 print("sp ", hex(u.sp), "\n") 53 print("pc ", hex(u.pc), "\n") 54 print("flags ", hex(u.flags), "\n") 55 print("cs ", hex(u.cs), "\n") 56 print("fs ", hex(u.fs), "\n") 57 print("gs ", hex(u.gs), "\n") 58 } 59 60 func sigpanictramp() {} 61