On Tuesday 24 February 2009 6:11:15 pm John Baldwin
wrote:> Author: jhb
> Date: Tue Feb 24 23:11:15 2009
> New Revision: 189017
> URL: http://svn.freebsd.org/changeset/base/189017
>
> Log:
> 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
This has been confirmed to fix at least some of the boot hangs reported with
the BTX changes in 6.4 and 7.1. If you had problems with the new boot code
in 6.4 or 7.1 this fix is probably worth trying out.
--
John Baldwin