]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/arm64/kernel/efi-header.S
arm64: efi: remove pointless dummy .reloc section
[karo-tx-linux.git] / arch / arm64 / kernel / efi-header.S
1 /*
2  * Copyright (C) 2013 - 2017 Linaro, Ltd.
3  * Copyright (C) 2013, 2014 Red Hat, Inc.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  */
9
10         .macro  __EFI_PE_HEADER
11         .ascii  "PE"
12         .short  0
13 coff_header:
14         .short  0xaa64                                  // AArch64
15         .short  1                                       // nr_sections
16         .long   0                                       // TimeDateStamp
17         .long   0                                       // PointerToSymbolTable
18         .long   0                                       // NumberOfSymbols
19         .short  section_table - optional_header         // SizeOfOptionalHeader
20         .short  0x206                                   // Characteristics.
21                                                         // IMAGE_FILE_DEBUG_STRIPPED |
22                                                         // IMAGE_FILE_EXECUTABLE_IMAGE |
23                                                         // IMAGE_FILE_LINE_NUMS_STRIPPED
24 optional_header:
25         .short  0x20b                                   // PE32+ format
26         .byte   0x02                                    // MajorLinkerVersion
27         .byte   0x14                                    // MinorLinkerVersion
28         .long   _end - efi_header_end                   // SizeOfCode
29         .long   0                                       // SizeOfInitializedData
30         .long   0                                       // SizeOfUninitializedData
31         .long   __efistub_entry - _head                 // AddressOfEntryPoint
32         .long   efi_header_end - _head                  // BaseOfCode
33
34 extra_header_fields:
35         .quad   0                                       // ImageBase
36         .long   0x1000                                  // SectionAlignment
37         .long   PECOFF_FILE_ALIGNMENT                   // FileAlignment
38         .short  0                                       // MajorOperatingSystemVersion
39         .short  0                                       // MinorOperatingSystemVersion
40         .short  0                                       // MajorImageVersion
41         .short  0                                       // MinorImageVersion
42         .short  0                                       // MajorSubsystemVersion
43         .short  0                                       // MinorSubsystemVersion
44         .long   0                                       // Win32VersionValue
45
46         .long   _end - _head                            // SizeOfImage
47
48         // Everything before the kernel image is considered part of the header
49         .long   efi_header_end - _head                  // SizeOfHeaders
50         .long   0                                       // CheckSum
51         .short  0xa                                     // Subsystem (EFI application)
52         .short  0                                       // DllCharacteristics
53         .quad   0                                       // SizeOfStackReserve
54         .quad   0                                       // SizeOfStackCommit
55         .quad   0                                       // SizeOfHeapReserve
56         .quad   0                                       // SizeOfHeapCommit
57         .long   0                                       // LoaderFlags
58         .long   (section_table - .) / 8                 // NumberOfRvaAndSizes
59
60         .quad   0                                       // ExportTable
61         .quad   0                                       // ImportTable
62         .quad   0                                       // ResourceTable
63         .quad   0                                       // ExceptionTable
64         .quad   0                                       // CertificationTable
65         .quad   0                                       // BaseRelocationTable
66
67 #ifdef CONFIG_DEBUG_EFI
68         .long   efi_debug_table - _head                 // DebugTable
69         .long   efi_debug_table_size
70 #endif
71
72         // Section table
73 section_table:
74         .ascii  ".text"
75         .byte   0
76         .byte   0
77         .byte   0                                       // end of 0 padding of section name
78         .long   _end - efi_header_end                   // VirtualSize
79         .long   efi_header_end - _head                  // VirtualAddress
80         .long   _edata - efi_header_end                 // SizeOfRawData
81         .long   efi_header_end - _head                  // PointerToRawData
82
83         .long   0                                       // PointerToRelocations
84         .long   0                                       // PointerToLineNumbers
85         .short  0                                       // NumberOfRelocations
86         .short  0                                       // NumberOfLineNumbers
87         .long   0xe0000020                              // Characteristics
88
89 #ifdef CONFIG_DEBUG_EFI
90         /*
91          * The debug table is referenced via its Relative Virtual Address (RVA),
92          * which is only defined for those parts of the image that are covered
93          * by a section declaration. Since this header is not covered by any
94          * section, the debug table must be emitted elsewhere. So stick it in
95          * the .init.rodata section instead.
96          *
97          * Note that the EFI debug entry itself may legally have a zero RVA,
98          * which means we can simply put it right after the section headers.
99          */
100         __INITRODATA
101
102         .align  2
103 efi_debug_table:
104         // EFI_IMAGE_DEBUG_DIRECTORY_ENTRY
105         .long   0                                       // Characteristics
106         .long   0                                       // TimeDateStamp
107         .short  0                                       // MajorVersion
108         .short  0                                       // MinorVersion
109         .long   2                                       // Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW
110         .long   efi_debug_entry_size                    // SizeOfData
111         .long   0                                       // RVA
112         .long   efi_debug_entry - _head                 // FileOffset
113
114         .set    efi_debug_table_size, . - efi_debug_table
115         .previous
116
117 efi_debug_entry:
118         // EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY
119         .ascii  "NB10"                                  // Signature
120         .long   0                                       // Unknown
121         .long   0                                       // Unknown2
122         .long   0                                       // Unknown3
123
124         .asciz  VMLINUX_PATH
125
126         .set    efi_debug_entry_size, . - efi_debug_entry
127 #endif
128
129         /*
130          * EFI will load .text onwards at the 4k section alignment
131          * described in the PE/COFF header. To ensure that instruction
132          * sequences using an adrp and a :lo12: immediate will function
133          * correctly at this alignment, we must ensure that .text is
134          * placed at a 4k boundary in the Image to begin with.
135          */
136         .align 12
137 efi_header_end:
138         .endm