github.com/riscv/riscv-go@v0.0.0-20200123204226-124ebd6fcc8e/src/debug/pe/pe.go (about)

     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 pe
     6  
     7  type FileHeader struct {
     8  	Machine              uint16
     9  	NumberOfSections     uint16
    10  	TimeDateStamp        uint32
    11  	PointerToSymbolTable uint32
    12  	NumberOfSymbols      uint32
    13  	SizeOfOptionalHeader uint16
    14  	Characteristics      uint16
    15  }
    16  
    17  type DataDirectory struct {
    18  	VirtualAddress uint32
    19  	Size           uint32
    20  }
    21  
    22  type OptionalHeader32 struct {
    23  	Magic                       uint16
    24  	MajorLinkerVersion          uint8
    25  	MinorLinkerVersion          uint8
    26  	SizeOfCode                  uint32
    27  	SizeOfInitializedData       uint32
    28  	SizeOfUninitializedData     uint32
    29  	AddressOfEntryPoint         uint32
    30  	BaseOfCode                  uint32
    31  	BaseOfData                  uint32
    32  	ImageBase                   uint32
    33  	SectionAlignment            uint32
    34  	FileAlignment               uint32
    35  	MajorOperatingSystemVersion uint16
    36  	MinorOperatingSystemVersion uint16
    37  	MajorImageVersion           uint16
    38  	MinorImageVersion           uint16
    39  	MajorSubsystemVersion       uint16
    40  	MinorSubsystemVersion       uint16
    41  	Win32VersionValue           uint32
    42  	SizeOfImage                 uint32
    43  	SizeOfHeaders               uint32
    44  	CheckSum                    uint32
    45  	Subsystem                   uint16
    46  	DllCharacteristics          uint16
    47  	SizeOfStackReserve          uint32
    48  	SizeOfStackCommit           uint32
    49  	SizeOfHeapReserve           uint32
    50  	SizeOfHeapCommit            uint32
    51  	LoaderFlags                 uint32
    52  	NumberOfRvaAndSizes         uint32
    53  	DataDirectory               [16]DataDirectory
    54  }
    55  
    56  type OptionalHeader64 struct {
    57  	Magic                       uint16
    58  	MajorLinkerVersion          uint8
    59  	MinorLinkerVersion          uint8
    60  	SizeOfCode                  uint32
    61  	SizeOfInitializedData       uint32
    62  	SizeOfUninitializedData     uint32
    63  	AddressOfEntryPoint         uint32
    64  	BaseOfCode                  uint32
    65  	ImageBase                   uint64
    66  	SectionAlignment            uint32
    67  	FileAlignment               uint32
    68  	MajorOperatingSystemVersion uint16
    69  	MinorOperatingSystemVersion uint16
    70  	MajorImageVersion           uint16
    71  	MinorImageVersion           uint16
    72  	MajorSubsystemVersion       uint16
    73  	MinorSubsystemVersion       uint16
    74  	Win32VersionValue           uint32
    75  	SizeOfImage                 uint32
    76  	SizeOfHeaders               uint32
    77  	CheckSum                    uint32
    78  	Subsystem                   uint16
    79  	DllCharacteristics          uint16
    80  	SizeOfStackReserve          uint64
    81  	SizeOfStackCommit           uint64
    82  	SizeOfHeapReserve           uint64
    83  	SizeOfHeapCommit            uint64
    84  	LoaderFlags                 uint32
    85  	NumberOfRvaAndSizes         uint32
    86  	DataDirectory               [16]DataDirectory
    87  }
    88  
    89  const (
    90  	IMAGE_FILE_MACHINE_UNKNOWN   = 0x0
    91  	IMAGE_FILE_MACHINE_AM33      = 0x1d3
    92  	IMAGE_FILE_MACHINE_AMD64     = 0x8664
    93  	IMAGE_FILE_MACHINE_ARM       = 0x1c0
    94  	IMAGE_FILE_MACHINE_EBC       = 0xebc
    95  	IMAGE_FILE_MACHINE_I386      = 0x14c
    96  	IMAGE_FILE_MACHINE_IA64      = 0x200
    97  	IMAGE_FILE_MACHINE_M32R      = 0x9041
    98  	IMAGE_FILE_MACHINE_MIPS16    = 0x266
    99  	IMAGE_FILE_MACHINE_MIPSFPU   = 0x366
   100  	IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466
   101  	IMAGE_FILE_MACHINE_POWERPC   = 0x1f0
   102  	IMAGE_FILE_MACHINE_POWERPCFP = 0x1f1
   103  	IMAGE_FILE_MACHINE_R4000     = 0x166
   104  	IMAGE_FILE_MACHINE_SH3       = 0x1a2
   105  	IMAGE_FILE_MACHINE_SH3DSP    = 0x1a3
   106  	IMAGE_FILE_MACHINE_SH4       = 0x1a6
   107  	IMAGE_FILE_MACHINE_SH5       = 0x1a8
   108  	IMAGE_FILE_MACHINE_THUMB     = 0x1c2
   109  	IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169
   110  )