aboutsummaryrefslogtreecommitdiffstats
path: root/src/core
Commit message (Collapse)AuthorAgeFilesLines
* [serial] Add general abstraction of a 16550-compatible UARTMichael Brown2015-06-291-0/+135
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Add "base64" setting typeMichael Brown2015-04-241-0/+41
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [base64] Add buffer size parameter to base64_encode() and base64_decode()Michael Brown2015-04-241-54/+46
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [base16] Add buffer size parameter to base16_encode() and base16_decode()Michael Brown2015-04-242-89/+30
| | | | | | | | | | | | | | The current API for Base16 (and Base64) encoding requires the caller to always provide sufficient buffer space. This prevents the use of the generic encoding/decoding functionality in some situations, such as in formatting the hex setting types. Implement a generic hex_encode() (based on the existing format_hex_setting()), implement base16_encode() and base16_decode() in terms of the more generic hex_encode() and hex_decode(), and update all callers to provide the additional buffer length parameter. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-054-4/+20
| | | | | | | | | | | Relicense files with kind permission from Stefan Hajnoczi <stefanha@redhat.com> alongside the contributors who have already granted such relicensing permission. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [malloc] Rewrite unrelicensable portions of malloc.cMichael Brown2015-03-031-22/+41
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Rewrite unrelicensable portions of settings.cMichael Brown2015-03-031-6/+13
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Use list_first_entry() when unregistering child settingsMichael Brown2015-03-031-2/+2
| | | | | | | | | Unregistering a child settings block can have almost arbitrary effects, due to the call to apply_settings(). Avoid potentially dereferencing a stale pointer by using list_first_entry() rather than list_for_each_entry_safe() to iterate over the list of child settings. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Rewrite unrelicensable portions of ctype.hMichael Brown2015-03-021-3/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-0211-11/+51
| | | | | | | | | | These files cannot be automatically relicensed by util/relicense.pl since they either contain unusual but trivial contributions (such as the addition of __nonnull function attributes), or contain lines dating back to the initial git revision (and so require manual knowledge of the code's origin). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-023-3/+15
| | | | | | | | | | | | | | | Relicence files with kind permission from the following contributors: Alex Williamson <alex.williamson@redhat.com> Eduardo Habkost <ehabkost@redhat.com> Greg Jednaszewski <jednaszewski@gmail.com> H. Peter Anvin <hpa@zytor.com> Marin Hannache <git@mareo.fr> Robin Smidsrød <robin@smidsrod.no> Shao Miller <sha0.miller@gmail.com> Thomas Horsten <thomas@horsten.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-0252-52/+244
| | | | | | | Relicense files for which I am the sole author (as identified by util/relicense.pl). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Rewrite strtoul()Michael Brown2015-02-194-126/+134
| | | | | | | | | | The implementation of strtoul() has a partially unknown provenance. Rewrite this code to avoid potential licensing uncertainty. Since we now use -ffunction-sections, there is no need to place strtoull() in a separate file from strtoul(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ipv4] Rewrite inet_aton()Michael Brown2015-02-191-23/+0
| | | | | | | | | | The implementation of inet_aton() has an unknown provenance. Rewrite this code to avoid potential licensing uncertainty. Also move the code from core/misc.c to its logical home in net/ipv4.c, and add a few extra test cases. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Rewrite string functionsMichael Brown2015-02-161-258/+273
| | | | | | | | | | | | Some of the C library string functions have an unknown provenance. Reimplement all such functions to avoid potential licensing uncertainty. Remove the inline-assembler versions of strlen(), memswap(), and strncmp(); these save a minimal amount of space (around 40 bytes in total) and are not performance-critical. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Remove unused string functionsMichael Brown2015-02-161-188/+0
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Allow command help text URI to be customised via config/branding.hMichael Brown2015-02-111-1/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Move branding information to config/branding.hMichael Brown2015-02-111-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Allow tftp_uri() to construct a URI with a custom portMichael Brown2015-02-061-1/+8
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iobuf] Add iob_split() to split an I/O buffer into portionsMichael Brown2014-12-181-0/+30
| | | | | | | | | | | RNDIS devices may provide multiple packets encapsulated into a single message. Provide an API to allow the RNDIS driver to split an I/O buffer into smaller portions. The current implementation will always copy the underlying data, rather than splitting the buffer in situ. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [malloc] Report caller address as soon as memory corruption is detectedMichael Brown2014-12-151-1/+21
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [malloc] Check integrity of free listMichael Brown2014-12-151-1/+59
| | | | | | | | | | | | | | | | | | Check the integrity of the free memory block list before and after any modifications to the list. We check that certain invariants are preserved: - the list is a well-formed doubly linked list - all blocks are at least MIN_MEMBLOCK_SIZE - no block extends beyond the end of our address space - blocks remain sorted in ascending order of address - no blocks are adjacent (i.e. any adjacent blocks have been merged) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [malloc] Sanity check parameters to alloc_memblock() and free_memblock()Michael Brown2014-12-151-0/+6
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [malloc] Tidy up debug outputMichael Brown2014-12-151-19/+23
| | | | | | Colourise debug output and move per-allocation messages to DBGLVL_EXTRA. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ping] Allow "ping" command output to be inhibitedMichael Brown2014-10-231-3/+5
| | | | | Originally-implemented-by: Cedric Levasseur <cyr-ius@ipocus.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ping] Allow termination after a specified number of packetsMichael Brown2014-10-231-2/+37
| | | | | | | | | | | | | | | | | | | | | | | | | Add the "-c <count>" option to the "ping" command, allowing for automatic termination after a specified number of packets. When a number of packets is specified: - if a serious error (i.e. length mismatch or content mismatch) occurs, then the ping will be immediately terminated with the relevant status code; - if at least one response is received successfully, and all errors are non-serious (i.e. timeouts or out-of-sequence responses), then the ping will be terminated after the final response (or timeout) with a success status; - if no responses are received successfully, then the ping will be terminated after the final timeout with ETIMEDOUT. If no number of packets is specified, then the ping will continue until manually interrupted. Originally-implemented-by: Cedric Levasseur <cyr-ius@ipocus.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ping] Report timed-out pings via the callback functionMichael Brown2014-10-231-1/+12
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Expose build timestamp, build name, and product namesMichael Brown2014-06-242-3/+51
| | | | | | | | Expose the build timestamp (measured in seconds since the Epoch) and the build name (e.g. "rtl8139.rom" or "ipxe.efi"), and provide the product name and product short name in a single centralised location. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [debug] Allow debug message colours to be customised via DBGCOL=...Michael Brown2014-06-161-3/+14
| | | | | | | | | | | | | | | | | | When multiple iPXE binaries are running concurrently (e.g. in the case of undionly.kpxe using an underlying iPXE driver via the UNDI interface) it would be helpful to be able to visually distinguish debug messages from each binary. Allow the range of debug colours used to be customised via the DBGCOL=... build parameter. For example: # Restrict to colours 31-33 (red, green, yellow) make DBGCOL=31-33 # Restrict to colours 34-36 (blue, magenta, cyan) make DBGCOL=34-36 Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Prevent strndup() from reading beyond the end of the stringMichael Brown2014-05-181-3/+1
| | | | | | | | | | | | strndup() may be called on a string which is not NUL-terminated. Use strnlen() instead of strlen() to ensure that we do not read beyond the end of such a string. Add self-tests for strndup(), including a test case with an unterminated string. Originally-fixed-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [profile] Allow interrupts to be excluded from profiling resultsMichael Brown2014-05-041-0/+3
| | | | | | | | | Interrupt processing adds noise to profiling results. Allow interrupts (from within protected mode) to be profiled separately, with time spent within the interrupt handler being excluded from any other profiling currently in progress. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Allow interrupts in protected modeMichael Brown2014-04-291-0/+1
| | | | | | | | When running in a virtual machine, switching to real mode may be expensive. Allow interrupts to be enabled while in protected mode and reflected down to the real-mode interrupt handlers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [downloader] Profile receive datapathMichael Brown2014-04-281-0/+15
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [profile] Add generic profiling infrastructureMichael Brown2014-04-271-0/+269
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Add isqrt() function to find integer square rootsMichael Brown2014-04-261-0/+52
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Add inline assembly implementation of flsl() using BSR instructionMichael Brown2014-04-241-13/+0
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [serial] Enable UART FIFOsPeter Pickford2014-04-221-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>
* [console] Fix display of characters with top bit setMichael Brown2014-03-131-1/+1
| | | | | | | | | | 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>
* [monojob] Reset timeout when progress is madeMichael Brown2014-03-101-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>
* [image] Ensure every image has a fully resolved URIMichael Brown2014-02-271-12/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Refactor URI parsing and formattingMichael Brown2014-02-271-180/+330
| | | | | | | | | | | | | | | | | | | | | | | | Add support for parsing of URIs containing literal IPv6 addresses (e.g. "http://[fe80::69ff:fe50:5845%25net0]/boot.ipxe"). Duplicate URIs by directly copying the relevant fields, rather than by formatting and reparsing a URI string. This relaxes the requirements on the URI formatting code and allows it to focus on generating human-readable URIs (e.g. by not escaping ':' characters within literal IPv6 addresses). As a side-effect, this allows relative URIs containing parameter lists (e.g. "../boot.php##params") to function as expected. Add validity check for FTP paths to ensure that only printable characters are accepted (since FTP is a human-readable line-based protocol with no support for character escaping). Construct TFTP next-server+filename URIs directly, rather than parsing a constructed "tftp://..." string, Add self-tests for URI functions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [params] Use reference counters for form parameter listsMichael Brown2014-02-262-45/+33
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Remove "uristring" setting typeMichael Brown2014-02-261-49/+5
| | | | | | | | | | | | | | Commit b5f5f73 ("[cmdline] Expand settings within each command-line token individually") effectively rendered the "uristring" setting type obsolete, since strings containing whitespace no longer break the command line parser. The concept of the "uristring" type is not well defined, since URI escaping rules depend on which portion of a URI is being escaped. Remove the "uristring" type, converting it into an alias for the "string" setting type so as to avoid breaking existing scripts. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [fbcon] Allow ANSI CUP with missing argumentsMichael Brown2014-01-221-2/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [fbcon] Allow for an arbitrary margin around the text areaMichael Brown2014-01-221-12/+27
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [fbcon] Centre background picture on consoleMichael Brown2014-01-221-243/+116
| | | | | | | | | | | | | | | | | | | | | | | Centre the background picture on the console, to give a more consistent result when the aspect ratio does not match the requested width and height. Once drawn for the first time, nothing should ever overwrite the margins of the display. We can therefore eliminate the logic used to redraw only the margin areas, and use much simpler code to draw the complete initial background image. Simplify the redrawing logic further by making the background picture buffer equal in size to the frame buffer. In the common case of a background picture which is designed to fill the screen, this wastes no extra memory, and the combined code simplifications reduce the size of fbcon.o by approximately 15%. Redefine the concept of "margin" to match the intuitive definition (i.e. the size of the gap, rather than the position of the boundary line). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Add isprint()Michael Brown2014-01-061-3/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Add concept of a "magic" colourMichael Brown2013-12-091-4/+34
| | | | | | | | The magic basic colour can be remapped at runtime from COLOR_NORMAL_BG (usually blue) to COLOR_DEFAULT (which will be transparent as a background colour on the framebuffer console). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Add centralised concept of colours and colour pairsMichael Brown2013-12-092-0/+283
| | | | | | | | | | | | | Add a centralised concept of colours and colour pairs (using the default colour pairs as configured via config/colour.h). A colour pair consists of a pair of colour indices. Add the ability to redefine both a colour pair and an individual colour index, with minimal overhead if this feature is not required (e.g. because the relevant shell commands are not present in the build). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [fbcon] Always draw cursor using current foreground and background coloursMichael Brown2013-12-091-5/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>