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