summaryrefslogtreecommitdiffstats
path: root/src/arch/i386
Commit message (Collapse)AuthorAgeFilesLines
* [build] Use -no-pie on newer versions of gccMichael Brown2017-06-141-3/+8
| | | | | | | | | | | | | Some distributions patch gcc to generate position independent executables by default. We currently include a workaround to check for this and to add -fno-PIE -nopie to CFLAGS if required. Newer patched versions of gcc require -fno-PIE -no-pie instead. Check for both variants. Reported-by: Nathan Rennie-Waldock <nathan.renniewaldock@gmail.com> Originally-fixed-by: Markos Chandras <mchandras@suse.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [dhcp] Automatically generate vendor class identifier stringMichael Brown2016-07-042-10/+0Star
| | | | | | | | | | | | The vendor class identifier strings in DHCP_ARCH_VENDOR_CLASS_ID are out of sync with the (correct) client architecture values in DHCP_ARCH_CLIENT_ARCHITECTURE. Fix by removing all definitions of DHCP_ARCH_VENDOR_CLASS_ID, and instead generating the vendor class identifier string automatically based on DHCP_ARCH_CLIENT_ARCHITECTURE and DHCP_ARCH_CLIENT_NDI. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [dhcp] Allow for variable encapsulation of architecture-specific optionsMichael Brown2016-07-042-14/+12Star
| | | | | | | | | | | | | DHCPv4 and DHCPv6 share some values in common for the architecture- specific options (such as the client system architecture type), but use different encapsulations: DHCPv4 has a single byte for the option length while DHCPv6 has a 16-bit field for the option length. Move the containing DHCP_OPTION() and related wrappers from the individual dhcp_arch.h files to dhcp.c, thus allowing for the architecture-specific values to be reused in dhcpv6.c. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [comboot] Support COMBOOT in 64-bit buildsMichael Brown2016-04-1510-1991/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [gdb] Add support for x86_64Michael Brown2016-03-223-210/+12Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Move i386-specific tests to arch/i386/testsMichael Brown2016-03-175-0/+347
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Use generic set_bit() functionMichael Brown2016-03-161-23/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Provide an abstraction wrapper for prot_callMichael Brown2016-02-192-13/+7Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Convert prot_call() to a real-mode near callMichael Brown2016-02-181-3/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Discard argument as part of return from prot_call()Michael Brown2016-02-171-3/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Add bin-x86_64-pcbios build platformMichael Brown2016-02-16142-28193/+5Star
| | | | | | | | | | | | | | Move most arch/i386 files to arch/x86, and adjust the contents of the Makefiles and the include/bits/*.h headers to reflect the new locations. This patch makes no substantive code changes, as can be seen using a rename-aware diff (e.g. "git show -M5"). This patch does not make the pcbios platform functional for x86_64; it merely allows it to compile without errors. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Move isolinux definitions to Makefile.pcbiosMichael Brown2016-02-162-22/+22
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Allow librm to be compiled for x86_64Michael Brown2016-02-163-15/+30
| | | | | | | This commit does not make librm functional for x86_64; it merely allows it to compile without errors. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Allow memmap.c to be compiled for x86_64Michael Brown2016-02-161-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Allow bios_console.c to be compiled for x86_64Michael Brown2016-02-161-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Allow bzimage.c to be compiled for x86_64Michael Brown2016-02-161-3/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Allow rtc_entropy.c to be compiled for x86_64Michael Brown2016-02-161-16/+13Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Allow relocate.c to be compiled for x86_64Michael Brown2016-02-161-12/+12
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Use size_t when casting _text16_memsz and _data16_memszMichael Brown2016-02-162-6/+7
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Use intptr_t when casting .text16 function pointersMichael Brown2016-02-169-32/+24Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Split rmsetjmp() and rmlongjmp() into a separate rmsetjmp.hMichael Brown2016-02-167-25/+33
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [prefix] Pad .text16 and .data16 segment sizes at build timeMichael Brown2016-02-122-10/+7Star
| | | | | | | | | | | | | | | | | Commit c64747d ("[librm] Speed up real-to-protected mode transition under KVM") rounded down the .text16 segment address calculated in alloc_basemem() to a multiple of 64 bytes in order to speed up mode transitions under KVM. This creates a potential discrepancy between alloc_basemem() and free_basemem(), meaning that free_basemem() may free less memory than was allocated by alloc_basemem(). Fix by padding the calculated sizes of both .text16 and .data16 to a multiple of 64 bytes at build time. Debugged-by: Yossef Efraim <yossefe@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Clarify comments regarding shrinking of cached DHCP packetMichael Brown2016-02-111-6/+9
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [i386] Add check_bios_interrupts() debug functionMichael Brown2016-01-122-0/+28
| | | | | | | | Provide a debug function check_bios_interrupts() to look for changes to the interrupt vector table. This can be useful when investigating the behaviour (including crashes) of external PXE NBPs. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Add debug message to display real-mode segment addressesMichael Brown2016-01-111-0/+11
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Colourise debug outputMichael Brown2016-01-111-3/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [romprefix] Report an optimistic runtime size estimateMichael Brown2016-01-061-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 5de45cd ("[romprefix] Report a pessimistic runtime size estimate") set the PCI3.0 "runtime size" field equal to the worst-case runtime size, on the basis that there is no guarantee that PMM allocation will succeed and hence no guarantee that we will be able to shrink the ROM image. On a PCI3.0 system where PMM allocation would succeed, this can cause the BIOS to unnecessarily refuse to initialise the iPXE ROM due to a perceived shortage of option ROM space. Fix by reporting the best-case runtime size via the PCI header, and checking that we have sufficient runtime space (if applicable). This allows iPXE ROMs to initialise on PCI3.0 systems that might otherwise fail due to a shortage of option ROM space. This may cause iPXE ROMs to fail to initialise on PCI3.0 systems where PMM is broken. (Pre-PCI3.0 systems are unaffected since there must already have been sufficient option ROM space available for the initialisation entry point to be called.) On balance, it seems preferable to avoid breaking "good" systems (PCI3.0 with working PMM) at the cost of potentially breaking "bad" systems (PCI3.0 with broken PMM). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [vmware] Expose GuestRPC mechanism in 64-bit buildsMichael Brown2016-01-057-953/+0Star
| | | | | | | | | The GuestRPC mechanism (used for VMWARE_SETTINGS and CONSOLE_VMWARE) does not use any real-mode code and so can be exposed in both 64-bit and 32-bit builds. Reported-by: Matthew Helton <mwhelton@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Add support for injecting keypressesMichael Brown2015-12-231-38/+209
| | | | | | | | | | | | | | | | | | | When USB network card drivers are used, the BIOS' legacy USB capability is necessarily disabled since there is no way to share the host controller between the BIOS and iPXE. Commit 3726722 ("[usb] Add basic support for USB keyboards") added support allowing a USB keyboard to be used within iPXE. However, external code such as a PXE NBP has no way to utilise this support, and so a USB keyboard cannot be used to control a PXE NBP loaded from a USB network card. Add support for injecting keypresses from any iPXE console into the BIOS keyboard buffer. This allows external code such as a PXE NBP to function with a USB keyboard even after the BIOS' legacy USB capability has been disabled. 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>
* [comboot] Reset console before starting COMBOOT executableMichael Brown2015-11-172-0/+8
| | | | | | | | | | | | | | | | iPXE does not call shutdown() before invoking a COMBOOT executable, since the executable is allowed to make API calls back into iPXE. If a background picture is used, then the console will not be restored to text mode before invoking the COMBOOT executable. This can cause undefined behaviour. Fix by adding an explicit call to console_reset() immediately before invoking a COMBOOT or COM32 executable, analogous to the call made to console_reset() immediately before invokving a PXE NBP. Debugged-by: Andrew Widdersheim <awiddersheim@inetu.net> Tested-by: Andrew Widdersheim <awiddersheim@inetu.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Generalise CONSOLE_VESAFB to CONSOLE_FRAMEBUFFERMichael Brown2015-10-161-1/+7
| | | | | | | | | | | The name "vesafb" is intrinsically specific to a BIOS environment. Generalise the build configuration option CONSOLE_VESAFB to CONSOLE_FRAMEBUFFER, in preparation for adding EFI framebuffer support. Existing configurations using CONSOLE_VESAFB will continue to work. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [fbcon] Move margin calculations to fbcon.cMichael Brown2015-10-141-28/+2Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [fbcon] Allow character height to be selected at runtimeMichael Brown2015-10-141-5/+23
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Notify BIOS via INT 1a,564e for each new network deviceMichael Brown2015-09-151-0/+26
| | | | | | | | | Use INT 1a,564e to notify the BIOS of each network device that we detect. This provides an opportunity for the BIOS to implement platform policy such as changing the MAC address by issuing a call to PXENV_UNDI_SET_STATION_ADDRESS. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Invoke INT 1a,564e when PXE stack is activatedMichael Brown2015-09-151-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Invoke INT 1a,564e whenever a PXE stack is activated, passing the address of the PXENV+ structure in %es:%bx. This is designed to allow a BIOS to be notified when a PXE stack has been installed, providing an opportunity for start-of-day commands such as setting the MAC address according to a policy chosen by the BIOS. PXE defines INT 1a,5650 as a means of locating the PXENV+ structure: this call returns %ax=0x564e and the address of the PXENV+ structure in %es:%bx. We choose INT 1a,564e as a fairly natural notification call, using the parameters as would be returned by INT 1a,5650. The full calling convention (documented as per section 3.1 of the PXE specification) is: INT 1a,564e - PXE installation notification Enter: %ax = 0x564e %es = 16-bit segment address of the PXENV+ structure %bx = 16-bit offset of the PXENV+ structure Exit: %edx may be trashed (as is the case for INT 1a,5650) All other register contents must be preserved CF is cleared IF is preserved All other flags are undefined Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Generalise tftp_uri() to pxe_uri()Michael Brown2015-09-021-13/+11Star
| | | | | | | | | | | | | | | | | | Merge the functionality of parse_next_server_and_filename() and tftp_uri() into a single pxe_uri(), which takes a server address (IPv4/IPv6/none) and a filename, and produces a URI using the rule: - if the filename is a hierarchical absolute URI (i.e. includes a scheme such as "http://" or "tftp://") then use that URI and ignore the server address, - otherwise, if the server address is recognised (according to sa_family) then construct a TFTP URI based on the server address, port, and filename - otherwise fail. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Search for ldlinux.c32 separately from isolinux.binMichael Brown2015-09-012-10/+20
| | | | | | | | | | | Some distributions (observed with Ubuntu 15.04) place ldlinux.c32 in a separate directory from isolinux.bin. Search for these files separately, and allow an alternative location of ldlinux.c32 to be provided via LDLINUX_C32=... on the make command line. Reported-by: Adrian Koshka <adriankoshcha@teknik.io> Tested-by: Adrian Koshka <adriankoshcha@teknik.io> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Construct all fake DHCP packets before starting PXE NBPMichael Brown2015-08-293-24/+38
| | | | | | | | | | | | | | | | Commit edf74df ("[pxe] Always reconstruct packet for PXENV_GET_CACHED_INFO") fixed the problems caused by returning stale DHCP packets (e.g. from an earlier boot attempt using a different network device), but broke interoperability with NBPs such as WDS which may overwrite our cached (fake) DHCP packets and expect the modified packets to be returned by a subsequent call to PXENV_GET_CACHED_INFO. Fix by constructing the fake DHCP packets immediately before transferring control to a PXE NBP. Calls to PXENV_GET_CACHED_INFO will now never modify the cached packets. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Warn about PXE NBPs that may be EFI executablesMichael Brown2015-08-211-4/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | A relatively common user mistake is to attempt to boot an EFI executable (such as grub.efi) using a BIOS version of iPXE. Unfortunately there are no signature checks that we can use to unambiguously identify a PXE NBP, since a PXE NBP is just raw machine code. We therefore have to accept anything sufficiently small to fit into base memory as a valid PXE NBP. We can detect that a file might be an EFI executable by checking for the initial "MZ" signature bytes. This does not necessarily preclude the file from also being a PXE NBP (since it would be possible to create a hybrid binary which acts as both an EFI executable and a PXE NBP, similar to the way in which wimboot and the Linux kernel are hybrid binaries which act as both an EFI executable and a bzImage). If the initial "MZ" signature bytes are present, then attempt to warn the user by setting the image type to "PXE-NBP (may be EFI?)". We can't (sensibly) prevent the user from accidentally running an EFI executable as a PXE NBP, but we can at least make it easier for the user to identify their mistake. Inspired-by: Robin Smidsrød <robin@smidsrod.no> Inspired-by: Wissam Shoukair <wissams@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [prefix] Use correct register for KEEP_IT_REAL physical address conversionDaniel Pieczko2015-08-141-2/+2
| | | | | Signed-off-by: Daniel Pieczko <dpieczko@solarflare.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [comboot] Avoid dragging in serial console support unconditionallyMichael Brown2015-07-311-1/+3
| | | | | | | | | | | | | | When the ability for iPXE to handle multiple serial ports was added, the choice was made that the singular serial port referred to by COMBOOT calls should mean the port used for the serial console. This unintentionally caused IMAGE_COMBOOT to also enable CONSOLE_SERIAL. Fix by providing a weak-symbol version of the serial console which will be used if serial console support was not explicitly enabled. Reported-by: Torgeir Wulfsberg <Torgeir.Wulfsberg@kongsberg.com> Reported-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [elf] Reject ELFBoot images requiring virtual addressingMichael Brown2015-07-291-1/+32
| | | | | | | | | | | | | | We do not set up any kind of virtual addressing before invoking an ELFBoot image. Reject if the image's program headers indicate that virtual addresses are not equal to physical addresses. This avoids problems when loading some RHEL5 kernels, which seem to include ELFBoot headers using virtual addressing. With this change, these kernels are no longer detected as ELFBoot, and so may be (correctly) detected as bzImage instead. Reported-by: Torgeir.Wulfsberg@kongsberg.com Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Add ANSI blink attributeChristian Nilsson2015-07-221-0/+6
| | | | | | | | | | | | Expose the high bit of the VGA text attribute byte via the ANSI SGR parameters 5 ("blink on") and 25 ("blink off"). Note that some video cards (and virtual machines) may display a high intensity background colour instead of blinking text. Signed-off-by: Christian Nilsson <nikize@gmail.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [comboot] Implement INT22,0x000cWissam Shoukair2015-06-291-0/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [serial] Use new UART abstraction in serial console driverMichael Brown2015-06-291-13/+10Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Always reconstruct packet for PXENV_GET_CACHED_INFOMichael Brown2015-06-291-10/+8Star
| | | | | | | Avoid accidentally returning stale packets (e.g. for a previously attempted network device) by always constructing a fresh DHCP packet. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [mromprefix] Report a dummy size at offset 0x02 of .mrom payloadMichael Brown2015-06-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The size of the .mrom payload (the second PCI ROM image) is defined in its PCI header. The code type for the .mrom payload image is deliberately set to an invalid value (0xff) to ensure that no BIOS tries to parse anything in the image other than the PCI header. Since the code type is not set to 0x00 ("Intel x86, PC-AT compatible"), bytes 0x02-0x17 should not be interpreted by the BIOS as being in the standard ISA expansion ROM format. In particular, the byte at offset 0x02 does not represent the length of the ROM image (in 512-byte blocks). However, some Dell BIOSes seem to erroneously use the byte at offset 0x02 to determine the length of the .mrom payload when walking the list of PCI ROM images. Since this byte is currently set to zero, this can lead to the BIOS getting stuck in an infinite loop during POST. (This problem may not arise if the .mrom payload is the final image in the ROM, since the BIOS will then have no reason to attempt to locate the next image.) One possible workaround would be to put the real payload size in this byte, but doing so would constrain the .mrom payload size to 128kB (see commit 8049a52 ("[mromprefix] Allow for .mrom images larger than 128kB") for more details). Another possible workaround would be to put the real payload size as a word in bytes 0x02-0x03 (as is done for EFI ROMs). This would not constrain the .mrom payload size, but a payload size which happened to be exactly 128kB would result in a zero value in the byte at offset 0x02 and so could still result in infinite loops on BIOSes with this bug. We choose to place a fixed value of 0x01 in the byte at offset 0x02. This should at least prevent the BIOS from getting stuck in an infinite loop. (The BIOS may walk into the middle of the .mrom payload, where it will almost certainly not find a valid {0x55,0xaa} signature or a valid PCIR header, and will therefore hopefully abort processing.) Reported-by: Wissam Shoukair <wissams@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Use flat real mode to call INT 1a,b101Michael Brown2015-06-231-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | Some HP BIOSes (observed with an HP ProLiant m710p Server Cartridge) have a bug in the implementation of INT 1a,b101: they blithely assume that real-mode code is able to read from anywhere in the 32-bit memory space. This problem affects the call to INT 1a,b101 made from within pcibios_num_bus() (which uses REAL_CODE() and hence executes in genuine real mode) but does not affect the call made from within romprefix.S (since with a PMM BIOS, that call executes in flat real mode anyway). Work around the problem by explicitly calling flatten_real_mode() before invoking INT 1a,b101. This is a rarely-used code path, and so the extra overhead of emulating instructions in some VM configurations (see commit 6d4deee ("[librm] Use genuine real mode to accelerate operation in virtual machines") for more details) is negligible. Reported-by: Wissam Shoukair <wissams@mellanox.com> Debugged-by: Wissam Shoukair <wissams@mellanox.com> Debugged-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [int13con] Add basic ability to log to a local disk via INT 13Michael Brown2015-05-192-6/+299
| | | | | | | | | | | | | | | | | | | | | | | | | | | Several popular public cloud providers do not provide any sensible mechanism for obtaining debug output from an OS which is failing to boot. For example, Amazon EC2 provides the "Get System Log" facility, which occasionally deigns to report a random subset of the characters emitted via the VM's serial port, but usually returns only a blank screen. (Amazingly, this is still superior to the debugging facilities provided by Azure.) Work around these shortcomings by adding a console type which sends output to a magically detected raw disk partition, and including such a partition within any iPXE .usb-format image. To use this facility: - build an iPXE .usb image with CONSOLE_INT13 enabled - boot the cloud VM from this image - after the boot fails, attach the VM's boot disk to a second VM - from this second VM, use "less -f -R /dev/sdb3" (or similar) to view the iPXE output. Signed-off-by: Michael Brown <mcb30@ipxe.org>