[SeaBIOS] vgabios testing

Kevin O'Connor kevin at koconnor.net
Mon Mar 5 23:20:41 CET 2012


On Mon, Mar 05, 2012 at 08:10:41AM +0100, Gerd Hoffmann wrote:
> On 03/04/12 20:06, Kevin O'Connor wrote:
> > On Fri, Mar 02, 2012 at 10:09:10AM +0100, Gerd Hoffmann wrote:
> >> Did some more testing of the vgabios today, two issues popped up:
> >>
> >>   (1) screen isn't cleared in some cases.  Visible with grub1 in text
> >>       mode.  When it displays the menu a few stray chars are visible.
> >>       Even more obvious it becomes when hitting 'c' then to get a
> >>       prompt, then alot of the menu is still visible.
> > 
> > Thanks.  Can you point me to an image and/or the steps to reproduce?
> > I've tracked down a few of these before, and I'm sure I can fix it if
> > I can reproduce it.
> 
> Install fedora 15 (or older) in qemu (mimimal is enougth).  Edit
> /boot/grub/menu.lst and comment out the splashimage and hiddenmenu
> lines.  On next reboot grub will come up in text mode and you'll see the
> behavior described above.

I couldn't reproduce the issue on the initial screen, but I can
reproduce when hitting the 'c' key.  Turns out to be an integer
overflow issue - patch below.

-Kevin


>From c823759f201db6cea5a5f13fb7b5bec1cc47c114 Mon Sep 17 00:00:00 2001
From: Kevin O'Connor <kevin at koconnor.net>
Date: Mon, 5 Mar 2012 17:11:50 -0500
Subject: [PATCH] vgabios: int1009 handler bug limits count to 256 characters.
To: seabios at seabios.org

Fix bug (u8 overflow) causing large screen fills to fail.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 vgasrc/vgabios.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c
index 58e467d..faf57b1 100644
--- a/vgasrc/vgabios.c
+++ b/vgasrc/vgabios.c
@@ -510,10 +510,15 @@ handle_1008(struct bregs *regs)
 static void noinline
 write_chars(u8 page, struct carattr ca, u16 count)
 {
+    u16 nbcols = GET_BDA(video_cols);
     struct cursorpos cp = get_cursor_pos(page);
     while (count--) {
         vgafb_write_char(cp, ca);
         cp.x++;
+        if (cp.x >= nbcols) {
+            cp.x -= nbcols;
+            cp.y++;
+        }
     }
 }
 
-- 
1.7.6.5




More information about the SeaBIOS mailing list