Stefan Reinauer | 543a682 | 2013-02-04 15:39:13 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2013 Google, Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | typedef struct { |
| 21 | uint16_t signature; |
| 22 | uint16_t lastsize; |
| 23 | uint16_t nblocks; |
| 24 | uint16_t nreloc; |
| 25 | uint16_t hdrsize; |
| 26 | uint16_t minalloc; |
| 27 | uint16_t maxalloc; |
| 28 | uint16_t ss; |
| 29 | uint16_t sp; |
| 30 | uint16_t checksum; |
| 31 | uint16_t ip; |
| 32 | uint16_t cs; |
| 33 | uint16_t relocpos; |
| 34 | uint16_t noverlay; |
| 35 | uint16_t reserved1[4]; |
| 36 | uint16_t oem_id; |
| 37 | uint16_t oem_info; |
| 38 | uint16_t reserved2[10]; |
| 39 | uint32_t e_lfanew; |
| 40 | } dos_header_t; |
| 41 | |
| 42 | typedef struct { |
| 43 | uint8_t signature[4]; |
| 44 | uint16_t machine; |
| 45 | uint16_t num_sections; |
| 46 | uint32_t timestamp; |
| 47 | uint32_t symboltable; |
| 48 | uint32_t num_symbols; |
| 49 | uint16_t opt_header_size; |
| 50 | uint16_t characteristics; |
| 51 | } coff_header_t; |
| 52 | |
| 53 | typedef struct { |
| 54 | uint16_t signature; |
| 55 | uint8_t major_linker_version; |
| 56 | uint8_t minor_linker_version; |
| 57 | uint32_t code_size; |
| 58 | uint32_t data_size; |
| 59 | uint32_t bss_size; |
| 60 | uint32_t entry_point; |
| 61 | uint32_t code_offset; |
| 62 | uint32_t data_offset; |
| 63 | uint32_t image_addr; |
| 64 | uint32_t section_alignment; |
| 65 | uint32_t file_alignment; |
| 66 | uint16_t major_os_version; |
| 67 | uint16_t minor_os_version; |
| 68 | uint16_t major_image_version; |
| 69 | uint16_t minor_image_version; |
| 70 | uint16_t major_subsystem_version; |
| 71 | uint16_t minor_subsystem_version; |
| 72 | uint32_t reserved; |
| 73 | uint32_t image_size; |
| 74 | uint32_t header_size; |
| 75 | uint32_t checksum; |
| 76 | uint16_t subsystem; |
| 77 | uint16_t characteristics; |
| 78 | uint32_t stack_reserve_size; |
| 79 | uint32_t stack_commit_size; |
| 80 | uint32_t heap_reserve_size; |
| 81 | uint32_t heap_commit_size; |
| 82 | uint32_t loader_flags; |
| 83 | uint32_t number_of_va_and_sizes; |
| 84 | /* data directory not needed */ |
| 85 | } pe_opt_header_t; |
| 86 | |