freebsd-nq/sys/boot/i386
John Baldwin 2cf997a261 Fix some more issues with the real mode BTX.
The old BTX passed the general purpose registers from the 32-bit client to
the routines called via virtual 86 mode.  The new BTX did the same thing.
However, it turns out that some instructions behave differently in virtual 86
mode and real mode (even though this is under-documented).  For example, the
LEAVE instruction will cause an exception in real mode if any of the upper
16-bits of %ebp are non-zero after it executes.  In virtual 8086 mode the
upper 16-bits are simply ignored.  This could cause faults in hardware
interrupt handlers that inherited an %ebp larger than 0xffff from the 32-bit
client (loader, boot2, etc.) while running in real mode.

To fix, when executing hardware interrupt handlers provide an explicit clean
state where all the general purpose and segment registers are zero upon
entry to the interrupt handler.  While here, I attempted to simplify the
control flow in the 'intusr' code that sets up the various stack frames
and exits protected mode to invoke the requested routine via real mode.

A huge thanks to Tor Egge (tegge@) for debugging this issue.

Submitted by:	tegge
Reviewed by:	tegge
Tested by:	bz
MFC after:	1 week
2009-02-24 23:11:15 +00:00
..
boot0 A number of small changes to make the 'save choice to disk' safer, 2008-12-30 09:40:50 +00:00
boot0ext
boot0sio
boot2 - Initialize the vm86 structure to a known-good state. Specifically, always 2008-08-08 19:41:20 +00:00
btx Fix some more issues with the real mode BTX. 2009-02-24 23:11:15 +00:00
cdboot Fix some "in in" typos in comments. 2008-03-26 07:32:08 +00:00
gptboot - Initialize the vm86 structure to a known-good state. Specifically, always 2008-08-08 19:41:20 +00:00
gptzfsboot Use full 64bit arithmetic when converting file offsets to block numbers - fixes 2008-12-17 18:12:01 +00:00
kgzldr NOSHARED -> NO_SHARED 2004-12-21 09:59:45 +00:00
libfirewire MFp4: add FireWire/dcons support in loader for i386/amd64. 2007-05-29 14:35:57 +00:00
libi386 Allow VIA Nano processors to boot FreeBSD/amd64. 2009-01-12 16:28:19 +00:00
loader Fix build when WITH_SSP is set explicitly. 2009-02-21 15:04:31 +00:00
mbr
pmbr Add a note to indicate that these files do borrow in part from mbr.s and 2007-11-26 21:29:59 +00:00
pxeldr - Remove superfluous comment 2009-01-30 15:27:04 +00:00
zfsboot Use full 64bit arithmetic when converting file offsets to block numbers - fixes 2008-12-17 18:12:01 +00:00
Makefile Fix amd64 build and re-enable gptzfsboot. 2008-11-22 14:24:55 +00:00
Makefile.inc Enable GCC stack protection (aka Propolice) for userland: 2008-06-25 21:33:28 +00:00