Bug 84836 - Fatal trap on 6.0-BETA2 when use SC_PIXEL_MODE, SHED_ULE, VESA_800x600
Summary: Fatal trap on 6.0-BETA2 when use SC_PIXEL_MODE, SHED_ULE, VESA_800x600
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 6.0-BETA2
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-12 09:50 UTC by Andrey V. Elsukov
Modified: 2005-09-02 18:39 UTC (History)
0 users

See Also:


Attachments
out.txt (4.12 KB, text/plain)
2005-08-12 09:50 UTC, Andrey V. Elsukov
no flags Details
scvidctl.c.diff (350 bytes, patch)
2005-08-19 04:59 UTC, Andrey V. Elsukov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey V. Elsukov 2005-08-12 09:50:20 UTC
I have custom kernel:
---------------------------------
-cpu            I486_CPU
-cpu            I586_CPU
 cpu            I686_CPU
-ident          GENERIC
+ident          TEST

-#options       SCHED_ULE               # ULE scheduler
-options        SCHED_4BSD              # 4BSD scheduler
+options        SCHED_ULE               # ULE scheduler
+#options       SCHED_4BSD              # 4BSD scheduler

+options                SC_DISABLE_REBOOT
+options                SC_PIXEL_MODE
---------------------------------
/boot/loader.conf:
vesa_load="YES"
---------------------------------
/boot/device.hints:
hint.sc.0.flags="0x180"
---------------------------------
/etc/rc.conf:
allscreen_flags="-g 100x37 VESA_800x600" 
---------------------------------
and system trap during boot.

Fix: boot in single user mode with hint.sc.0.flags="0x100" and disable allscreen_flags.

How-To-Repeat: always.
Comment 1 Andrey V. Elsukov 2005-08-19 04:59:56 UTC
Andrey V. Elsukov wrote:
>>Environment:
FreeBSD 6.0-BETA2, 5.4-STABLE.

>>Fix:
i have make a patch.

-- 
WBR, Andrey V. Elsukov
Comment 2 Craig Rodrigues 2005-08-28 02:18:55 UTC
Hi,

You are on the right track with your patch.
sc->font_width is initialized to 0, and then
never reset, so you are hitting a division by zero
error inside sc_mouse_move() in scmouse.c

Can you try the following patch?


--- scvesactl.c.orig	Sat Aug 27 16:45:23 2005
+++ scvesactl.c	Sat Aug 27 17:24:46 2005
@@ -70,7 +70,7 @@
 	case SW_TEXT_132x60:
 		if (!(scp->sc->adp->va_flags & V_ADP_MODECHANGE))
 			return ENODEV;
-		return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0);
+		return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0, 0);
 
 	/* text modes */
 	case SW_VESA_C80x60:
@@ -81,7 +81,7 @@
 		if (!(scp->sc->adp->va_flags & V_ADP_MODECHANGE))
 			return ENODEV;
 		mode = (cmd & 0xff) + M_VESA_BASE;
-		return sc_set_text_mode(scp, tp, mode, 0, 0, 0);
+		return sc_set_text_mode(scp, tp, mode, 0, 0, 0, 0);
 
 	/* graphics modes */
 	case SW_VESA_32K_320: 	case SW_VESA_64K_320: 
--- scvidctl.c.orig	Sat Aug 27 16:45:06 2005
+++ scvidctl.c	Sat Aug 27 16:52:35 2005
@@ -133,7 +133,7 @@
 
 int
 sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize,
-		 int fontsize)
+		 int fontsize, int fontwidth)
 {
     video_info_t info;
     u_char *font;
@@ -213,6 +213,7 @@
     scp->ypixel = scp->ysize*fontsize;
     scp->font = font;
     scp->font_size = fontsize;
+    scp->font_width = fontwidth;
 
     /* allocate buffers */
     sc_alloc_scr_buffer(scp, TRUE, TRUE);
@@ -317,7 +318,7 @@
 
 int
 sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize, 
-		  int fontsize)
+		  int fontsize, int fontwidth)
 {
 #ifndef SC_PIXEL_MODE
     return ENODEV;
@@ -429,6 +430,7 @@
     scp->yoff = (scp->ypixel/fontsize - ysize)/2;
     scp->font = font;
     scp->font_size = fontsize;
+    scp->font_width = fontwidth;
 
     /* allocate buffers */
     sc_alloc_scr_buffer(scp, TRUE, TRUE);
@@ -554,7 +556,7 @@
 	if (info.vi_flags & V_INFO_GRAPHICS)
 	    return sc_set_graphics_mode(scp, tp, *(int *)data);
 	else
-	    return sc_set_text_mode(scp, tp, *(int *)data, 0, 0, 0);
+	    return sc_set_text_mode(scp, tp, *(int *)data, 0, 0, 0, 0);
 #endif /* SC_NO_MODE_CHANGE */
 
     case OLD_CONS_MODEINFO:	/* get mode information (old infterface) */
@@ -653,7 +655,7 @@
 #endif
 	if (!(adp->va_flags & V_ADP_MODECHANGE))
  	    return ENODEV;
-	return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0);
+	return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0, 0);
 
     /* GRAPHICS MODES */
     case SW_BG320:     case SW_BG640:
--- syscons.c.orig	Sat Aug 27 16:43:07 2005
+++ syscons.c	Sat Aug 27 16:43:52 2005
@@ -358,7 +358,7 @@
 	    splash_term(sc->adp);
 #endif
 	sc_set_graphics_mode(scp, NULL, M_VESA_800x600);
-	sc_set_pixel_mode(scp, NULL, COL, ROW, 16);
+	sc_set_pixel_mode(scp, NULL, COL, ROW, 16, 8);
 	sc->initial_mode = M_VESA_800x600;
 #ifdef DEV_SPLASH
 	/* put up the splash again! */
@@ -510,7 +510,7 @@
     if (scp == NULL) {
 	scp = SC_STAT(dev) = alloc_scp(sc, SC_VTY(dev));
 	if (ISGRAPHSC(scp))
-	    sc_set_pixel_mode(scp, NULL, COL, ROW, 16);
+	    sc_set_pixel_mode(scp, NULL, COL, ROW, 16, 8);
     }
     if (!tp->t_winsize.ws_col && !tp->t_winsize.ws_row) {
 	tp->t_winsize.ws_col = scp->xsize;
--- syscons.h.orig	Sat Aug 27 16:39:57 2005
+++ syscons.h	Sat Aug 27 16:42:20 2005
@@ -606,10 +606,11 @@
 
 /* scvidctl.c */
 int		sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode,
-				 int xsize, int ysize, int fontsize);
+				 int xsize, int ysize, int fontsize,
+				 int font_width);
 int		sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode);
-int		sc_set_pixel_mode(scr_stat *scp, struct tty *tp,
-				  int xsize, int ysize, int fontsize);
+int		sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize,
+				  int ysize, int fontsize, int font_width);
 int		sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
 			     struct thread *td);
 

-- 
Craig Rodrigues        
rodrigc@crodrigues.org
Comment 3 Craig Rodrigues freebsd_committer freebsd_triage 2005-09-02 18:38:25 UTC
State Changed
From-To: open->closed

Committed patch to HEAD, RELENG_6, RELENG_5. 
Thanks!