.section .text.header .global base base: /* DOS header */ .ascii "MZ" .skip 58 .word pe_header - base pe_header: .ascii "PE\0\0" .short 0x8664 /* Machine = AMD64 */ .short 2 /* NumberOfSections */ .long 0 /* TimeDateStamp */ .long 0 /* PointerToSymbolTable */ .long 0 /* NumberOfSymbols */ .short section_table - optional_header /* SizeOfOptionalHeader */ /* Characteristics: * IMAGE_FILE_EXECUTABLE_IMAGE | * IMAGE_FILE_LINE_NUMS_STRIPPED | * IMAGE_FILE_DEBUG_STRIPPED */ .short 0x206 optional_header: .short 0x20b /* Magic = PE32+ (64-bit) */ .byte 0 /* MajorLinkerVersion */ .byte 0 /* MinorLinkerVersion */ .long _data - _start /* SizeOfCode */ .long _edata - _data /* SizeOfInitializedData */ .long 0 /* SizeOfUninitializedData */ .long _start - base /* AddressOfEntryPoint */ .long _start - base /* BaseOfCode */ extra_header: .quad 0 /* ImageBase */ .long 4096 /* SectionAlignment */ .long 512 /* FileAlignment */ .word 0 /* MajorOperatingSystemVersion */ .word 0 /* MinorOperatingSystemVersion */ .word 0 /* MajorImageVersion */ .word 0 /* MinorImageVersion */ .word 0 /* MajorSubsystemVersion */ .word 0 /* MinorSubsystemVersion */ .word 0 /* Reserved */ .long _edata - base /* SizeOfImage */ .long _start - base /* SizeOfHeaders */ .long 0 /* CheckSum */ .word 10 /* Subsystem = EFI application */ .word 0 /* DLLCharacteristics */ .quad 0 /* SizeOfStackReserve */ .quad 0 /* SizeOfStackCommit */ .quad 0 /* SizeOfHeapReserve */ .quad 0 /* SizeOfHeapCommit */ .long 0 /* LoaderFlags */ .long 6 /* NumberOfRvaAndSizes */ /* These are optional in the standard, but u-boot refuses to load * without them ¯\_(ツ)_/¯ */ .quad 0 /* Export table */ .quad 0 /* Import table */ .quad 0 /* Resource table */ .quad 0 /* Exception table */ .quad 0 /* Certificate table */ .quad 0 /* Base relocation table */ section_table: /* Somewhere I heard that EFI needs a relocation section, although some * loaders might get by without it, keep it for extra safety */ .ascii ".reloc\0\0" /* Name */ .long 0 /* VirtualSize */ .long 0 /* VirtualAddress */ .long 0 /* SizeOfRawData */ .long 0 /* PointerToRawData */ .long 0 /* PointerToRelocations */ .long 0 /* PointerToLinenumbers */ .word 0 /* NumberOfRelocations */ .word 0 /* NumberOfLinenumbers */ /* Characteristics: * IMAGE_SCN_ALIGN_1BYTES | * IMAGE_SCN_CNT_INITIALIZED_DATA | * IMAGE_SCN_MEM_DISCARDABLE | * IMAGE_SCN_MEM_READ */ .long 0x42100040 .ascii ".text\0\0\0" /* Name */ .long _edata - base /* VirtualSize */ .long _start - base /* VirtualAddress */ .long _edata - base /* SizeOfRawData */ .long _start - base /* PointerToRawData */ .long 0 /* PointerToRelocations */ .long 0 /* PointerToLinenumbers */ .word 0 /* NumberOfRelocations */ .word 0 /* NumberOfLinenumbers */ /* Characteristics: * IMAGE_SCN_ALIGN_16BYTES | * IMAGE_SCN_CNT_CODE | * IMAGE_SCN_MEM_EXECUTE | * IMAGE_SCN_MEM_READ | * IMAGE_SCN_MEM_WRITE */ .long 0xe0500020 .align 16 .global _start _start: jp _start