github.com/x04/go/src@v0.0.0-20200202162449-3d481ceb3525/runtime/defs_windows_amd64.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	= 0x100001
    27  	_CONTEXT_FULL		= 0x10000b
    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		uint64
    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  	pad_cgo_0		[4]byte
    66  	exceptioninformation	[15]uint64
    67  }
    68  
    69  type m128a struct {
    70  	low	uint64
    71  	high	int64
    72  }
    73  
    74  type context struct {
    75  	p1home			uint64
    76  	p2home			uint64
    77  	p3home			uint64
    78  	p4home			uint64
    79  	p5home			uint64
    80  	p6home			uint64
    81  	contextflags		uint32
    82  	mxcsr			uint32
    83  	segcs			uint16
    84  	segds			uint16
    85  	seges			uint16
    86  	segfs			uint16
    87  	seggs			uint16
    88  	segss			uint16
    89  	eflags			uint32
    90  	dr0			uint64
    91  	dr1			uint64
    92  	dr2			uint64
    93  	dr3			uint64
    94  	dr6			uint64
    95  	dr7			uint64
    96  	rax			uint64
    97  	rcx			uint64
    98  	rdx			uint64
    99  	rbx			uint64
   100  	rsp			uint64
   101  	rbp			uint64
   102  	rsi			uint64
   103  	rdi			uint64
   104  	r8			uint64
   105  	r9			uint64
   106  	r10			uint64
   107  	r11			uint64
   108  	r12			uint64
   109  	r13			uint64
   110  	r14			uint64
   111  	r15			uint64
   112  	rip			uint64
   113  	anon0			[512]byte
   114  	vectorregister		[26]m128a
   115  	vectorcontrol		uint64
   116  	debugcontrol		uint64
   117  	lastbranchtorip		uint64
   118  	lastbranchfromrip	uint64
   119  	lastexceptiontorip	uint64
   120  	lastexceptionfromrip	uint64
   121  }
   122  
   123  func (c *context) ip() uintptr	{ return uintptr(c.rip) }
   124  func (c *context) sp() uintptr	{ return uintptr(c.rsp) }
   125  
   126  // Amd64 does not have link register, so this returns 0.
   127  func (c *context) lr() uintptr		{ return 0 }
   128  func (c *context) set_lr(x uintptr)	{}
   129  
   130  func (c *context) set_ip(x uintptr)	{ c.rip = uint64(x) }
   131  func (c *context) set_sp(x uintptr)	{ c.rsp = uint64(x) }
   132  
   133  func dumpregs(r *context) {
   134  	print("rax     ", hex(r.rax), "\n")
   135  	print("rbx     ", hex(r.rbx), "\n")
   136  	print("rcx     ", hex(r.rcx), "\n")
   137  	print("rdi     ", hex(r.rdi), "\n")
   138  	print("rsi     ", hex(r.rsi), "\n")
   139  	print("rbp     ", hex(r.rbp), "\n")
   140  	print("rsp     ", hex(r.rsp), "\n")
   141  	print("r8      ", hex(r.r8), "\n")
   142  	print("r9      ", hex(r.r9), "\n")
   143  	print("r10     ", hex(r.r10), "\n")
   144  	print("r11     ", hex(r.r11), "\n")
   145  	print("r12     ", hex(r.r12), "\n")
   146  	print("r13     ", hex(r.r13), "\n")
   147  	print("r14     ", hex(r.r14), "\n")
   148  	print("r15     ", hex(r.r15), "\n")
   149  	print("rip     ", hex(r.rip), "\n")
   150  	print("rflags  ", hex(r.eflags), "\n")
   151  	print("cs      ", hex(r.segcs), "\n")
   152  	print("fs      ", hex(r.segfs), "\n")
   153  	print("gs      ", hex(r.seggs), "\n")
   154  }
   155  
   156  type overlapped struct {
   157  	internal	uint64
   158  	internalhigh	uint64
   159  	anon0		[8]byte
   160  	hevent		*byte
   161  }
   162  
   163  type memoryBasicInformation struct {
   164  	baseAddress		uintptr
   165  	allocationBase		uintptr
   166  	allocationProtect	uint32
   167  	regionSize		uintptr
   168  	state			uint32
   169  	protect			uint32
   170  	type_			uint32
   171  }