...

Source file src/runtime/defs_windows_386.go

Documentation: runtime

     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  // 386 does not have frame pointer register.
    60  func (c *context) set_fp(x uintptr) {}
    61  
    62  func prepareContextForSigResume(c *context) {
    63  	c.edx = c.esp
    64  	c.ecx = c.eip
    65  }
    66  
    67  func dumpregs(r *context) {
    68  	print("eax     ", hex(r.eax), "\n")
    69  	print("ebx     ", hex(r.ebx), "\n")
    70  	print("ecx     ", hex(r.ecx), "\n")
    71  	print("edx     ", hex(r.edx), "\n")
    72  	print("edi     ", hex(r.edi), "\n")
    73  	print("esi     ", hex(r.esi), "\n")
    74  	print("ebp     ", hex(r.ebp), "\n")
    75  	print("esp     ", hex(r.esp), "\n")
    76  	print("eip     ", hex(r.eip), "\n")
    77  	print("eflags  ", hex(r.eflags), "\n")
    78  	print("cs      ", hex(r.segcs), "\n")
    79  	print("fs      ", hex(r.segfs), "\n")
    80  	print("gs      ", hex(r.seggs), "\n")
    81  }
    82  
    83  // _DISPATCHER_CONTEXT is not defined on 386.
    84  type _DISPATCHER_CONTEXT struct{}
    85  
    86  func (c *_DISPATCHER_CONTEXT) ctx() *context {
    87  	return nil
    88  }
    89  

View as plain text