# paste.txt -rw-r--r-- 3.5 KiB View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.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