aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2014-04-28[http] Profile receive datapathMichael Brown1-0/+13
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-28[tcp] Profile transmit and receive datapathsMichael Brown1-0/+20
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-28[ipv4] Profile transmit and receive datapathsMichael Brown1-0/+15
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-28[librm] Use genuine real mode to accelerate operation in virtual machinesMichael Brown2-5/+38
We currently use flat real mode wherever real mode is required. This guarantees that we will not surprise some unsuspecting external caller which has carefully set up flat real mode by suddenly reducing the segment limits to 64kB. However, operating in flat real mode imposes a severe performance penalty in some virtualisation environments, since some CPUs cannot fully virtualise flat real mode and so the hypervisor must fall back to emulation. In particular, operating under KVM on a pre-Westmere Intel CPU will be at least an order of magnitude slower, to the point that there is a visible teletype effect when printing anything to the BIOS console. (Older versions of KVM used to cheat and ignore the "flat" part of flat real mode, which masked the problem.) Switch (back) to using genuine real mode with 64kB segment limits instead of flat real mode. Hopefully this won't break anything. Add an explicit switch to flat real mode before returning to the BIOS from the ROM prefix, since we know that a PMM BIOS will call the ROM initialisation point (and potentially the BEV) in flat real mode. As noted in previous commit messages, it is not possible to restore the real-mode segment limits after a transition to protected mode, since there is no way to know which protected-mode segment descriptor was originally used to initialise the limit portion of the segment register. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-27[intel] Push new RX descriptors in batchesMichael Brown1-8/+13
Inside a virtual machine, writing the RX ring tail pointer may incur a substantial overhead of processing inside the hypervisor. Minimise this overhead by writing the tail pointer once per batch of descriptors, rather than once per descriptor. Profiling under qemu-kvm (version 1.6.2) shows that this reduces the amount of time taken to refill the RX descriptor ring by around 90%. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-27[intel] Profile common virtual machine operationsMichael Brown1-0/+19
Operations which are negligible on physical hardware (such as issuing a posted write to the transmit ring tail register) may involve substantial amounts of processing within the hypervisor if running in a virtual machine. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-27[netdevice] Profile common operationsMichael Brown1-0/+16
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-27[cmdline] Add "profstat" command to display profiling statisticsMichael Brown5-0/+132
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-27[profile] Add generic profiling infrastructureMichael Brown10-76/+591
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-27[libc] Add flsll()Michael Brown4-7/+112
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-26[libc] Add isqrt() function to find integer square rootsMichael Brown3-0/+77
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-26[test] Check for correct -mrtd assumption on libgcc arithmetic functionsMichael Brown1-4/+74
As observed in commit 082cedb ("[build] Fix __libgcc attribute for recent gcc versions"), recent versions of gcc have changed the semantics of -mrtd as applied to the implicit arithmetic functions. It is possible for tests to succeed even if our assumptions about gcc's interpretation of -mrtd are incorrect. In particular, if gcc chooses to utilise a frame pointer in the calling function, then it can tolerate a temporarily incorrect stack pointer (since the stack pointer will shortly afterwards be restored from the frame pointer anyway). Add tests designed specifically to check that our implementations of the implicit arithmetic functions manipulate the stack pointer as expected by gcc. The effect of these tests can be observed by temporarily reverting commit 082cedb ("[build] Fix __libgcc attribute for recent gcc versions"): without this fix in place, the tests will fail on gcc 4.7 and later. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-25[build] Fix __libgcc attribute for recent gcc versionsMichael Brown1-0/+11
We observed some time ago (in commit 4ce8d61 "Import various libgcc functions from syslinux") that gcc seems to treat calls to the implicit arithmetic functions (e.g. __udivdi3()) as being affected by -mregparm but unaffected by -mrtd. This seems to be no longer the case with current gcc versions, which treat calls to these functions as being affected by both -mregparm and -mrtd, as expected. There is nothing obvious in the gcc changelogs to indicate precisely when this happened. From experimentation with available gcc versions, the change occurred sometime between v4.6.3 and v4.7.2. We assume that only versions up to v4.6.x require the special treatment. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-25[test] Add tests for 64-bit divisionMichael Brown1-0/+122
On a 32-bit system, 64-bit division is implemented using the libgcc functions provided in __udivmoddi4.c etc. Calls to these functions are generated automatically by gcc, with a calling convention that is somewhat empirical in nature. Add these self-tests primarily as a check that we are using the correct calling convention. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-24[libc] Add inline assembly implementation of flsl() using BSR instructionMichael Brown3-15/+33
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-24[test] Add self-tests for flsl()Michael Brown2-0/+87
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-24[test] Rewrite TCP/IP tests using okx()Michael Brown1-38/+53
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-22[serial] Enable UART FIFOsPeter Pickford1-2/+2
Escape sequences received via the serial console can fail since the cpu_nap() in getchar_timeout() can delay processing for more than the time it takes for a single character to arrive. Fix by enabling the UART FIFOs. Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-22[intel] Avoid completely filling the TX descriptor ringMichael Brown2-1/+4
It is unclear from the datasheets whether or not the TX ring can be completely filled (i.e. whether writing the tail value as equal to the current head value will cause the ring to be treated as completely full or completely empty). It is very plausible that this edge case could differ in behaviour between real hardware and the many implementations of an emulated Intel NIC found in various virtual machines. Err on the side of caution and always leave at least one ring entry empty. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-01[crypto] Allow wildcard matches on commonName as well as subjectAltNameMichael Brown1-10/+8
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-31[crypto] Add support for subjectAltName and wildcard certificatesMichael Brown4-8/+160
Originally-implemented-by: Alex Chernyakhovsky <achernya@google.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-31[test] Add subject alternative names to X.509 server test certificateMichael Brown1-69/+75
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-31[test] Add tests for x509_check_name()Michael Brown1-0/+38
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-31[test] Rewrite CMS tests using okx()Michael Brown1-14/+40
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-31[test] Rewrite X.509 tests using okx()Michael Brown1-61/+145
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-30[crypto] Allow signed timestamp error margin to be configured at build timeMichael Brown4-12/+28
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-28[crypto] Use fingerprint when no common name is available for debug messagesMichael Brown1-4/+14
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-28[crypto] Generalise X.509 cache to a full certificate storeMichael Brown18-398/+640
Expand the concept of the X.509 cache to provide the functionality of a certificate store. Certificates in the store will be automatically used to complete certificate chains where applicable. The certificate store may be prepopulated at build time using the CERT=... build command line option. For example: make bin/ipxe.usb CERT=mycert1.crt,mycert2.crt Certificates within the certificate store are not implicitly trusted; the trust list is specified using TRUST=... as before. For example: make bin/ipxe.usb CERT=root.crt TRUST=root.crt This can be used to embed the full trusted root certificate within the iPXE binary, which is potentially useful in an HTTPS-only environment in which there is no HTTP server from which to automatically download cross-signed certificates or other certificate chain fragments. This usage of CERT= extends the existing use of CERT= to specify the client certificate. The client certificate is now identified automatically by checking for a match against the private key. For example: make bin/ipxe.usb CERT=root.crt,client.crt TRUST=root.crt KEY=client.key Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-27[crypto] Add pubkey_match() to check for matching public/private key pairsMichael Brown2-26/+107
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-26[build] Add dependency of generated files upon MakefileMichael Brown1-5/+5
Ensure that any generated files (such as DER forms of X.509 certificates) are rebuilt if the Makefile changes. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-26[build] Disable ccache for all relevant build targetsMichael Brown1-4/+3
The build process currently attempts to disable ccache for files using the .incbin directive, but the rule fails to apply to anything beyond the simple object target. Fix by applying to all relevant build targets (including debug objects, assembly listings, and so on). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-26[build] Remove long-obsolete mechanism for wrapping embedded imagesMichael Brown1-9/+0
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-25[crypto] Remove dynamically-allocated storage for certificate OCSP URIMichael Brown4-35/+19
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-25[crypto] Remove dynamically-allocated storage for certificate nameMichael Brown6-108/+143
iPXE currently allocates a copy the certificate's common name as a string. This string is used by the TLS and CMS code to check certificate names against an expected name, and also appears in debugging messages. Provide a function x509_check_name() to centralise certificate name checking (in preparation for adding subjectAlternativeName support), and a function x509_name() to provide a name to be used in debugging messages, and remove the dynamically allocated string. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-25[ocsp] Handle OCSP responses that don't provide certificatesAlexander Chernyakhovsky1-2/+7
Certificate authorities are not required to send the certificate used to sign the OCSP response if the response is signed by the original issuer. Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-25[http] Accept Content-Length header with trailing whitespaceMichael Brown1-1/+2
At least one HTTP server (Google's OCSP responder) has been observed to generate a Content-Length header with trailing whitespace. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-21[bios] Fix screen clearing on even more buggy BIOSesMichael Brown1-1/+3
Some BIOSes (observed with a ProLiant DL360p Gen8 SE) perform no range checking whatsoever on the parameters passed to INT10,06 and will therefore happily write to an area beyond the end of video RAM. The area immediately following the video RAM tends to be the VGA BIOS ROM image. Overwriting the VGA BIOS leads to an interesting variety of crashes and reboots. Fix by specifying an exact width and height to be cleared, rather than passing in large values and relying upon the BIOS to truncate them to the appropriate range. Reported-by: Alex Davies <adavies@jumptrading.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-20[realtek] Clear bit 24 of RCRMichael Brown2-2/+3
On an Asus Z87-K motherboard with an onboard 8168 NIC, booting into Windows 7 and then warm rebooting into iPXE results in a broken RX datapath: packets can be transmitted successfully but garbage is received. A cold reboot clears the problem. A dump of the PHY registers reveals only one difference: in the failure case the bits ADVERTISE_PAUSE_CAP and ADVERTISE_PAUSE_ASYM are cleared. Explicitly setting these bits does not fix the problem. A dump of the MAC registers reveals a few differences, of which the most obvious culprit is the undocumented bit 24 of the Receive Configuration Register (RCR), which is set in the failure case. Explicitly clearing this bit does fix the problem. Reported-by: Sebastian Nielsen <ipxe@sebbe.eu> Reported-by: Oliver Rath <rath@mglug.de> Debugged-by: Sebastian Nielsen <ipxe@sebbe.eu> Tested-by: Sebastian Nielsen <ipxe@sebbe.eu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-20[realtek] Add ability to dump all internal registersMichael Brown1-0/+27
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-14[efi] Disable SNP devices when running iPXE as the applicationMichael Brown4-9/+138
Some UEFI builds will set up a timer to continuously poll any SNP devices. This can drain packets from the network device's receive queue before iPXE gets a chance to process them. Use netdev_rx_[un]freeze() to explicitly indicate when we expect our network devices to be driven via the external SNP API (as we do with the UNDI API on the standard BIOS build), and disable the SNP API except when receive queue processing is frozen. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-14[efi] Unload our own image before exiting UEFI applicationMichael Brown1-4/+9
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-14[efi] Avoid accidentally calling main() twiceMichael Brown1-1/+5
EFIRC() uses PLATFORM_TO_ERRNO(), which evaluates its argument twice (and can't trivially use a braced-group expression or an inline function to avoid this, since it gets used outside of function context). The expression "EFIRC(main())" will therefore end up calling main() twice, which is not the intended behaviour. Every other instance of EFIRC() is of the simple form "EFIRC(rc)", so fix by converting this instance to match. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-14[netdevice] Notify upper-layer drivers when RX processing is (un)frozenMichael Brown2-20/+30
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-13[lotest] Allow loopback testing on shared networksMichael Brown1-36/+53
Allow for extraneous packets to be received during loopback testing, and so permit loopback tests to be performed when ports are connected to a switch (rather than requiring ports to be directly connected with a loopback cable). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-13[console] Fix display of characters with top bit setMichael Brown2-2/+2
Inhibit implicit sign-padding of characters with the top bit set (e.g. accented characters), which confuses the mucurses library by colliding with the bits used to store character attributes and colours. Reported-by: Marc Delisle <Marc.Delisle@cegepsherbrooke.qc.ca> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-12[efi] Connect driver to devices as part of installationMichael Brown1-20/+69
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-10[efi] Allow driver to be unloadedMichael Brown5-4/+159
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-10[efi] Allow for 64-bit EFI_STATUS codesMichael Brown1-10/+15
On a 64-bit build, EFI_STATUS codes are 64-bit quantities, with the "error/warning" bit located in bit 63. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-10[image] Add "--timeout" parameter to image downloading commandsMichael Brown8-21/+44
iPXE will detect timeout failures in several situations: network link-up, DHCP, TCP connection attempts, unacknowledged TCP data, etc. This does not cover all possible circumstances. For example, if a connection to a web server is successfully established and the web server acknowledges the HTTP request but never sends any data in response, then no timeout will be triggered. There is no timeout defined within the HTTP specifications, and the underlying TCP connection will not generate a timeout since it has no way to know that the HTTP layer is expecting to receive data from the server. Add a "--timeout" parameter to "imgfetch", "chain", etc. If no progress is made (i.e. no data is downloaded) within the timeout period, then the download will be aborted. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-10[monojob] Reset timeout when progress is madeMichael Brown1-11/+18
Redefine the timeout parameter from "time since start of job" to "time since progress was last made". This does not affect any existing behaviour, since all existing users of the timeout parameter do not provide progress indication. Signed-off-by: Michael Brown <mcb30@ipxe.org>