summaryrefslogtreecommitdiffstats
path: root/src/arch
Commit message (Collapse)AuthorAgeFilesLines
...
* [librm] Convert prot_call() to a real-mode near callMichael Brown2016-02-1816-23/+6Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [prefix] Standardise calls to prot_call()Michael Brown2016-02-182-11/+28
| | | | | | | Use the standard "pushl $function ; pushw %cs ; call prot_call" sequence everywhere that prot_call() is used. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Simplify definitions for prot_call() and real_call() stack framesMichael Brown2016-02-181-14/+17
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [prefix] Use garbage-collectable section namesMichael Brown2016-02-181-20/+20
| | | | | | Allow unused sections of libprefix.o to be removed via --gc-sections. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Use an 8kB stack for x86_64Michael Brown2016-02-181-1/+7
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Use garbage-collectable section namesMichael Brown2016-02-181-22/+26
| | | | | | Allow unused sections of librm.o to be removed via --gc-sections. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Make uses of REAL_CODE() and PHYS_CODE() 64-bit cleanMichael Brown2016-02-185-13/+17
| | | | | | | | | | | | | | | | | | | | | | | On a 64-bit CPU, any modification of a register by 32-bit or 16-bit code will destroy the invisible upper 32 bits of the corresponding 64-bit register. For example: a 32-bit "pushl %eax" followed by a "popl %eax" will zero the upper half of %rax. This differs from the treatment of upper halves of 32-bit registers by 16-bit code: a "pushw %ax" followed by a "popw %ax" will leave the upper 16 bits of %eax unmodified. Inline assembly generated using REAL_CODE() or PHYS_CODE() will therefore have to preserve the upper halves of all registers, to avoid clobbering registers that gcc expects to be preserved. Output operands from REAL_CODE() and PHYS_CODE() assembly may therefore contain undefined values in the upper 32 bits. Fix by using explicit variable widths (e.g. uint32_t) for non-discarded output operands, to ensure that undefined values in the upper 32 bits of 64-bit registers are ignored. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [romprefix] Align PMM temporary decompression area to a page boundaryMichael Brown2016-02-181-6/+9
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [prefix] Align INT 15,88 temporary decompression area to a page boundaryMichael Brown2016-02-181-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Discard argument as part of return from real_call()Michael Brown2016-02-172-2/+1Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Discard argument as part of return from prot_call()Michael Brown2016-02-1715-22/+6Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Add bin-x86_64-pcbios build platformMichael Brown2016-02-16155-240/+198Star
| | | | | | | | | | | | | | 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-058-1/+1
| | | | | | | | | 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-073-0/+12
| | | | 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>
* [efi] Hold off watchdog timer while runningMichael Brown2015-08-031-0/+5
| | | | | | | | | | | | | | | | UEFI platforms may provide a watchdog timer, which will reboot the machine if an operating system takes more than five minutes to load. This can cause long-lived iPXE downloads (or interactive shell sessions) to unexpectedly reboot. Fix by resetting the watchdog timer every ten seconds while the iPXE main processing loop continues to run. Reported-by: Bradley B Williams <bradleybwilliams@swbell.net> Reported-by: John Clark <john.r.clark.3@gmail.com> Reported-by: wdriever@gmail.com Reported-by: Charlie Beima <cbeima@indiana.edu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [serial] Check for UART existence in uart_select()Michael Brown2015-07-311-8/+15
| | | | | | | | | | | Check for existence of the UART in uart_select(), not just in uart_init(). This allows uart_select() to refuse to set a non-working address in uart->base, which in turns means that the serial console code will not attempt to use a non-existent UART. 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>
* [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>
* [xen] Wait for and clear XenStore event before receiving dataMichael Brown2015-06-301-0/+19
| | | | | | | | | | | | | | | Older, out-of-tree Xen kernel modules (such as those provided with SuSE Linux Enterprise Server 11) do not clear the leftover "event pending" bit when opening an event channel. Consequently, no event is ever delivered to indicate that there is information in the XenStore ring buffer, and the system hangs shortly after loading the xen-platform-pci kernel module. Work around this problem by always waiting for the XenStore event channel to be signalled, and clearing the event before processing the received data. 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>