[SeaBIOS] Re: an issue with win10 boot and different compiler versions

Kevin O'Connor posted 1 patch 2 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/seabios tags/patchew/ZdUAfhd._5FlKvlRUDX@morn
[SeaBIOS] Re: an issue with win10 boot and different compiler versions
Posted by Kevin O'Connor 2 months, 1 week ago
On Sat, Feb 10, 2024 at 11:17:54PM +0300, Michael Tokarev wrote:
> So.. the difference is vgabios only, not seabios (vgabios-stdvga in this case).
> 
> And I can't get it to work with debugging vgabios, it always fails even with DEBUG_LEVEL=2
> (and level-1 logging isn't useful).
> 
> I was able to capture logs just for the non-working version, so there's nothing to
> compare it against.  So I tried a different machine type in qemu, the one which
> works, which uses SMBIOS 3.0 (q35-8.2).

Thanks for testing.  So, if I understand the issue correctly:
1. If smbios v3 is used then the problem does not occur.
2. If gcc v13 is used to compile vgabios then the problem does not occur.
3. If smbios v2 is used and gcc v12 is used then win10 can not boot.
Is that correct?

A strange issue.  Issues like this tend to be very difficult to track
down.

As a random guess, one possibility is that it could be related to
vgabios stack size usage.  You could try always enabling the "extra
vga stack" with a change like:

--- a/vgasrc/vgabios.c
+++ b/vgasrc/vgabios.c
@@ -285,8 +285,7 @@ vga_set_mode(int mode, int flags)
         // Disable extra stack if it appears a modern OS is in use.
         // This works around bugs in some versions of Windows (Vista
         // and possibly later) when the stack is in the e-segment.
-        MASK_BDA_EXT(flags, BF_EXTRA_STACK
-                     , (flags & MF_LEGACY) ? BF_EXTRA_STACK : 0);
+        MASK_BDA_EXT(flags, BF_EXTRA_STACK, BF_EXTRA_STACK);
     if (memmodel == MM_TEXT) {
         SET_BDA(video_cols, width);
         SET_BDA(video_rows, height-1);

Separately, if you can provide the failing and succeeding builds, I
can try to take a look at it locally.  To do this, make sure you're on
commit 82faf1d5, run make, run "tar cfz fullbuild.tgz out/", and
provide the resulting tgz file.

-Kevin
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: an issue with win10 boot and different compiler versions
Posted by Igor Mammedov 2 months, 1 week ago
On Tue, 20 Feb 2024 14:41:50 -0500
Kevin O'Connor <kevin@koconnor.net> wrote:

> On Sat, Feb 10, 2024 at 11:17:54PM +0300, Michael Tokarev wrote:
> > So.. the difference is vgabios only, not seabios (vgabios-stdvga in this case).
> > 
> > And I can't get it to work with debugging vgabios, it always fails even with DEBUG_LEVEL=2
> > (and level-1 logging isn't useful).
> > 
> > I was able to capture logs just for the non-working version, so there's nothing to
> > compare it against.  So I tried a different machine type in qemu, the one which
> > works, which uses SMBIOS 3.0 (q35-8.2).  
> 
> Thanks for testing.  So, if I understand the issue correctly:
> 1. If smbios v3 is used then the problem does not occur.

one thing to note is that Windows isn't able to find SMBIOS v3 tables
due to bug in anchor lookup within winload.exe. So essentially v3 tables
mean that Windows doesn't access SMBIOS at all, while with v2 it's actually
using SMBIOS tables.   

> 2. If gcc v13 is used to compile vgabios then the problem does not occur.
> 3. If smbios v2 is used and gcc v12 is used then win10 can not boot.
> Is that correct?
> 
> A strange issue.  Issues like this tend to be very difficult to track
> down.
> 
> As a random guess, one possibility is that it could be related to
> vgabios stack size usage.  You could try always enabling the "extra
> vga stack" with a change like:
> 
> --- a/vgasrc/vgabios.c
> +++ b/vgasrc/vgabios.c
> @@ -285,8 +285,7 @@ vga_set_mode(int mode, int flags)
>          // Disable extra stack if it appears a modern OS is in use.
>          // This works around bugs in some versions of Windows (Vista
>          // and possibly later) when the stack is in the e-segment.
> -        MASK_BDA_EXT(flags, BF_EXTRA_STACK
> -                     , (flags & MF_LEGACY) ? BF_EXTRA_STACK : 0);
> +        MASK_BDA_EXT(flags, BF_EXTRA_STACK, BF_EXTRA_STACK);
>      if (memmodel == MM_TEXT) {
>          SET_BDA(video_cols, width);
>          SET_BDA(video_rows, height-1);
> 
> Separately, if you can provide the failing and succeeding builds, I
> can try to take a look at it locally.  To do this, make sure you're on
> commit 82faf1d5, run make, run "tar cfz fullbuild.tgz out/", and
> provide the resulting tgz file.
> 
> -Kevin
> _______________________________________________
> SeaBIOS mailing list -- seabios@seabios.org
> To unsubscribe send an email to seabios-leave@seabios.org
> 

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org