summaryrefslogtreecommitdiffstats
path: root/src/arch/x86_64/Makefile.efi
Commit message (Collapse)AuthorAgeFilesLines
* [librm] Prepare for long-mode memory mapMichael Brown2016-02-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bulk of the iPXE binary (the .textdata section) is physically relocated at runtime to the top of the 32-bit address space in order to allow space for an OS to be loaded. The relocation is achieved with the assistance of segmentation: we adjust the code and data segment bases so that the link-time addresses remain valid. Segmentation is not available (for normal code and data segments) in long mode. We choose to compile the C code with -mcmodel=kernel and use a link-time address of 0xffffffffeb000000. This choice allows us to identity-map the entirety of the 32-bit address space, and to alias our chosen link-time address to the physical location of our .textdata section. (This requires the .textdata section to always be aligned to a page boundary.) We simultaneously choose to set the 32-bit virtual address segment bases such that the link-time addresses may simply be truncated to 32 bits in order to generate a valid 32-bit virtual address. This allows symbols in .textdata to be trivially accessed by both 32-bit and 64-bit code. There is no (sensible) way in 32-bit assembly code to generate the required R_X86_64_32S relocation records for these truncated symbols. However, subtracting the fixed constant 0xffffffff00000000 has the same effect as truncation, and can be represented in a standard R_X86_64_32 relocation record. We define the VIRTUAL() macro to abstract away this truncation operation, and apply it to all references by 32-bit (or 16-bit) assembly code to any symbols within the .textdata section. We define "virt_offset" for a 64-bit build as "the value to be added to an address within .textdata in order to obtain its physical address". With this definition, the low 32 bits of "virt_offset" can be treated by 32-bit code as functionally equivalent to "virt_offset" in a 32-bit build. We define "text16" and "data16" for a 64-bit build as the physical addresses of the .text16 and .data16 sections. Since a physical address within the 32-bit address space may be used directly as a 64-bit virtual address (thanks to the identity map), this definition provides the most natural access to variables in .text16 and .data16. Note that this requires a minor adjustment in prot_to_real(), which accesses .text16 using 32-bit virtual addresses. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add %.usb target for building EFI-bootable USB (or other) disk imagesMichael Brown2015-12-071-0/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Allow for .efidrv images as well as .efi imagesMichael Brown2009-01-081-14/+5Star
| | | | | | Merge in the changes that allow for building EFI driver images (that can be loaded using the EFI shell's "load" command) as well as EFI applications.
* [efi] Use elf2efi utility in place of efilinkMichael Brown2009-01-071-11/+5Star
| | | | | | | | | | | elf2efi converts a suitable ELF executable (containing relocation information, and with appropriate virtual addresses) into an EFI executable. It is less tightly coupled with the gPXE build process and, in particular, does not require the use of a hand-crafted PE image header in efiprefix.S. elf2efi correctly handles .bss sections, which significantly reduces the size of the gPXE EFI executable.
* [efi] Inhibit harmless ld warning on unresolved symbol checkMichael Brown2009-01-051-1/+2
| | | | | | | | The check for unresolved symbols does not explicitly specify an output architecture format, and so causes a warning when building an i386 EFI binary on an x86_64 platform. This warning is harmless, and specifying the output architecture in multiple places is cumbersome, so just inhibit the warning.
* [x86_64] Add support for compilation as an x86_64 binaryMichael Brown2008-12-051-0/+28
Currently the only supported platform for x86_64 is EFI. Building an EFI64 gPXE requires a version of gcc that supports __attribute__((ms_abi)). This currently means a development build of gcc; the feature should be present when gcc 4.4 is released. In the meantime; you can grab a suitable gcc tree from git://git.etherboot.org/scm/people/mcb30/gcc/.git