[SeaBIOS] [PATCH] vbe: fix Set Window return status in linear mode

Daniel Verkamp posted 1 patch 1 month, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/seabios tags/patchew/20260603024626.1419114-1-daniel@drv.nu
vgasrc/vbe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[SeaBIOS] [PATCH] vbe: fix Set Window return status in linear mode
Posted by Daniel Verkamp 1 month, 1 week ago
VBE function 05h (Display Window Control) is not allowed while a linear
framebuffer mode is set. However, the return status code for this case
was not fully filled out: only the AH register was filled out, but AL
was left unchanged from its original function 05h value, resulting in a
status code of 0x0305, whereas the correct status would be 0x034F
(indicating that the function is supported but is invalid in the current
mode).

This may be a result of a too-literal reading of the VBE specification;
when describing the behavior of this function when called in a linear
mode, it says "the function must fail with completion code AH=03h", not
mentioning the value of AL. However, the general "VBE Return Status"
section still applies, which indicates that AL should be set to 4Fh on
return if the function is supported.

Additionally, the patch changes the status code assignment to use a hex
literal instead of a constant, since this is consistent with all of the
other status code assignments in the VBE code.

Signed-off-by: Daniel Verkamp <daniel@drv.nu>
---
 vgasrc/vbe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c
index 2ae0a980..67162d97 100644
--- a/vgasrc/vbe.c
+++ b/vgasrc/vbe.c
@@ -257,7 +257,7 @@ vbe_104f05(struct bregs *regs)
     if (regs->bh > 1 || regs->bl > 1)
         goto fail;
     if (GET_BDA_EXT(vbe_mode) & MF_LINEARFB) {
-        regs->ah = VBE_RETURN_STATUS_INVALID;
+        regs->ax = 0x034f;
         return;
     }
     struct vgamode_s *curmode_g = get_current_mode();
-- 
2.54.0

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] vbe: fix Set Window return status in linear mode
Posted by Kevin O'Connor via SeaBIOS 3 weeks, 4 days ago
On Tue, Jun 02, 2026 at 07:46:26PM -0700, Daniel Verkamp wrote:
> VBE function 05h (Display Window Control) is not allowed while a linear
> framebuffer mode is set. However, the return status code for this case
> was not fully filled out: only the AH register was filled out, but AL
> was left unchanged from its original function 05h value, resulting in a
> status code of 0x0305, whereas the correct status would be 0x034F
> (indicating that the function is supported but is invalid in the current
> mode).
> 
> This may be a result of a too-literal reading of the VBE specification;
> when describing the behavior of this function when called in a linear
> mode, it says "the function must fail with completion code AH=03h", not
> mentioning the value of AL. However, the general "VBE Return Status"
> section still applies, which indicates that AL should be set to 4Fh on
> return if the function is supported.
> 
> Additionally, the patch changes the status code assignment to use a hex
> literal instead of a constant, since this is consistent with all of the
> other status code assignments in the VBE code.

Thanks.  I committed this change.

It would probably be nice to replace these "ax" values with the
VBE_RETURN_XXX definitions, as mentioned in another email.  However, I
agree that would be something to look at separately from this fix.

-Kevin

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