david/ipxe
david
/
ipxe
Archived
1
0
Fork 0
Commit Graph

51 Commits

Author SHA1 Message Date
Michael Brown c3b4860ce3 [legal] Update FSF mailing address in GPL licence texts
Suggested-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-20 19:55:45 +01:00
Michael Brown 9e8d431a0d [romprefix] Add a dummy ROM header to cover the .mrom payload
The header of a .mrom image declares its length to be only a few
kilobytes; the remainder is accessed via a sideband mechanism.  This
makes it difficult to append an additional ROM image, such as an EFI
ROM.

Add a second, dummy ROM header covering the payload portion of the
.mrom image, allowing consumers to locate any appended ROM images in
the usual way.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-12 15:15:03 +01:00
Till Straumann d3630b6a64 [prefix] Fix missing underscore in libprefix
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-02-10 14:12:04 +00:00
Michael Brown 24226472b2 [prefix] Allow prefix to specify an arbitrary maximum address for relocation
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-11-11 23:20:52 +00:00
Michael Brown 6c5f1a342b [prefix] Use stack rather than %ebp as temporary storage area
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-11-11 22:24:00 +00:00
Michael Brown 5924e65cea [prefix] Avoid using base memory for temporary decompression area
In the unlikely (but observable) event that INT 15,88 returns less
memory above 1MB than is required for the temporary decompression
area, ignore it and use the 1MB point anyway.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-28 01:00:59 +01:00
Michael Brown 90563f69be [prefix] Set the "size" bit in the GDT entry for the flat data segment
The "size" bit (aka the D/B) bit should (as far as I can tell) be
irrelevant for accesses to a non-code, non-stack, expand-upwards
segment.  However, VirtualBox fails on some accesses via this segment
if this bit is not set.

This change allows iPXE to boot under VirtualBox without having to
disable VT-x/AMD-V support.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-01 16:09:09 +00:00
Michael Brown 17ef28414f [prefix] Add rudimentary debugging messages to libprefix
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-01 14:49:25 +00:00
Michael Brown 7f2d0f12ad [libflat] Remove now-obsolete flatten_real_mode call
Flat real mode will have been set up as a side-effect of the
protected-mode call invoked during install_block() for .text16.early;
there is no need to do so explicitly.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-26 23:28:45 +00:00
Michael Brown a84e15234a [prefix] Use 16-bit protected mode for access to high memory
Flat real mode works perfectly on real hardware, but seems to cause
problems for some hypervisors.  Revert to using 16-bit protected mode
(and returning to real mode with 4GB limits, so as not to break PMM
BIOSes).

Allow the code specific to the .mrom format to continue to assume that
flat real mode works, since this format is specific to real hardware.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-26 23:24:44 +00:00
Michael Brown 132c391712 [romprefix] Add .mrom format, allowing loading of large ROMs
Add an infrastructure allowing the prefix to provide an open_payload()
method for obtaining out-of-band access to the whole iPXE image.  Add
a mechanism within this infrastructure that allows raw access to the
expansion ROM BAR by temporarily borrowing an address from a suitable
memory BAR on the same PCI card.

For cards that have a memory BAR that is at least as large as their
expansion ROM BAR, this allows large iPXE ROMs to be supported even on
systems where PMM fails, or where option ROM space pressure makes it
impossible to use PMM shrinking.  The BIOS sees only a stub ROM of
approximately 3kB in size; the remainder (which can be well over 64kB)
is loaded only at the time iPXE is invoked.

As a nice side-effect, an iPXE .mrom image will continue to work even
if its PMM-allocated areas are overwritten between initialisation and
invocation.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-25 16:37:06 +01:00
Michael Brown 5a5d8dd10a [romprefix] Inhibit the use of relocation during POST
It is common for system memory maps to be grotesquely unreliable
during POST.  Many sanity checks have been added to the memory map
reading code, but these do not catch all problems.

Skip relocation entirely if called during POST.  This should avoid the
problems typically encountered, at the cost of slightly disrupting the
memory map of an operating system booted via iPXE when iPXE was
entered during POST.  Since this is a very rare special case (used,
for example, when reflashing an experimental ROM that would otherwise
prevent the system from completing POST), this is an acceptable cost.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-25 01:50:46 +01:00
Michael Brown f0ae1d58e8 [prefix] Use area at top of INT 15,88 memory map for temporary decompression
Use INT 15,88 to find a suitable temporary decompression area, rather
than a fixed address.  This hopefully gives us a better chance of not
treading on any PMM-allocated areas, in BIOSes where PMM support
exists but tends not to give us the large blocks that we ask for.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-25 01:50:46 +01:00
Michael Brown 92c3202ab1 [prefix] Default to 1MB mark as fallback high memory load point
Now that we can use odd megabytes, there is no particular need to use
an even megabyte as the fallback temporary load point.

Note that the old warnings about avoiding 2MB pre-date our ability to
cooperate with other PXE ROMs by using PMM.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-20 21:00:49 +01:00
Michael Brown 24b52ae476 [prefix] Add A20-enabling code in libflat
iPXE currently insists on residing in an even megabyte.  This imposes
undesirably severe constraints upon our PMM allocation strategy, and
limits our options for mechanisms to access ROMs greater than 64kB in
size.

Add A20 handling code to libflat so that prefixes are able to access
memory even in odd megabytes.

The algorithms and tuning parameters in the new A20 handling code are
based upon a mixture of the existing iPXE A20 code and the A20 code
from the 2.6.32 Linux kernel.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-20 21:00:42 +01:00
Michael Brown fb754ced56 [prefix] Move flatten_real_mode to libflat.S
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-20 14:23:55 +01:00
Michael Brown d931d4bd9c [prefix] Move flatten_real_mode to .text16.early
The flatten_real_mode routine is not needed until after decompressing
.text16.early, and currently performs various contortions to
compensate for the fact that .prefix may not be writable.  Move
flatten_real_mode to .text16.early to save on (compressed) binary size
and simplify the code.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-20 13:04:24 +01:00
Michael Brown 9068249e24 [prefix] Add .text16.early section
Add a section .text16.early which is always kept inline with the
prefix.  This will allow for some code sharing between the .prefix and
.text16 sections.

Note that the simple solution of just prepending the .prefix section
to the .text16 section will not work, because a bug in Wyse Streaming
Manager server (WLDRM13.BIN) requires us to place a dummy PXENV+ entry
point at the start of .text16.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-20 12:56:28 +01:00
Michael Brown 6c35a525da [prefix] Use flat real mode for access to high memory
Use flat real mode rather than 16-bit protected mode for access to
high memory during installation.  This simplifies the code by reducing
the number of CPU modes we need to think about, and also increases the
amount of code in common between the normal and (somewhat
hypothetical) KEEP_IT_REAL methods of operation.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-20 11:05:47 +01:00
Michael Brown cb43056809 [prefix] Use flat real mode instead of real mode
When returning to real mode, set 4GB segment limits instead of 64kB
limits.  This change improves our chances of successfully returning to
a PMM-capable BIOS aftering entering iPXE during POST; the BIOS will
have set up flat real mode before calling our initialisation point,
and may be disconcerted if we then return in genuine real mode.

This change is unlikely to break anything, since any code that might
potentially access beyond 64kB must use addr32 prefixes to do so; if
this is the case then it is almost certainly code written to expect
flat real mode anyway.

Note that it is not possible to restore the real-mode segment limits
to their original values, since it is not possible 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>
2010-04-19 23:43:48 +01:00
Michael Brown c44a193d0d [legal] Add a selection of FILE_LICENCE declarations
Add FILE_LICENCE declarations to almost all files that make up the
various standard builds of gPXE.
2009-05-18 08:33:25 +01:00
Michael Brown 7bc4093e1a [build] Cope with oddities in the Fedora 10 assembler
The version of the GNU assembler shipped with Fedora 10
(2.18.50.0.9-8.fc10) complains about character literals in some of our
assembly code.  Changing $'x' to $( 'x' ) seems to fix the problem.
Yes, the whitespace is required; using just $('x') does not work.

Reported by Kevin O'Connor <kevin@koconnor.net>.
2009-02-16 03:53:25 +00:00
Michael Brown c9e5b12473 [i386] Add explicit flags and type on all .section declarations
Try to avoid future problems caused by implicit section flags and/or
type information by instituting a policy that all .section
declarations must explicitly state the flags and type.

Most of this change was achieved using

    perl -pi \
      -e 's/".text"$/".text", "ax", \@progbits/ ; ' \
      -e 's/".text16"$/".text16", "ax", \@progbits/ ; ' \
      -e 's/".text16.null"$/".text16.null", "ax", \@progbits/ ; ' \
      -e 's/".text16.data"$/".text16.data", "aw", \@progbits/ ; ' \
      -e 's/".data"$/".data", "aw", \@progbits/ ; ' \
      -e 's/".data16"$/".data16", "aw", \@progbits/ ; ' \
      -e 's/".bss"$/".bss", "aw", \@nobits/ ; ' \
      -e 's/".bss16"$/".bss16", "aw", \@nobits/ ; ' \
      -e 's/".prefix"$/".prefix", "ax", \@progbits/ ; ' \
      -e 's/".prefix.lib"$/".prefix.lib", "awx", \@progbits/ ; ' \
      -e 's/".prefix.data"$/".prefix.data", "aw", \@progbits/ ; ' \
      -e 's/".weak"$/".weak", "a", \@nobits/ ; ' \
      `git grep -l '\.section'`
2009-02-15 10:59:53 +00:00
Michael Brown 0a8a17e669 [i386] Free allocated base memory on exit, if possible
Code paths that automatically allocate memory from the FBMS at 40:13
should also free it, if possible.

Freeing this memory will not be possible if either

  1. The FBMS has been modified since our allocation, or

  2. We have not been able to unhook one or more BIOS interrupt vectors.
2008-11-18 19:43:13 +00:00
Michael Brown 29e6f9835e [i386] Add data32 prefixes to all lgdt/lidt instructions
With a 16-bit operand, lgdt/lidt will load only a 24-bit base address,
ignoring the high-order bits.  This meant that we could fail to fully
restore the GDT across a call into gPXE, if the GDT happened to be
located above the 16MB mark.

Not all of our lgdt/lidt instructions require a data32 prefix (for
example, reloading the real-mode IDT can never require a 32-bit base
address), but by adding them everywhere we will hopefully not forget
the necessary ones in future.
2008-11-07 03:48:25 +00:00
Michael Brown 5e6b82104d [romprefix] Add vendor branding facilities and guidelines
Some hardware vendors have been known to remove all gPXE-related
branding from ROMs that they build.  While this is not prohibited by
the GPL, it is a little impolite.

Add a facility for adding branding messages via two #defines
(PRODUCT_NAME and PRODUCT_SHORT_NAME) in config/general.h.  This
should accommodate all known OEM-mandated branding requirements.
Vendors with branding requirements that cannot be satisfied by using
PRODUCT_NAME and/or PRODUCT_SHORT_NAME should contact us so that we
can extended this facility as necessary.
2008-10-31 19:10:28 +00:00
Michael Brown 04f3206581 [build] Fix building on Ubuntu 8.04
Not fully understood, but it seems that the LMA of bss sections matters
for some newer binutils builds.  Force all bss sections to have an LMA
at the end of the file, so that they don't interfere with other
sections.

The symptom was that objcopy -O binary -j .zinfo would extract the
.zinfo section from bin/xxx.tmp as a blob of the correct length, but
with zero contents.  This would then cause the [ZBIN] stage of the
build to fail.

Also explicitly state that .zinfo(.*) sections have @progbits, in case
some future assembler or linker variant decides to omit them.
2008-10-17 01:55:58 +01:00
Michael Brown 13d09e6719 [i386] Simplify linker script and standardise linker-defined symbol names
Reduce the number of sections within the linker script to match the
number of practical sections within the output file.

Define _section, _msection, _esection, _section_filesz, _section_memsz,
and _section_lma for each section, replacing the mixture of symbols that
previously existed.

In particular, replace _text and _end with _textdata and _etextdata, to
make it explicit within code that uses these symbols that the .text and
.data sections are always treated as a single contiguous block.
2008-10-10 03:59:57 +01:00
Eygene Ryabinkin 99251f5b32 [libprefix] Add addr32 prefix required by older assemblers
Explicitly state that we are using 32-bit addressing in 16-bit code.

GNU as 2.15 (FreeBSD/amd64 7-STABLE) got confused that 32-bit registers
are used in the code that was declared as 16-bit.  Add explicit modifier
'addr32' to make assembler happy.

Signed-off-by: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
2008-09-04 11:27:20 +01:00
Michael Brown fd0aef9ee1 [prefix] Add PCI bus:dev.fn to ROM product string
This allows multiple gPXE ROMs in a system to be disambiguated at boot
time; the PCI ID will show up in the boot menu for a BBS-compliant BIOS.
2008-05-21 18:43:58 +01:00
Michael Brown 3bf7105cab [prefix] Cope with image source addresses outside base memory
When PMM is used, the gPXE image source will no longer be in base memory.
Decompression of .text16 and .data16 can therefore no longer be done in
real mode.
2008-03-11 13:26:46 +00:00
Michael Brown 297002d7bd [prefix] Add printing functions to libprefix.S
Move the printing functions from pxeprefix.S into libprefix.S, so they
are available for debug from any prefix.
2008-03-11 11:32:19 +00:00
Michael Brown 12f203c606 [PXE] Add PMM support to romprefix.S (untested)
ROM initialisation vector now attempts to allocate a 2MB block using
PMM.  If successful, it copies the ROM image to this block, then
shrinks the ROM image to allow for more option ROMs.  If unsuccessful,
it leaves the ROM as-is.

ROM BEV now attempts to return to the BIOS, resorting to INT 18 only
if the BIOS stack has been corrupted.
2008-03-09 22:13:07 +00:00
Michael Brown b8a8eea850 Minor refactoring to eliminate duplication. 2007-09-25 19:06:38 +01:00
Michael Brown dec325fe43 Use full protected mode for access to high memory within prefix, to
work around limitations in real-mode virtualisation support on Intel
VT-capable chips.
2007-09-25 18:01:15 +01:00
Michael Brown 2cfe0dee1f Don't trash the %ecx value returned by relocate(). This was causing
us to round down the size for the relocation copy to the nearest 64kB
(+0x10 bytes); this just happened to work on most machines because the
last 64kB of the image is all-zeroes anyway (it's the .bss).
2007-07-19 16:07:31 +01:00
Michael Brown c94cdf2b7d Move .zinfo to libprefix.S; it doesn't belong with the decompression code. 2007-07-17 12:52:54 +01:00
Michael Brown 048bbeeebc Compressed ROM images now work. 2007-07-16 16:58:38 +01:00
Michael Brown ab859a5355 Use a single _payload_offset linker-defined variable to locate the
start of the non-prefix blocks in the loaded image, and rely on the
image ordering.  This should make introducing compression much easier.
2007-07-15 02:52:02 +01:00
Michael Brown dca369ddc3 Call hide_etherboot() from startup(), rather than requiring the prefix to
do it.
2007-01-14 00:53:56 +00:00
Michael Brown 86171c53f4 Damn Broadcom and their damned incorrect assumptions about x86 memory
allocation.
2007-01-13 01:48:12 +00:00
Michael Brown 6abfaa153b Towards making KEEP_IT_REAL work again.
Fix bug that caused over-allocation of .text16 and .data16 memory areas
by a factor of 16.
2006-08-24 13:18:05 +00:00
Michael Brown e7eca7b7cb Code segment may not be writable; create the temporary pointer to the GDT
on the stack.
2006-06-06 15:30:28 +00:00
Michael Brown 041a04335e Fixed assembly on old versions of gas 2006-05-28 14:21:29 +00:00
Michael Brown 89da833c5d init_librm() and prot_call() are now real-mode far calls.
install() now calls relocate(), moves the protected-mode code to the new
location, and calls hide_etherboot().
2006-05-25 00:06:45 +00:00
Michael Brown 832807726a Add infrastructure to support access to .data16 (and .text16) variables
from protected-mode code.

Set up %ds to point to .data16 in prot_to_real, so that code specified
via REAL_EXEC() and friends can access variables in .data16.

Move most real-mode librm variables from .text16 to .data16.
2006-05-04 23:14:06 +00:00
Michael Brown cc23057b59 Typo 2006-05-02 21:09:29 +00:00
Michael Brown 10c28a51bd Create two easy-to-use entry points in libprefix: install and
install_prealloc.  I *think* these will suffice for all the 16-bit
prefixes.
2006-05-02 20:51:07 +00:00
Michael Brown 5463169c1a Verified as working 2006-05-02 14:04:21 +00:00
Michael Brown d081d65d48 This should be much more elegant: we use flat real mode for the
highmem data, so decompress16 will be able to unpack blocks bigger
than 64kB.
2006-05-01 22:35:19 +00:00