[SeaBIOS] varlow/extrastack vs code

Kevin O'Connor kevin at koconnor.net
Wed Feb 15 17:33:28 CET 2017


On Wed, Feb 15, 2017 at 11:07:05AM +0000, Dr. David Alan Gilbert wrote:
> In the principal of removing our quirks, the following seems to work for me,
> Kevin, do you agree it's the right behaviour?

I ran some quick tests with your patch and I can confirm it fixes the
first problem.  However, looking at the wikipedia article on old 286
mode switches:
  https://en.wikipedia.org/wiki/Protected_mode#Entering_and_exiting_protected_mode
it appears a triple fault was a common way of mode switching.  I
confirmed your patch would break that in SeaBIOS.

So your patch may be the "right" thing to do, but it would be a lot
more work and would have higher risk.  (If it is the right thing to
do, seabios would then have to detect the ancient mode switch
condition and then return the pam registers back to their prior state
all without touching any ram (ie, no stack).)

Were you able to confirm the SeaBIOS patch I sent out earlier (see
below) passes your tests?

-Kevin


--- a/src/fw/shadow.c
+++ b/src/fw/shadow.c
@@ -187,4 +187,8 @@ qemu_prep_reset(void)
     memcpy(hrp + 4, hrp + 4 + BIOS_SRC_OFFSET, cend - (hrp + 4));
     barrier();
     HaveRunPost = 0;
+    barrier();
+
+    // Force QEMU reboot
+    asm volatile("int3");
 }



More information about the SeaBIOS mailing list