kern/84836: Fatal trap on 6.0-BETA2 when use SC_PIXEL_MODE, SHED_ULE, VESA_800x600

Craig Rodrigues rodrigc at crodrigues.org
Sun Aug 28 01:20:16 GMT 2005


The following reply was made to PR kern/84836; it has been noted by GNATS.

From: Craig Rodrigues <rodrigc at crodrigues.org>
To: bug-followup at freebsd.org
Cc: "Andrey V. Elsukov" <bu7cher at yandex.ru>
Subject: Re: kern/84836: Fatal trap on 6.0-BETA2 when use SC_PIXEL_MODE, SHED_ULE, VESA_800x600
Date: Sat, 27 Aug 2005 21:18:55 -0400

 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 at crodrigues.org


More information about the freebsd-bugs mailing list