From: Joshua Wise Date: Sun, 5 Oct 2008 07:21:53 +0000 (-0400) Subject: Fix vga-overlay so that it doesn't cause disasters when it does an immediate-flush... X-Git-Url: http://git.joshuawise.com/netwatch.git/commitdiff_plain/6bd08bbccc0a276c5d3b9b50903e45792f9549c6?ds=sidebyside;hp=--cc Fix vga-overlay so that it doesn't cause disasters when it does an immediate-flush during firstrun (or otherwise not during SMM). --- 6bd08bbccc0a276c5d3b9b50903e45792f9549c6 diff --git a/aseg/firstrun.c b/aseg/firstrun.c index 6df8d7d..d3cd16f 100644 --- a/aseg/firstrun.c +++ b/aseg/firstrun.c @@ -23,6 +23,8 @@ void __firstrun_start() { for (bp = (void *)&_bss; (void *)bp < (void *)&_bssend; bp++) *bp = 0; + vga_flush_imm(0); + outputf("NetWatch running"); /* Try really hard to shut up USB_LEGKEY. */ @@ -47,6 +49,8 @@ void __firstrun_start() { smi_enable(); + vga_flush_imm(1); + smram_restore_state(smram); } diff --git a/aseg/vga-overlay.c b/aseg/vga-overlay.c index 913ebc2..7d107d7 100644 --- a/aseg/vga-overlay.c +++ b/aseg/vga-overlay.c @@ -10,6 +10,7 @@ static char logents[LOGLEN][41] = {{0}}; static int prodptr = 0; +static int flush_imm = 0; #define VRAM_BASE 0xA0000UL #define TEXT_CONSOLE_OFFSET 0x18000UL @@ -18,6 +19,11 @@ static int prodptr = 0; #define COLOR 0x1F +void vga_flush_imm(int imm) +{ + flush_imm = imm; +} + static unsigned char vga_read(unsigned char idx) { outb(CRTC_IDX_REG, idx); @@ -75,7 +81,8 @@ void dolog(const char *s) { strcpy(logents[prodptr], s); prodptr = (prodptr + 1) % LOGLEN; - outlog(); + if (flush_imm) + outlog(); } void (*output)(const char *s) = dolog; @@ -87,7 +94,8 @@ void dologf(const char *fmt, ...) vsnprintf(logents[prodptr], 40, fmt, va); va_end(va); prodptr = (prodptr + 1) % LOGLEN; - outlog(); + if (flush_imm) + outlog(); } void (*outputf)(const char *s, ...) = dologf; diff --git a/include/vga-overlay.h b/include/vga-overlay.h index f338d49..ec9efd5 100644 --- a/include/vga-overlay.h +++ b/include/vga-overlay.h @@ -1,6 +1,8 @@ #ifndef VGA_OVERLAY_H #define VGA_OVERLAY_H +void vga_flush_imm(int enb); + void strblit(char *src, int row, int col); void dolog(char *s);