From owner-svn-src-head@FreeBSD.ORG Sat Aug 23 07:41:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D7EBC214; Sat, 23 Aug 2014 07:41:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A756739B0; Sat, 23 Aug 2014 07:41:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7N7f8C5055359; Sat, 23 Aug 2014 07:41:08 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7N7f83o055358; Sat, 23 Aug 2014 07:41:08 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201408230741.s7N7f83o055358@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: Jean-Sebastien Pedron Date: Sat, 23 Aug 2014 07:41:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270390 - head/sys/dev/vt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Aug 2014 07:41:09 -0000 Author: dumbbell Date: Sat Aug 23 07:41:08 2014 New Revision: 270390 URL: http://svnweb.freebsd.org/changeset/base/270390 Log: vt(4): Fix a crash in vt_mark_mouse_position_as_dirty() when in textmode In textmode, no font is loaded, thus the page fault in vt_mark_mouse_position_as_dirty() when it wants the font width/height. For now, create a fake area for the textmode. This needs to be modified if vt_vga gains mouse support in textmode. While here, fix a build failure when SC_NO_CUTPASTE is defined: vt_mark_mouse_position_as_dirty() must not be included in this case. MFC after: 1 week Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Sat Aug 23 07:03:04 2014 (r270389) +++ head/sys/dev/vt/vt_core.c Sat Aug 23 07:41:08 2014 (r270390) @@ -818,6 +818,7 @@ vt_determine_colors(term_char_t c, int c } } +#ifndef SC_NO_CUTPASTE static void vt_mark_mouse_position_as_dirty(struct vt_device *vd, int x, int y) { @@ -828,17 +829,33 @@ vt_mark_mouse_position_as_dirty(struct v vw = vd->vd_curwindow; vf = vw->vw_font; - area.tr_begin.tp_col = (x - vw->vw_offset.tp_col) / vf->vf_width; - area.tr_begin.tp_row = (y - vw->vw_offset.tp_row) / vf->vf_height; - area.tr_end.tp_col = - ((x + vd->vd_mcursor->width - vw->vw_offset.tp_col) / - vf->vf_width) + 1; - area.tr_end.tp_row = - ((y + vd->vd_mcursor->height - vw->vw_offset.tp_row) / - vf->vf_height) + 1; + if (vf != NULL) { + area.tr_begin.tp_col = (x - vw->vw_offset.tp_col) / + vf->vf_width; + area.tr_begin.tp_row = (y - vw->vw_offset.tp_row) / + vf->vf_height; + area.tr_end.tp_col = + ((x + vd->vd_mcursor->width - vw->vw_offset.tp_col) / + vf->vf_width) + 1; + area.tr_end.tp_row = + ((y + vd->vd_mcursor->height - vw->vw_offset.tp_row) / + vf->vf_height) + 1; + } else { + /* + * No font loaded (ie. vt_vga operating in textmode). + * + * FIXME: This fake area needs to be revisited once the + * mouse cursor is supported in vt_vga's textmode. + */ + area.tr_begin.tp_col = x; + area.tr_begin.tp_row = y; + area.tr_end.tp_col = x + 2; + area.tr_end.tp_row = y + 2; + } vtbuf_dirty(&vw->vw_buf, &area); } +#endif static void vt_bitblt_char(struct vt_device *vd, struct vt_font *vf, term_char_t c,