PATCH: vga console tweak

"Jordan Crouse" <[email protected]>
Newsgroups gmane.linux.fbdev.user
Message-ID <[email protected]>
The attached patch puts a hard 32k ceiling on copies to and from
the VGA VRAM space.

This bug was discovered with a 1920x1440 framebuffer console - before
switching from VGA, the console is expanded to 240 cols x 90 rows, equaling
a screenbuf_size of 43200 bytes.  Since the VGA VRAM space is only 32k bytes
big, calling vgacon_save_screen during the console transfer copied in a good
chunk of the video BIOS living at 0xc0000 too, resulting in some very purty
colors and characters at the bottom of the new console.

-- 
Jordan Crouse
Senior Linux Engineer
AMD - Personal Connectivity Solutions Group
<www.amd.com/embeddedprocessors>
vgacon.patch (text/plain, 1.2 KB)
This patch imposes a hard 32k ceiling when copying to and from vga_vram_base.
This keeps us from copying out of Video BIOS space when transforming into very
large framebuffer consoles.

Signed-off-by: John Zulauf ([email protected])

--- linux-2.6.11.orig/drivers/video/console/vgacon.c	2005-03-02 00:38:08.000000000 -0700
+++ linux-2.6.11/drivers/video/console/vgacon.c	2005-05-12 16:40:18.000000000 -0600
@@ -502,9 +502,12 @@
 	 */
 	vga_video_num_columns = c->vc_cols;
 	vga_video_num_lines = c->vc_rows;
+
+	/* We can only copy out 32k here, otherwise we get into VGA BIOS */
+
 	if (!vga_is_gfx)
 		scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf,
-			    c->vc_screenbuf_size);
+			    c->vc_screenbuf_size > 0x8000 ? 0x8000 : c->vc_screenbuf_size);
 	return 0;		/* Redrawing not needed */
 }
 
@@ -1010,9 +1013,12 @@
 		c->vc_x = ORIG_X;
 		c->vc_y = ORIG_Y;
 	}
+	
+	/* We can't copy in more then 32k, or we'll be copying in VGA BIOS */
+
 	if (!vga_is_gfx)
 		scr_memcpyw((u16 *) c->vc_screenbuf, (u16 *) c->vc_origin,
-			    c->vc_screenbuf_size);
+			    c->vc_screenbuf_size > 0x8000 ? 0x8000 : c->vc_screenbuf_size);
 }
 
 static int vgacon_scroll(struct vc_data *c, int t, int b, int dir,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.