[SeaBIOS] [PATCH 08/15] Fix finding VESA mode

Christian Gmeiner christian.gmeiner at gmail.com
Sat Sep 1 17:12:59 CEST 2012


With the current code the following happens:

VBE mode info request: 4101
VBE mode 4101 not found
get_mode failed.

Looking at the provided mode (cx register) only bits 8-0
define the video mode number. I am not sure if the current
code ever worked.

Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 vgasrc/vbe.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c
index 227a244..af72324 100644
--- a/vgasrc/vbe.c
+++ b/vgasrc/vbe.c
@@ -72,9 +72,24 @@ vbe_104f01(struct bregs *regs)
     struct vbe_mode_info *info = (void*)(regs->di+0);
     u16 mode = regs->cx;
 
+    /*
+     * Bitfields for VESA/VBE video mode number:
+     *
+     * Bit(s)  Description     (Table 04082)
+     * 15     preserve display memory on mode change
+     * 14     (VBE v2.0+) use linear (flat) frame buffer
+     * 13     (VBE/AF 1.0P) VBE/AF initializes accelerator hardware
+     * 12     reserved for VBE/AF
+     * 11     (VBE v3.0) user user-specified CRTC refresh rate values
+     * 10-9   reserved for future expansion
+     * 8-0    video mode number (0xxh are non-VESA modes, 1xxh are VESA-defined)
+     *
+     * see http://www.ctyme.com/intr/rb-0274.htm
+     */
+
     dprintf(1, "VBE mode info request: %x\n", mode);
 
-    struct vgamode_s *vmode_g = vgahw_find_mode(mode);
+    struct vgamode_s *vmode_g = vgahw_find_mode(mode & 0x1FF);
     if (! vmode_g) {
         dprintf(1, "VBE mode %x not found\n", mode);
         regs->ax = 0x014f;
-- 
1.7.11.rc2.5.g68f532f




More information about the SeaBIOS mailing list