From b1d3d2ffcf8855c8ee0bf25d70fa5484d403ac5b Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Wed, 1 May 1996 03:58:21 +0000 Subject: [PATCH] Fixed a race that caused panics in kernel printfs when the screen timeout routine changed the screen pointers while output was in progress. --- sys/dev/syscons/syscons.c | 7 +++++-- sys/i386/isa/syscons.c | 7 +++++-- sys/isa/syscons.c | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 9947f75e4ea3..962aa9a9cb96 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.144 1996/03/27 19:11:41 bde Exp $ + * $Id: syscons.c,v 1.145 1996/04/26 06:45:41 sos Exp $ */ #include "sc.h" @@ -1215,6 +1215,7 @@ void sccnputc(dev_t dev, int c) { u_char buf[1]; + int s; scr_stat *scp = console[0]; term_stat save = scp->term; @@ -1227,7 +1228,8 @@ sccnputc(dev_t dev, int c) kernel_console = scp->term; current_default = &user_default; scp->term = save; - if (scp == cur_console /* && scrn_timer not running */) { + s = splclock(); /* XXX stop scrn_timer */ + if (scp == cur_console) { if (scp->scr_buf != Crtat && (scp->start <= scp->end)) { bcopyw(scp->scr_buf + scp->start, Crtat + scp->start, (1 + scp->end - scp->start) * sizeof(u_short)); @@ -1237,6 +1239,7 @@ sccnputc(dev_t dev, int c) } draw_cursor(scp, TRUE); } + splx(s); } int diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c index 9947f75e4ea3..962aa9a9cb96 100644 --- a/sys/i386/isa/syscons.c +++ b/sys/i386/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.144 1996/03/27 19:11:41 bde Exp $ + * $Id: syscons.c,v 1.145 1996/04/26 06:45:41 sos Exp $ */ #include "sc.h" @@ -1215,6 +1215,7 @@ void sccnputc(dev_t dev, int c) { u_char buf[1]; + int s; scr_stat *scp = console[0]; term_stat save = scp->term; @@ -1227,7 +1228,8 @@ sccnputc(dev_t dev, int c) kernel_console = scp->term; current_default = &user_default; scp->term = save; - if (scp == cur_console /* && scrn_timer not running */) { + s = splclock(); /* XXX stop scrn_timer */ + if (scp == cur_console) { if (scp->scr_buf != Crtat && (scp->start <= scp->end)) { bcopyw(scp->scr_buf + scp->start, Crtat + scp->start, (1 + scp->end - scp->start) * sizeof(u_short)); @@ -1237,6 +1239,7 @@ sccnputc(dev_t dev, int c) } draw_cursor(scp, TRUE); } + splx(s); } int diff --git a/sys/isa/syscons.c b/sys/isa/syscons.c index 9947f75e4ea3..962aa9a9cb96 100644 --- a/sys/isa/syscons.c +++ b/sys/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.144 1996/03/27 19:11:41 bde Exp $ + * $Id: syscons.c,v 1.145 1996/04/26 06:45:41 sos Exp $ */ #include "sc.h" @@ -1215,6 +1215,7 @@ void sccnputc(dev_t dev, int c) { u_char buf[1]; + int s; scr_stat *scp = console[0]; term_stat save = scp->term; @@ -1227,7 +1228,8 @@ sccnputc(dev_t dev, int c) kernel_console = scp->term; current_default = &user_default; scp->term = save; - if (scp == cur_console /* && scrn_timer not running */) { + s = splclock(); /* XXX stop scrn_timer */ + if (scp == cur_console) { if (scp->scr_buf != Crtat && (scp->start <= scp->end)) { bcopyw(scp->scr_buf + scp->start, Crtat + scp->start, (1 + scp->end - scp->start) * sizeof(u_short)); @@ -1237,6 +1239,7 @@ sccnputc(dev_t dev, int c) } draw_cursor(scp, TRUE); } + splx(s); } int