Source file src/runtime/defs_windows_386.go

     1  // Copyright 2009 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 _CONTEXT_CONTROL = 0x10001
     8  
     9  type floatingsavearea struct {
    10  	controlword   uint32
    11  	statusword    uint32
    12  	tagword       uint32
    13  	erroroffset   uint32
    14  	errorselector uint32
    15  	dataoffset    uint32
    16  	dataselector  uint32
    17  	registerarea  [80]uint8
    18  	cr0npxstate   uint32
    19  }
    20  
    21  type context struct {
    22  	contextflags      uint32
    23  	dr0               uint32
    24  	dr1               uint32
    25  	dr2               uint32
    26  	dr3               uint32
    27  	dr6               uint32
    28  	dr7               uint32
    29  	floatsave         floatingsavearea
    30  	seggs             uint32
    31  	segfs             uint32
    32  	seges             uint32
    33  	segds             uint32
    34  	edi               uint32
    35  	esi               uint32
    36  	ebx               uint32
    37  	edx               uint32
    38  	ecx               uint32
    39  	eax               uint32
    40  	ebp               uint32
    41  	eip               uint32
    42  	segcs             uint32
    43  	eflags            uint32
    44  	esp               uint32
    45  	segss             uint32
    46  	extendedregisters [512]uint8
    47  }
    48  
    49  func (c *context) ip() uintptr { return uintptr(c.eip) }
    50  func (c *context) sp() uintptr { return uintptr(c.esp) }
    51  
    52  // 386 does not have link register, so this returns 0.
    53  func (c *context) lr() uintptr      { return 0 }
    54  func (c *context) set_lr(x uintptr) {}
    55  
    56  func (c *context) set_ip(x uintptr) { c.eip = uint32(x) }
    57  func (c *context) set_sp(x uintptr) { c.esp = uint32(x) }
    58  
    59  func dumpregs(r *context) {
    60  	print("eax     ", hex(r.eax), "\n")
    61  	print("ebx     ", hex(r.ebx), "\n")
    62  	print("ecx     ", hex(r.ecx), "\n")
    63  	print("edx     ", hex(r.edx), "\n")
    64  	print("edi     ", hex(r.edi), "\n")
    65  	print("esi     ", hex(r.esi), "\n")
    66  	print("ebp     ", hex(r.ebp), "\n")
    67  	print("esp     ", hex(r.esp), "\n")
    68  	print("eip     ", hex(r.eip), "\n")
    69  	print("eflags  ", hex(r.eflags), "\n")
    70  	print("cs      ", hex(r.segcs), "\n")
    71  	print("fs      ", hex(r.segfs), "\n")
    72  	print("gs      ", hex(r.seggs), "\n")
    73  }
    74  

View as plain text