summaryrefslogtreecommitdiffstats
path: root/src/arch
Commit message (Collapse)AuthorAgeFilesLines
...
* [cmdline] Add "poweroff" commandMarin Hannache2013-07-152-0/+109
| | | | | | Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add FILE_LICENCE for valgrind headersMarin Hannache2013-07-142-0/+4
| | | | | Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [linux] Add support for accessing PCI configuration space via /proc/bus/pciMichael Brown2013-07-131-0/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Work around bug in gcc >= 4.8Michael Brown2013-06-071-3/+5
| | | | | | | | | | | | | | | | | | | gcc 4.8 and 4.9 fail to compile pxe_call.c with the error "bp cannot be used in asm here". Other points in the codebase which use "ebp" in the asm clobber list do not seem to be affected. Unfortunately gcc provides no way to specify %ebp as an output register, so we cannot use this as a workaround. The only viable solution is to explicitly push/pop %ebp within the asm itself. This is ugly for two reasons: firstly, it may be unnecessary; secondly, it may cause gcc to generate invalid %esp-relative addresses if the asm happens to use memory operands. This specific block of asm uses no memory operands and so will not generate invalid code. Reported-by: Daniel P. Berrange <berrange@redhat.com> Reported-by: Christian Hesse <list@eworm.de> Originally-fixed-by: Christian Hesse <list@eworm.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bzimage] Fix spurious uninitialised-variable warning on some gcc versionsMichael Brown2013-06-051-0/+1
| | | | | Reported-by: Matthew Helton <mwhelton@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bzimage] Align initrd images to page boundaryMichael Brown2013-06-052-19/+16Star
| | | | | | | | | | | | | | | | | | | | Some versions of Linux apparently complain if initrds are not aligned to a page boundary. Fix by changing INITRD_ALIGN from 4 bytes to 4096 bytes. The amount of padding at the end of each initrd will now often be sufficient to allow the cpio header to be prepended without crossing an alignment boundary. The final location of the initrd may therefore end up being slightly higher than the post-shuffle location. bzimage_load_initrd() must therefore now copy the initrd body prior to copying the cpio header, otherwise the start of the initrd body may be overwritten by the cpio header. (Note that the guarantee that an initrd will never need to overwrite an initrd at a higher location still holds, since the overall length of each initrd cannot decrease as a result of adding a cpio header.) Reported-by: Dave Hansen <dave@sr71.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Add efidrv.cab target for UEFI Secure Boot signingMichael Brown2013-05-142-5/+13
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Provide "allXXXs" targets for all media on all platformsMichael Brown2013-05-141-0/+7
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [romprefix] Fix incorrect pointer offset in undiloader.SFrediano Ziglio2013-05-141-2/+2
| | | | | | | | | | | | | Commit 2422647 ("[prefix] Allow prefix to specify an arbitrary maximum address for relocation") introduced a regression into the UNDI ROM loader by preserving an extra register on the stack without modifying the %sp-relative addresses used in the routine. Fix by correcting the %sp-relative addresses to allow for the extra preserved variable. Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Use $(eval) if availableMichael Brown2013-05-141-5/+5
| | | | | | | | | When the $(eval) function is available (in GNU make >= 3.80), we can evaluate many of the dynamically-generated Makefile rules directly. This avoids generating a few hundred Makefile fragments in the filesystem, and so speeds up the build process. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Eliminate settings "tag magic"Michael Brown2013-05-011-1/+1
| | | | | | | Create an explicit concept of "settings scope" and eliminate the magic values used for numerical setting tags. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [romprefix] Report failure cause when unable to open payloadMichael Brown2013-04-301-4/+7
| | | | | | | | | | | | | | | | | Report the cause of the failure when we are unable to open the .mrom payload. There are two possible failure cases: - Unable to find a suitable memory BAR to borrow (e.g. if the NIC doesn't have a memory BAR that is at least as large as the expansion ROM BAR, or if the memory BAR has been assigned a 64-bit address which won't fit into the 32-bit expansion ROM BAR). This will be reported as "BABABABA". - Unable to find correct ROM image within the BAR. This will be reported as the address (within the borrowed BAR) at which we first fail to find a valid 55AA signature. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Convert external PXE API errors into iPXE platform-generated errorsMichael Brown2013-04-294-16/+27
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Perform meaningful error code conversionsMichael Brown2013-04-191-1/+2
| | | | | | | | Exploit the redefinition of iPXE error codes to include a "platform error code" to allow for meaningful conversion of EFI_STATUS values to iPXE errors and vice versa. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Redefine low 8 bits of error code as "platform error code"Michael Brown2013-04-193-0/+239
| | | | | | | | | | The low 8 bits of an iPXE error code are currently defined as the closest equivalent PXE error code. Generalise this scheme to platforms other than PC-BIOS by extending this definition to "closest equivalent platform error code". This allows for the possibility of returning meaningful errors via EFI APIs. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Fix screen clearing on buggy BIOSesMichael Brown2013-04-171-1/+1
| | | | | | | | | | | | The implementation of INT 10,06 on some BIOSes (observed with both Hyper-V and a Dell OptiPlex 7010) seems to treat %dx=0xffff as a special value meaning "do absolutely nothing". Fix by using %dx=0xfefe, which should still be sufficient to cover any realistic screen size. Reported-by: John Clark <skyman@iastate.edu> Tested-by: John Clark <skyman@iastate.edu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Add ability to perform a warm rebootMichael Brown2013-03-222-1/+10
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add "reboot" command for EFIMichael Brown2013-03-224-33/+51
| | | | | | | | | Abstract out the ability to reboot the system to a separate reboot() function (with platform-specific implementations), add an EFI implementation, and make the existing "reboot" command available under EFI. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Avoid strict-aliasing warning for gcc 4.3Bo Yang2013-03-211-2/+2
| | | | | Signed-off-by: Bo Yang <boyang@suse.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [smbios] Provide SMBIOS version number via smbios_version()Michael Brown2013-03-201-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [int13] Split out ISO9660 and El Torito definitions to separate header filesMichael Brown2013-03-202-116/+2Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [lkrnprefix] Allow relocation when no initrd is presentMichael Brown2013-03-151-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | Commit 2629b7e ("[pcbios] Inhibit all calls to INT 15,e820 and INT 15,e801 during POST") introduced a regression into .lkrn images when used with no corresponding initrd. Specifically, the semantics of the "maximum address for relocation" value passed to install_prealloc() in %ebp changed so that zero became a special value meaning "inhibit use of INT 15,e820 and INT 15,e801". The %ebp value meaing "no upper limit on relocation" was changed from zero to 0xffffffff, and all prefixes providing fixed values for %ebp were updated to match the new semantics. The .lkrn prefix provides the initrd base address as the maximum address for relocation. When no initrd is present, this address will be zero, and so will unintentionally trigger the "inhibit INT 15,e820 and INT 15,e801" behaviour. Fix by explicitly setting %ebp to 0xffffffff if no initrd is present before calling install_prealloc(). Reported-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk> Tested-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [romprefix] Display only one "Ctrl-B" prompt per PCI device during POSTMichael Brown2013-03-111-3/+11
| | | | | | | | | | | | | If a multifunction PCI device exposes an iPXE ROM via each function, then each function will display a "Press Ctrl-B to configure iPXE" prompt, and delay for two seconds. Since a single instance of iPXE can drive all functions on the multifunction device, this simply adds unnecessary delay to the boot process. Fix by inhibiting the "Press Ctrl-B" prompt for all except the first function on a PCI device. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pcbios] Inhibit all calls to INT 15,e820 and INT 15,e801 during POSTMichael Brown2013-03-116-10/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many BIOSes do not construct the full system memory map until after calling the option ROM initialisation entry points. For several years, we have added sanity checks and workarounds to accommodate charming quirks such as BIOSes which report the entire 32-bit address space (including all memory-mapped PCI BARs) as being usable RAM. The IBM x3650 takes quirky behaviour to a new extreme. Calling either INT 15,e820 or INT 15,e801 during POST doesn't just get you invalid data. We could cope with invalid data. Instead, these nominally read-only API calls manage to trash some internal BIOS state, with the result that the system memory map is _never_ constructed. This tends to confuse subsequent bootloaders and operating systems. [ GRUB 0.97 fails in a particularly amusing way. Someone thought it would be a good idea for memcpy() to check that the destination memory region is a valid part of the system memory map; if not, then memcpy() will sulk, fail, and return NULL. This breaks pretty much every use of memcpy() including, for example, those inserted implicitly by gcc to copy non-const initialisers. Debugging is _fun_ when a simple call to printf() manages to create an infinite recursion, exhaust the available stack space, and shut down the CPU. ] Fix by completely inhibiting calls to INT 15,e820 and INT 15,e801 during POST. We do now allow relocation during POST up to the maximum address returned by INT 15,88 (which seems so far to always be safe). This allows us to continue to have a reasonable size of external heap, even if the PMM allocation is close to the 1MB mark. The downside of allowing relocation during POST is that we may overwrite PMM-allocated memory in use by other option ROMs. However, the downside of inhibiting relocation, when combined with also inhibiting calls to INT 15,e820 and INT 15,e801, would be that we might have no external heap available: this would make booting an OS impossible and could prevent some devices from even completing initialisation. On balance, the lesser evil is probably to allow relocation during POST (up to the limit provided by INT 15,88). Entering iPXE during POST is a rare operation; on the even rarer systems where doing so happens to overwrite a PMM-allocated region, then there exists a fairly simple workaround: if the user enters iPXE during POST and wishes to exit iPXE, then the user must reboot. This is an acceptable cost, given the rarity of the situation and the simplicity of the workaround. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [prefix] Use %cs as implicit parameter to uninstall()Michael Brown2013-03-081-6/+6
| | | | | | | | | | | | | romprefix.S currently calls uninstall() with an invalid value in %ax. Consequently, base memory is not freed after a ROM boot attempt (or after entering iPXE during POST). The uninstall() function is physically present in .text16, and so can use %cs to determine the .text16 segment address. The .data16 segment address is not required, since uninstall() is called only by code paths which set up .data16 to immediately follow .text16. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [nbiprefix] Set up real-mode stack before jumping to .text16Michael Brown2013-03-081-0/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pcbios] Add extra debugging messages when unhiding iPXE from memoryMichael Brown2013-03-081-5/+15
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tftp] Allow TFTP block size to be controlled via the PXE TFTP APIMichael Brown2013-03-061-7/+20
| | | | | | | | | | | | | | The PXE TFTP API allows the caller to request a particular TFTP block size. Since mid-2008, iPXE has appended a "?blksize=xxx" parameter to the TFTP URI constructed internally; nothing has ever parsed this parameter. Nobody seems to have cared that this parameter has been ignored for almost five years. Fix by using xfer_window(), which provides a fairly natural way to convey the block size information from the PXE TFTP API to the TFTP protocol layer. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Work around specific devices with known broken interrupt behaviourMichael Brown2013-03-051-0/+52
| | | | | | | | | | | | | | | | Some PXE stacks are known to claim that IRQs are supported, but then never generate interrupts. No satisfactory solution has been found to this problem; the workaround is to add the PCI vendor and device IDs to a list of devices which will be treated as simply not supporting interrupts. This is something of a hack, since it will generate false positives for identical devices with a working PXE stack (e.g. those that have been reflashed with iPXE), but it's an improvement on the current situation. Reported-by: Richard Moore <rich@richud.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bzimage] Allow initrds to be rearranged in placeMichael Brown2012-11-131-73/+140
| | | | | | | | At present, loading a bzImage via iPXE requires enough RAM to hold two copies of each initrd file. Remove this constraint by rearranging the initrds in place. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [initrd] Add ability to reshuffle initrds into image list orderMichael Brown2012-11-123-0/+330
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Relicense x86 string.hMichael Brown2012-11-121-19/+24
| | | | | | | No code from the original source remains within this file; relicense under GPL2+ with a new copyright notice. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Fix and externalise memswap()Michael Brown2012-11-122-15/+30
| | | | | | Make memswap() behave correctly if called with a length of zero. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Reduce overall code size by externalising strlen()Michael Brown2012-11-122-12/+20
| | | | | | Typical saving is 5-20 bytes in each file using strlen(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Reduce overall code size by externalising strncmp()Michael Brown2012-11-122-21/+40
| | | | | | Typical saving is 20-30 bytes in each file using strncmp(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Remove unnecessary "cld" instruction from memset()Michael Brown2012-11-121-11/+18
| | | | | | Saving is one byte per call to memset(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Convert memcpy() from a macro to an inline functionMichael Brown2012-11-121-4/+24
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Reduce overall code size by externalising memmove()Michael Brown2012-11-122-24/+74
| | | | | | Typical saving is 15-20 bytes in each file using memmove(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Remove obsolete implementation of memcpy()Michael Brown2012-11-121-12/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [umalloc] Split largest_memblock() function out from init_eheap()Michael Brown2012-11-061-49/+8Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uaccess] Add userptr_sub() to find the difference between two user pointersMichael Brown2012-11-051-0/+6
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Include version number within only a single object fileMichael Brown2012-11-023-8/+15
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Use -maccumulate-outgoing-args if required by gccMichael Brown2012-11-021-0/+12
| | | | | | | | | | | | | Current versions of gcc require -maccumulate-outgoing-args if any sysv_abi functions call ms_abi functions. This requirement is likely to be lifted in future gcc versions, so test explicitly to see if the current version of gcc requires -maccumulate-outgoing-args. This problem is currently masked since the implied -fasynchronous-unwind-tables (which is the default in current gcc versions) implies -maccumulate-outgoing-args. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [int13] Do not zero %edx when jumping to a boot sectorMichael Brown2012-10-051-1/+1
| | | | | | | | | | | Commit 73eb3f1 ("[int13] Zero all possible registers when jumping to a boot sector") introduced a regression preventing the SAN-booting of boot sectors which rely upon %dl containing the correct drive number (such as most CD-ROM boot sectors). Fix by not zeroing %edx. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [int13] Zero all possible registers when jumping to a boot sectorMichael Brown2012-09-141-1/+14
| | | | | | | | | | | | At least one boot sector (the DUET boot sector used for bootstrapping EFI from a non-EFI system) fails to initialise the high words of registers before using them in calculations, leading to undefined behaviour. Work around such broken boot sectors by explicitly zeroing the contents of all registers apart from %cs:%ip and %ss:%sp. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [int13] Use correct size when estimating floppy disk geometryMichael Brown2012-09-141-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Add support for the bochs/qemu debug port consoleMichael Brown2012-09-101-0/+86
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [sdi] Add support for SDI imagesMichael Brown2012-09-053-0/+176
| | | | | | | Add support (disabled by default) for booting .sdi images as used by Windows XP Embedded. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ipoib] Expose Ethernet-compatible eIPoIB link-layer addresses and headersMichael Brown2012-08-311-1/+2
| | | | | | | | | | | | | Almost all clients of the raw-packet interfaces (UNDI and SNP) can handle only Ethernet link layers. Expose an Ethernet-compatible link layer to local clients, while remaining compatible with IPoIB on the wire. This requires manipulation of ARP (but not DHCP) packets within the IPoIB driver. This is ugly, but it's the only viable way to allow IPoIB devices to be driven via the raw-packet interfaces. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [comboot] Accept only ".cbt" as an extension for COMBOOT imagesMichael Brown2012-08-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | COMBOOT images are detected by looking for a ".com" or ".cbt" filename extension. There are widely-used files with a ".com" extension, such as "wdsnbp.com", which are PXE images rather than COMBOOT images. Avoid false detection of PXE images as COMBOOT images by accepting only a ".cbt" extension as indicating a COMBOOT image. Interestingly, this bug has been present for a long time but was frequently concealed because the filename was truncated to fit the fixed-length "name" field in struct image. (PXE binaries ending in ".com" tend to be related to Windows deployment products and so often use pathnames including backslashes, which iPXE doesn't recognise as a path separator and so treats as part of a very long filename.) Commit 1c127a6 ("[image] Simplify image management commands and internal API") made the image name a variable-length field, and so exposed this flaw in the COMBOOT image detection algorithm. Signed-off-by: Michael Brown <mcb30@ipxe.org>