summaryrefslogtreecommitdiffstats
path: root/src/arch
Commit message (Collapse)AuthorAgeFilesLines
* [pci] Correct invalid base-class/sub-class/prog-if order in PCIRPetr Borsodi2019-01-152-2/+2
| | | | | | | | | PCI Configuration Space contains fields prog-if at the offset 0x09, sub-class at the offset 0x0a and base-class at the offset 0x0b (it respects little endian). PCIR structure uses these fields in the same order. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Include subsystem IDs in broken interrupt device checkMichael Brown2018-04-181-6/+27
| | | | | | | | Allow the subsystem IDs to be used when checking for PXE stacks with broken interrupt support. Suggested-by: Levi Hsieh <Levi.Hsieh@dell.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Ensure that inline code symbols are uniqueMichael Brown2018-03-216-9/+9
| | | | | | | | | | | | | | | Commit 6149e0a ("[librm] Provide symbols for inline code placed into other sections") may cause build failures due to duplicate label names if the compiler chooses to duplicate inline assembly code. Fix by using the "%=" special format string to include a guaranteed-unique number within the label name. The "%=" will be expanded only if constraints exist for the inline assembly. This fix therefore requires that all REAL_CODE() fragments use a (possibly empty) constraint list. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Provide symbols for inline code placed into other sectionsMichael Brown2018-03-211-0/+5
| | | | | | | | | | | | | Provide symbols constructed from the object name and line number for code fragments placed into alternative sections, such as inline REAL_CODE() assembly placed into .text16. This simplifies the debugging task of finding the source code corresponding to a given instruction pointer. Note that we cannot use __FUNCTION__ since it is not a preprocessor macro and so cannot be concatenated with string literals. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Treat invalid IRQ numbers as non-fatal errorsMichael Brown2018-03-211-4/+2Star
| | | | | | | | If the underlying PXE stack reports an invalid IRQ number (above IRQ_MAX), treat this as equivalent to an empty IRQ number and fall back to using polling mode. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Prevent use of MMX and SSE registersMichael Brown2018-03-202-2/+5
| | | | | | | | | | | | | | | | | | | | | | | The existence of MMX and SSE is required by the System V x86_64 ABI and so is assumed by gcc, but these registers are not preserved by our own interrupt handlers and are unlikely to be preserved by other context switch handlers in a boot firmware environment. Explicitly prevent gcc from using MMX or SSE registers to avoid potential problems due to silent register corruption. We must remove the %xmm0-%xmm5 clobbers from the x86_64 version of hv_call() since otherwise gcc will complain about unknown register names. Theoretically, we should probably add code to explicitly preserve the %xmm0-%xmm5 registers across a hypercall, in order to guarantee to external code that these registers remain unchanged. In practice this is difficult since SSE registers are disabled by default: for background information see commits 71560d1 ("[librm] Preserve FPU, MMX and SSE state across calls to virt_call()") and dd9a14d ("[librm] Conditionalize the workaround for the Tivoli VMM's SSE garbling"). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rng] Use fixed-point calculations for min-entropy quantitiesMichael Brown2018-03-201-2/+2
| | | | | | | | | | | | | | We currently perform various min-entropy calculations using build-time floating-point arithmetic. No floating-point code ends up in the final binary, since the results are eventually converted to integers and asserted to be compile-time constants. Though this mechanism is undoubtedly cute, it inhibits us from using "-mno-sse" to prevent the use of SSE registers by the compiler. Fix by using fixed-point arithmetic instead. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [time] Add support for the ACPI power management timerMichael Brown2018-03-202-0/+137
| | | | | | | | Allow the ACPI power management timer to be used if enabled via TIMER_ACPI in config/timer.h. This provides an alternative timer on systems where the standard 8254 PIT is unavailable or unreliable. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Add facility to provide register and stack dump for CPU exceptionsMichael Brown2018-03-183-7/+162
| | | | | | | | | | | | | When DEBUG=librm_mgmt is enabled, intercept CPU exceptions and provide a register and stack dump, then drop to an emergency shell. Exiting from the shell will almost certainly not work, but this provides an opportunity to view the register and stack dump and carry out some basic debugging. Note that we can intercept only the first 8 CPU exceptions, since a PXE ROM is not permitted to rebase the PIC. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Avoid use of "ld --oformat binary"Michael Brown2018-01-022-4/+5
| | | | | | | | | | | | | | | | Using "ld --oformat binary" for mbr.bin and usbdisk.bin seems to cause segmentation faults on some versions of binutils (observed on Fedora 27). Work around this problem by using ld to create an intermediate ELF object, followed by objcopy (via the existing %.tmp -> %.bin rule) to create the final binary. Note that we cannot simply use a single-stage "objcopy -O binary" since this will not process the relocation records for x86_64: see commit 1afcccd ("[build] Do not use "objcopy -O binary" for objects with relocation records"). Reported-by: Brent S <bts@square-r00t.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add missing FILE_LICENCE declarationsMichael Brown2017-12-293-0/+6
| | | | | | | | Add missing FILE_LICENCE declarations to x86_64 headers based on the corresponding i386 headers (from which the x86_64 headers were originally derived). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [romprefix] Avoid unaligned accesses within ROM headersMichael Brown2017-08-302-0/+4
| | | | | | | | | Ensure that all headers (PCI, UNDI, PnP, iPXE) are aligned to at least four bytes, so that all accesses to header fields will be correctly aligned even when reading directly from the expansion ROM BAR. Reported-by: Peter von Konigsmark <peter@exablaze.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Do not steal ownership from the Gen 2 UEFI firmwareMichael Brown2017-07-281-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | We must not steal ownership from the Gen 2 UEFI firmware, since doing so will cause an immediate system crash (most likely in the form of a reboot). This problem was masked before commit a0f6e75 ("[hyperv] Do not fail if guest OS ID MSR is already set"), since prior to that commit we would always fail if we found any non-zero guest OS identity. We now accept a non-zero previous guest OS identity in order to allow for situations such as chainloading from iPXE to another iPXE, and as a prerequisite for commit b91cc98 ("[hyperv] Cope with Windows Server 2016 enlightenments"). A proper fix would be to reverse engineer the UEFI protocols exposed within the Hyper-V Gen 2 firmware and use these to bind to the VMBus device representing the network connection, (with the native Hyper-V driver moved to become a BIOS-only feature). As an interim solution, fail to initialise the native Hyper-V driver if we detect the guest OS identity known to be used by the Gen 2 UEFI firmware. This will cause the standard all-drivers build (ipxe.efi) to fall back to using the SNP driver. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Fix ARM32 EFI builds with current EDK2 headersMichael Brown2017-07-281-0/+4
| | | | | | | | | | | | EDK2 commit 6440385 ("MdePkg/Include: Add enumeration size checks to Base.h") enforced the UEFI specification mandate that enums should always be 32 bits. This revealed a latent bug in iPXE, which does not build with -fno-short-enums. Fix by adding -fno-short-enums to CFLAGS for ARM32 EFI builds. Reported-by: Benjamin S. Allen <bsallen@alcf.anl.gov> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Conditionalise use of -mabi=lp64 for ARM64 buildsMichael Brown2017-07-281-1/+12
| | | | | | | | The -mabi option was added in GCC 4.9. Test for the existence of this option to allow for building with earlier versions of GCC. Reported-by: Benjamin S. Allen <bsallen@alcf.anl.gov> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cpuid] Allow input %ecx value to be specifiedMichael Brown2017-06-166-45/+57
| | | | | | | | | | | | | | | | | | | | For some CPUID leaves (e.g. %eax=0x00000004), the result depends on the input value of %ecx. Allow this subfunction number to be specified as a parameter to the cpuid() wrapper. The subfunction number is exposed via the ${cpuid/...} settings mechanism using the syntax ${cpuid/<subfunction>.0x40.<register>.<function>} e.g. ${cpuid/0.0x40.0.0x0000000b} ${cpuid/1.0x40.0.0x0000000b} to retrieve the CPU topology information. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [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>
* [hdprefix] Avoid attempts to read beyond the end of the diskMichael Brown2017-06-141-5/+9
| | | | | | | | | When booting from a hard disk image (e.g. bin/ipxe.usb) within an emulator such as QEMU, the disk may not exist beyond the end of the image. Limit all reads to the length of the image to avoid spurious errors when loading the iPXE image. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [acpi] Make acpi_find_rsdt() a per-platform methodMichael Brown2017-05-235-16/+171
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Cope with Windows Server 2016 enlightenmentsMichael Brown2017-04-281-10/+125
| | | | | | | | | | | | | | | | | | | | | | | An "enlightened" external bootloader (such as Windows Server 2016's winload.exe) may take ownership of the Hyper-V connection before all INT 13 operations have been completed. When this happens, all VMBus devices are implicitly closed and we are left with a non-functional network connection. Detect when our Hyper-V connection has been lost (by checking the SynIC message page MSR). Reclaim ownership of the Hyper-V connection and reestablish any VMBus devices, without disrupting any existing iPXE state (such as IPv4 settings attached to the network device). Windows Server 2016 will not cleanly take ownership of an active Hyper-V connection. Experimentation shows that we can quiesce by resetting only the SynIC message page MSR; this results in a successful SAN boot (on a Windows 2012 R2 physical host). Choose to quiesce by resetting (almost) all MSRs, in the hope that this will be more robust against corner cases such as a stray synthetic interrupt occurring during the handover. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Remove redundant return status code from mapping functionsMichael Brown2017-04-281-14/+4Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Do not fail if guest OS ID MSR is already setMichael Brown2017-04-261-2/+1Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Provide sandev_read() and sandev_write() as global symbolsMichael Brown2017-04-261-27/+23Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Allow use of a non-default EFI SAN boot filenameMichael Brown2017-04-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | Some older operating systems (e.g. RHEL6) use a non-default filename on the root disk and rely on setting an EFI variable to point to the bootloader. This does not work when performing a SAN boot on a machine where the EFI variable is not present. Fix by allowing a non-default filename to be specified via the "sanboot --filename" option or the "san-filename" setting. For example: sanboot --filename \efi\redhat\grub.efi \ iscsi:192.168.0.1::::iqn.2010-04.org.ipxe.demo:rhel6 or option ipxe.san-filename code 188 = string; option ipxe.san-filename "\\efi\\redhat\\grub.efi"; option root-path "iscsi:192.168.0.1::::iqn.2010-04.org.ipxe.demo:rhel6"; Originally-implemented-by: Vishvananda Ishaya Abrams <vish.ishaya@oracle.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Avoid implicit-fallthrough warnings on GCC 7Michael Brown2017-03-291-0/+2
| | | | | | Reported-by: Vinson Lee <vlee@freedesktop.org> Reported-by: Liang Yan <lyan@suse.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Describe all SAN devices via ACPI tablesMichael Brown2017-03-281-52/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Describe all SAN devices via ACPI tables such as the iBFT. For tables that can describe only a single device (i.e. the aBFT and sBFT), one table is installed per device. For multi-device tables (i.e. the iBFT), all devices are described in a single table. An underlying SAN device connection may be closed at the time that we need to construct an ACPI table. We therefore introduce the concept of an "ACPI descriptor" which enables the SAN boot code to maintain an opaque pointer to the underlying object, and an "ACPI model" which can build tables from a list of such descriptors. This separates the lifecycles of ACPI descriptions from the lifecycles of the block device interfaces, and allows for construction of the ACPI tables even if the block device interface has been closed. For a multipath SAN device, iPXE will wait until sufficient information is available to describe all devices but will not wait for all paths to connect successfully. For example: with a multipath iSCSI boot iPXE will wait until at least one path has become available and name resolution has completed on all other paths. We do this since the iBFT has to include IP addresses rather than DNS names. We will commence booting without waiting for the inactive paths to either become available or close; this avoids unnecessary boot delays. Note that the Linux kernel will refuse to accept an iBFT with more than two NIC or target structures. We therefore describe only the NICs that are actually required in order to reach the described targets. Any iBFT with at most two targets is therefore guaranteed to describe at most two NICs. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [int13con] Avoid overwriting random portions of SAN boot disksMichael Brown2017-03-271-2/+17
| | | | | | | | | | | | | | | | The INT13 console type (CONSOLE_INT13) autodetects at initialisation time a magic partition to be used for logging iPXE console output. If the INT13 drive number mapping is subsequently changed (e.g. because iPXE was used to perform a SAN boot), then the console logging output will be written to the incorrect disk. Fix by recording the INT13 vector at initialisation time, and using this original vector to emulate INT13 calls for all subsequent accesses. This should be robust against drive remapping performed either by ourselves or by another bootloader (e.g. a chainloaded undionly.kpxe which then performs a SAN boot). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [int13] Improve geometry guessing for unaligned partitionsMichael Brown2017-03-261-11/+45
| | | | | | | | | | | | Some partition tables have partitions that are not aligned to a cylinder boundary, which confuses the current geometry guessing logic. Enhance the existing logic to ensure that we never reduce our guesses for the number of heads or sectors per track, and add extra logic to calculate the exact number of sectors per track if we find a partition that starts within cylinder zero. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Add basic multipath supportMichael Brown2017-03-261-6/+14
| | | | | | | | | | | Add basic support for multipath block devices. The "sanboot" and "sanhook" commands now accept a list of SAN URIs. We open all URIs concurrently. The first connection to become available for issuing block device commands is marked as the active path and used for all subsequent commands; all other connections are then closed. Whenever the active path fails, we reopen all URIs and repeat the process. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [video_subr] Use memmove() for overlapping memory copyMichael Brown2017-03-221-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Fail gracefully if asked to ioremap() a zero lengthMichael Brown2017-03-211-1/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Move PXE API caller back into UNDI driverMichael Brown2017-03-195-367/+300Star
| | | | | | | | | | | | | | As of commit 10d19bd ("[pxe] Always retrieve cached DHCPACK and apply to relevant network device"), the UNDI driver has been the only user of pxeparent_call(). Remove the unnecessary layer of abstraction by refactoring this code back into undinet.c, and fix the ability of undiisr.S to fall back to chaining to the original handler if we were unable to unhook our own ISR. This effectively reverts commit 337e1ed ("[pxe] Separate parent PXE API caller from UNDINET driver"). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [int13] Refactor to use centralised SAN device abstractionMichael Brown2017-03-071-685/+264Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Centralise "san-drive" settingMichael Brown2017-03-071-28/+0Star
| | | | | | | | | | | | The concept of the SAN drive number is meaningful only in a BIOS environment, where it represents the INT13 drive number (0x80 for the first hard disk). We retain this concept in a UEFI environment to allow for a simple way for iPXE commands to refer to SAN drives. Centralise the concept of the default drive number, since it is shared between all supported environments. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [int13] Test correct return status from INT 13 callsMichael Brown2017-01-261-5/+5
| | | | | | | | | | | | | INT 13 calls return a status value via %ah, with CF set if %ah is non-zero (indicating an error). Our wrappers zero the whole of %ax if CF is clear, to allow C code (which has no easy access to CF) to simply test for a non-zero status to detect an error. The current code assigns the returned status to a uint8_t, effectively testing %al rather than %ah. Fix by treating the returned status as a uint16_t instead. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [int13] Avoid potential division by zeroMichael Brown2017-01-261-3/+7
| | | | | | | | Avoid using a zero sector count to guess the disk geometry, since that would result in a division by zero when calculating the number of cylinders. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Provide timer based on the 10MHz time reference count MSRMichael Brown2017-01-262-11/+108
| | | | | | | | | | | | | When running on AMD platforms, the legacy hardware emulation is extremely unreliable. In particular, the IRQ0 timer interrupt is likely to simply stop working, resulting in a total failure of any code that relies on timers (such as DHCP retransmission attempts). Work around this by using the 10MHz time counter provided by Hyper-V via an MSR. (This timer can be tested in KVM via the command-line option "-cpu host,hv_time".) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [time] Allow timer to be selected at runtimeMichael Brown2017-01-269-156/+157
| | | | | | | | | | | | | | | | | | | | | | Allow the active timer (providing udelay() and currticks()) to be selected at runtime based on probing during the INIT_EARLY stage of initialisation. TICKS_PER_SEC is now a fixed compile-time constant for all builds, and is independent of the underlying clock tick rate. We choose the value 1024 to allow multiplications and divisions on seconds to be converted to bit shifts. TICKS_PER_MS is defined as 1, allowing multiplications and divisions on milliseconds to be omitted entirely. The 2% inaccuracy in this definition is negligible when using the standard BIOS timer (running at around 18.2Hz). TIMER_RDTSC now checks for a constant TSC before claiming to be a usable timer. (This timer can be tested in KVM via the command-line option "-cpu host,+invtsc".) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cpuid] Provide cpuid_supported() to test for supported functionsMichael Brown2017-01-254-62/+72
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pic8259] Fix definitions for "read IRR" and "read ISR" commandsMichael Brown2017-01-251-2/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [af_packet] Add new AF_PACKET driver for LinuxDavid Decotigny2017-01-221-0/+39
| | | | | | | | | | | | This code largely inspired by tap.c. Allows for testing iPXE on real NICs from within Linux. For example: make bin-x86_64-linux/af_packet.linux valgrind ./bin-x86_64-linux/af_packet.linux --net af_packet,if=eth3 Tested as x86_64 and i386 binary. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Add %.vhd target for building VM bootable disk imagesMichael Brown2017-01-221-0/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Try matching UNDI ROMs in BIOS enumeration orderMichael Brown2016-12-071-1/+1
| | | | | | | | | | | | | | | When searching for an UNDI ROM to match against a PCI device, search in order of increasing ROM address (within the 128kB BIOS option ROM area). This is likely (though not guaranteed) to match the order of the original enumeration performed by the BIOS, which is in turn likely to match the order of enumeration on the PCI bus. Since we load at most one UNDI ROM, the net result is that we increase our chances of loading the ROM corresponding to the selected PCI device (rather than loading a ROM corresponding to a higher-numbered PCI device with the same vendor and device IDs.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [prefix] Include diagnostic information within progress messagesMichael Brown2016-12-061-14/+38
| | | | | | | Include some relevant diagnostic infomation within the progress messages generated via DEBUG=libprefix. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [prefix] Remove impossible progress messageMichael Brown2016-12-061-1/+0Star
| | | | | | | | | | | | | | | | | | | | The "progress" macro can be used only from within the .prefix section. At the point of calling relocate(), we are running in .text16 and so the near call to print_message() will end up calling a random function somewhere in .text16. Interestingly, this problem has remained unnoticed for some time. It is rare to build with DEBUG=libprefix. In the few cases that it has been used during development, the randomly selected function in .text16 seems to have been a harmless no-op with no visible side-effects (beyond the unnoticed failure to print the "relocate" progress message). Fix by removing the futile attempt to print a progress message before calling relocate(). Reported-by: Raed Salem <raeds@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Clean up driver and device name informationMichael Brown2016-12-055-39/+32Star
| | | | | | | | | | | | | | | | | | | | Fix the <NULL> driver name reported by "ifstat" when using the undipci driver (due to the unnecessary extra device node inserted as a child of the PCI device). Remove the "UNDI-" prefix from device names since the driver name is also now visible via "ifstat", and tidy up the device name to match the format used by standard PCI devices. The output from "ifstat" now resembles: iPXE> ifstat net0: 52:54:00:12:34:56 using undipci on 0000:00:03.0 iPXE> ifstat net0: 52:54:00:12:34:56 using undionly on 0000:00:03.0 Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [romprefix] Avoid using PMM-allocated memory in UNDI loader entry pointMichael Brown2016-12-052-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The UNDI loader entry point is very likely to be called after POST, when there is a high chance that the PMM-allocated image source area and decompression area have been reused by something else. In particular, using an iPXE .iso to test a separate iPXE ROM's UNDI loader entry point in a qemu VM is likely to crash. SeaBIOS allocates PMM blocks from close to the top of memory and so these blocks have a high chance of colliding with the runtime addresses subsequently chosen by the non-ROM iPXE by scanning the INT 15,e820 memory map. The standard romprefix.S has no choice about relying on the PMM-allocated image source area, since it has no other way to retrieve its compressed payload. In mromprefix.S, the image source area functions only as an optional buffer used to avoid repeated reads from the (potentially slow) expansion ROM BAR by the decompression code. We can therefore always set %esi=0 when calling install_prealloc from the UNDI loader entry point, and simply fall back to reading directly from the expansion ROM BAR. We can always set %edi=0 when calling install_prealloc from the UNDI loader entry point. This will behave as though the decompression area PMM allocation failed, and will therefore use INT 15,88 to find a temporary decompression area somewhere close to 64MB. This is by no means guaranteed to be safe from collisions, but it's probably safer on balance than the PMM-allocated address. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Allocate base memory before calling UNDI loader entry pointMichael Brown2016-12-051-14/+16
| | | | | | | | Allocate base memory (by decreasing the free base memory counter) before calling the UNDI loader entry point, to minimise surprises for the UNDI loader code. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Conditionalize the workaround for the Tivoli VMM's SSE garblingLaszlo Ersek2016-11-081-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 71560d1 ("[librm] Preserve FPU, MMX and SSE state across calls to virt_call()") added FXSAVE and FXRSTOR instructions to iPXE. In KVM virtual machines, these instructions execute fine as long as the host CPU supports the "unrestricted_guest" feature (that is, it can virtualize big real mode natively). On older host CPUs however, KVM has to emulate big real mode, and it currently doesn't implement FXSAVE emulation. Upstream QEMU rebuilt iPXE at commit 0418631 ("[thunderx] Fix compilation with older versions of gcc") which is a descendant of commit 71560d1 (see above). This was done in QEMU commit ffdc5a2 ("ipxe: update submodule from 4e03af8ec to 041863191"). The resultant binaries were bundled with the QEMU v2.7.0 release; see QEMU commit c52125a ("ipxe: update prebuilt binaries"). This distributed the iPXE workaround for the Tivoli VMM bug to a number of KVM users with old host CPUs, causing KVM emulation failures (guest crashes) for them while netbooting. Make the FXSAVE and FXRSTOR instructions conditional on a new feature test macro called TIVOLI_VMM_WORKAROUND. Define the macro by default. There is prior art for an assembly file including config/general.h: see arch/x86/prefix/romprefix.S. Also, TIVOLI_VMM_WORKAROUND seems to be a good fit for the "Obscure configuration options" section in config/general.h. Cc: Bandan Das <bsd@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Greg <rollenwiese@yahoo.com> Cc: Michael Brown <mcb30@ipxe.org> Cc: Michael Prokop <launchpad@michael-prokop.at> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Peter Pickford <arch@netremedies.ca> Cc: Radim Krčmář <rkrcmar@redhat.com> Ref: https://bugs.archlinux.org/task/50778 Ref: https://bugs.launchpad.net/qemu/+bug/1623276 Ref: https://bugzilla.proxmox.com/show_bug.cgi?id=1182 Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1356762 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bzimage] Fix page alignment of initrd imagesMichael Brown2016-10-291-3/+5
| | | | | | | | | | | | The initrd_addr_max field represents the highest byte address that may be used to hold initrd images, and is therefore almost certainly not aligned to a page boundary: a typical value might be 0x7fffffff. Fix the address calculations to ensure that the initrd images are always aligned to a page boundary. Reported-by: Sitsofe Wheeler <sitsofe@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>