github.com/lzhfromustc/gofuzz@v0.0.0-20211116160056-151b3108bbd1/runtime/defs_windows_386.go (about)

     1  // created by cgo -cdefs and then converted to Go
     2  // cgo -cdefs defs_windows.go
     3  
     4  package runtime
     5  
     6  const (
     7  	_PROT_NONE  = 0
     8  	_PROT_READ  = 1
     9  	_PROT_WRITE = 2
    10  	_PROT_EXEC  = 4
    11  
    12  	_MAP_ANON    = 1
    13  	_MAP_PRIVATE = 2
    14  
    15  	_DUPLICATE_SAME_ACCESS   = 0x2
    16  	_THREAD_PRIORITY_HIGHEST = 0x2
    17  
    18  	_SIGINT              = 0x2
    19  	_SIGTERM             = 0xF
    20  	_CTRL_C_EVENT        = 0x0
    21  	_CTRL_BREAK_EVENT    = 0x1
    22  	_CTRL_CLOSE_EVENT    = 0x2
    23  	_CTRL_LOGOFF_EVENT   = 0x5
    24  	_CTRL_SHUTDOWN_EVENT = 0x6
    25  
    26  	_CONTEXT_CONTROL = 0x10001
    27  	_CONTEXT_FULL    = 0x10007
    28  
    29  	_EXCEPTION_ACCESS_VIOLATION     = 0xc0000005
    30  	_EXCEPTION_BREAKPOINT           = 0x80000003
    31  	_EXCEPTION_FLT_DENORMAL_OPERAND = 0xc000008d
    32  	_EXCEPTION_FLT_DIVIDE_BY_ZERO   = 0xc000008e
    33  	_EXCEPTION_FLT_INEXACT_RESULT   = 0xc000008f
    34  	_EXCEPTION_FLT_OVERFLOW         = 0xc0000091
    35  	_EXCEPTION_FLT_UNDERFLOW        = 0xc0000093
    36  	_EXCEPTION_INT_DIVIDE_BY_ZERO   = 0xc0000094
    37  	_EXCEPTION_INT_OVERFLOW         = 0xc0000095
    38  
    39  	_INFINITE     = 0xffffffff
    40  	_WAIT_TIMEOUT = 0x102
    41  
    42  	_EXCEPTION_CONTINUE_EXECUTION = -0x1
    43  	_EXCEPTION_CONTINUE_SEARCH    = 0x0
    44  )
    45  
    46  type systeminfo struct {
    47  	anon0                       [4]byte
    48  	dwpagesize                  uint32
    49  	lpminimumapplicationaddress *byte
    50  	lpmaximumapplicationaddress *byte
    51  	dwactiveprocessormask       uint32
    52  	dwnumberofprocessors        uint32
    53  	dwprocessortype             uint32
    54  	dwallocationgranularity     uint32
    55  	wprocessorlevel             uint16
    56  	wprocessorrevision          uint16
    57  }
    58  
    59  type exceptionrecord struct {
    60  	exceptioncode        uint32
    61  	exceptionflags       uint32
    62  	exceptionrecord      *exceptionrecord
    63  	exceptionaddress     *byte
    64  	numberparameters     uint32
    65  	exceptioninformation [15]uint32
    66  }
    67  
    68  type floatingsavearea struct {
    69  	controlword   uint32
    70  	statusword    uint32
    71  	tagword       uint32
    72  	erroroffset   uint32
    73  	errorselector uint32
    74  	dataoffset    uint32
    75  	dataselector  uint32
    76  	registerarea  [80]uint8
    77  	cr0npxstate   uint32
    78  }
    79  
    80  type context struct {
    81  	contextflags      uint32
    82  	dr0               uint32
    83  	dr1               uint32
    84  	dr2               uint32
    85  	dr3               uint32
    86  	dr6               uint32
    87  	dr7               uint32
    88  	floatsave         floatingsavearea
    89  	seggs             uint32
    90  	segfs             uint32
    91  	seges             uint32
    92  	segds             uint32
    93  	edi               uint32
    94  	esi               uint32
    95  	ebx               uint32
    96  	edx               uint32
    97  	ecx               uint32
    98  	eax               uint32
    99  	ebp               uint32
   100  	eip               uint32
   101  	segcs             uint32
   102  	eflags            uint32
   103  	esp               uint32
   104  	segss             uint32
   105  	extendedregisters [512]uint8
   106  }
   107  
   108  func (c *context) ip() uintptr { return uintptr(c.eip) }
   109  func (c *context) sp() uintptr { return uintptr(c.esp) }
   110  
   111  // 386 does not have link register, so this returns 0.
   112  func (c *context) lr() uintptr      { return 0 }
   113  func (c *context) set_lr(x uintptr) {}
   114  
   115  func (c *context) set_ip(x uintptr) { c.eip = uint32(x) }
   116  func (c *context) set_sp(x uintptr) { c.esp = uint32(x) }
   117  
   118  func dumpregs(r *context) {
   119  	print("eax     ", hex(r.eax), "\n")
   120  	print("ebx     ", hex(r.ebx), "\n")
   121  	print("ecx     ", hex(r.ecx), "\n")
   122  	print("edx     ", hex(r.edx), "\n")
   123  	print("edi     ", hex(r.edi), "\n")
   124  	print("esi     ", hex(r.esi), "\n")
   125  	print("ebp     ", hex(r.ebp), "\n")
   126  	print("esp     ", hex(r.esp), "\n")
   127  	print("eip     ", hex(r.eip), "\n")
   128  	print("eflags  ", hex(r.eflags), "\n")
   129  	print("cs      ", hex(r.segcs), "\n")
   130  	print("fs      ", hex(r.segfs), "\n")
   131  	print("gs      ", hex(r.seggs), "\n")
   132  }
   133  
   134  type overlapped struct {
   135  	internal     uint32
   136  	internalhigh uint32
   137  	anon0        [8]byte
   138  	hevent       *byte
   139  }
   140  
   141  type memoryBasicInformation struct {
   142  	baseAddress       uintptr
   143  	allocationBase    uintptr
   144  	allocationProtect uint32
   145  	regionSize        uintptr
   146  	state             uint32
   147  	protect           uint32
   148  	type_             uint32
   149  }