From owner-freebsd-hackers Sun Jun 8 06:09:20 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id GAA12243 for hackers-outgoing; Sun, 8 Jun 1997 06:09:20 -0700 (PDT) Received: from nasu.utsunomiya-u.ac.jp (nasu.utsunomiya-u.ac.jp [160.12.128.3]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id GAA12238 for ; Sun, 8 Jun 1997 06:09:14 -0700 (PDT) Received: from outmail.utsunomiya-u.ac.jp (outmail.utsunomiya-u.ac.jp [160.12.196.3]) by nasu.utsunomiya-u.ac.jp (8.8.4+2.7Wbeta4/3.5Wpl3) with ESMTP id WAA05131; Sun, 8 Jun 1997 22:08:19 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp (fUOEgdobHoMlzXIxMFobBLlWFH4PmZzK@zodiac.mech.utsunomiya-u.ac.jp [160.12.33.1]) by outmail.utsunomiya-u.ac.jp (8.8.4+2.7Wbeta4/3.5Wpl3) with ESMTP id WAA03141; Sun, 8 Jun 1997 22:08:19 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp (zenith.mech.utsunomiya-u.ac.jp [160.12.33.60]) by zodiac.mech.utsunomiya-u.ac.jp (8.7.6+2.6Wbeta7/3.4W/zodiac-May96) with ESMTP id WAA01984; Sun, 8 Jun 1997 22:13:35 +0900 (JST) Message-Id: <199706081313.WAA01984@zodiac.mech.utsunomiya-u.ac.jp> To: Wilko Bulte cc: FreeBSD-hackers@freebsd.org (FreeBSD hackers list), yokota@zodiac.mech.utsunomiya-u.ac.jp Subject: Re: Lockup during kernel device probe on 2.2.1R In-reply-to: Your message of "Sat, 07 Jun 1997 20:49:19 +0200." <199706071849.UAA00951@yedi.iaf.nl> References: <199706071849.UAA00951@yedi.iaf.nl> Date: Sun, 08 Jun 1997 22:13:34 +0900 From: Kazutaka YOKOTA Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >OS: FreeBSD 2.2.1R straight of the CD >Machines: 4x 486DX/33, all the same EISA motherboard (Philips P9175 to be > exact) > memory: 12 or 16 Mb > disk: 3x AHA1740 with different brands of rootdisks > 1x WD1007 with ESDI Micropolis > console: 3x VGA, 1x EGA > > >Problem: Of the 4 machines, 3 lockup after "boot -v"-ing the 2.2.1R > bootflop. The last message printed is from syscons: > bla bla port is 0045 (I of course forgot to take the > paper with the exact message :( ) Then nothing appears on > the (VGA) console anymore. > > Of the 3 failing machines, 2 are currently running 2.1.6R like > a charm. Disabling all of the devices that are not essential > makes no difference whatsoever. > > Interestingly enough the 4th machine runs and boots 2.2.1R without > any problem. Has Orchid Prodesigner VGA BTW. So, the video cards which failed to boot 2.2.1R are 2 VGAs and 1 EGA, right? Would you tell us the brands and models of these cards? What I can think of is... Try booting the 2.2.2R boot.flp on the failed systems and see how it goes. If they can boot the floppy, you may either: a) install 2.2.2R rather than 2.2.1R, or b) put the Orchid card in the failed systems and install 2.2.1R. Then apply the following patch to /sys/i386/isa/syscons.c so that the syscons driver is brought to the level of 2.2.2R, and put back the original video card. Kazu Index: syscons.c =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/syscons.c,v retrieving revision 1.182.2.15 retrieving revision 1.182.2.18 diff -u -r1.182.2.15 -r1.182.2.18 --- syscons.c 1997/03/09 06:32:28 1.182.2.15 +++ syscons.c 1997/05/11 06:09:02 1.182.2.18 @@ -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.182.2.15 1997/03/09 06:32:28 yokota Exp $ + * $Id: syscons.c,v 1.182.2.18 1997/05/11 06:09:02 yokota Exp $ */ #include "sc.h" @@ -79,8 +79,9 @@ #define COLD 0 #define WARM 1 -/* this may break on older VGA's but is useful on real 32 bit systems */ -#define bcopyw bcopy +/* XXX use sc_bcopy where video memory is concerned */ +#define sc_bcopy generic_bcopy +extern void generic_bcopy(const void *, void *, size_t); static default_attr user_default = { (FG_LIGHTGREY | BG_BLACK) << 8, @@ -127,6 +128,7 @@ char font_14[256*14]; char font_16[256*16]; char palette[256*3]; +static char vgaregs[64]; static char *cut_buffer; static u_short mouse_and_mask[16] = { 0xc000, 0xe000, 0xf000, 0xf800, @@ -201,6 +203,9 @@ static void set_keyboard(int command, int data); static void update_leds(int which); static void set_vgaregs(char *modetable); +static void read_vgaregs(char *buf); +static int comp_vgaregs(u_char *buf1, u_char *buf2); +static void dump_vgaregs(u_char *buf); static void set_font_mode(void); static void set_normal_mode(void); static void set_destructive_cursor(scr_stat *scp); @@ -332,14 +337,10 @@ c |= KBD_OVERRIDE_KBD_LOCK; #endif - /* - * enable the keyboard port, but disable the keyboard intr. - * the aux port (mouse port) is disabled too. - */ + /* enable the keyboard port, but disable the keyboard intr. */ if (!set_controller_command_byte(sc_kbdc, - KBD_KBD_CONTROL_BITS | KBD_AUX_CONTROL_BITS, - KBD_ENABLE_KBD_PORT | KBD_DISABLE_KBD_INT - | KBD_DISABLE_AUX_PORT | KBD_DISABLE_AUX_INT)) { + KBD_KBD_CONTROL_BITS, + KBD_ENABLE_KBD_PORT | KBD_DISABLE_KBD_INT)) { /* CONTROLLER ERROR * there is very little we can do... */ @@ -411,8 +412,8 @@ } /* enable the keyboard port and intr. */ if (!set_controller_command_byte(sc_kbdc, - KBD_KBD_CONTROL_BITS | KBD_AUX_CONTROL_BITS | KBD_OVERRIDE_KBD_LOCK, - (c & (KBD_AUX_CONTROL_BITS | KBD_OVERRIDE_KBD_LOCK)) + KBD_KBD_CONTROL_BITS | KBD_TRANSLATION | KBD_OVERRIDE_KBD_LOCK, + (c & (KBD_TRANSLATION | KBD_OVERRIDE_KBD_LOCK)) | KBD_ENABLE_KBD_PORT | KBD_ENABLE_KBD_INT)) { /* CONTROLLER ERROR * This is serious; we are left with the disabled keyboard intr. @@ -468,7 +469,7 @@ M_DEVBUF, M_NOWAIT); /* copy temporary buffer to final buffer */ - bcopyw(sc_buffer, scp->scr_buf, scp->xsize * scp->ysize * sizeof(u_short)); + bcopy(sc_buffer, scp->scr_buf, scp->xsize * scp->ysize * sizeof(u_short)); scp->cursor_pos = scp->cursor_oldpos = scp->scr_buf + scp->xpos + scp->ypos * scp->xsize; @@ -494,6 +495,19 @@ update_leds(scp->status); + if (bootverbose) { + printf("sc%d: BIOS video mode:%d\n", + dev->id_unit, *(u_char *)pa_to_va(0x449)); + printf("sc%d: VGA registers upon power-up\n", dev->id_unit); + dump_vgaregs(vgaregs); + printf("sc%d: video mode:%d\n", dev->id_unit, scp->mode); + if (video_mode_ptr != NULL) { + printf("sc%d: VGA registers for mode:%d\n", + dev->id_unit, scp->mode); + dump_vgaregs(video_mode_ptr + (64*scp->mode)); + } + } + printf("sc%d: ", dev->id_unit); if (crtc_vga) if (crtc_addr == MONO_BASE) @@ -1472,7 +1486,7 @@ s = splclock(); if (scp == cur_console && !(scp->status & UNKNOWN_MODE)) { if (/* timer not running && */ (scp->start <= scp->end)) { - bcopyw(scp->scr_buf + scp->start, Crtat + scp->start, + sc_bcopy(scp->scr_buf + scp->start, Crtat + scp->start, (1 + scp->end - scp->start) * sizeof(u_short)); scp->start = scp->xsize * scp->ysize; scp->end = 0; @@ -1564,7 +1578,7 @@ if (!scrn_blanked) { /* update screen image */ if (scp->start <= scp->end) { - bcopyw(scp->scr_buf + scp->start, Crtat + scp->start, + sc_bcopy(scp->scr_buf + scp->start, Crtat + scp->start, (1 + scp->end - scp->start) * sizeof(u_short)); } @@ -1753,7 +1767,7 @@ if (scp->ypos > 0) move_crsr(scp, scp->xpos, scp->ypos - 1); else { - bcopyw(scp->scr_buf, scp->scr_buf + scp->xsize, + bcopy(scp->scr_buf, scp->scr_buf + scp->xsize, (scp->ysize - 1) * scp->xsize * sizeof(u_short)); fillw(scp->term.cur_color | scr_map[0x20], scp->scr_buf, scp->xsize); @@ -1906,7 +1920,7 @@ src = scp->scr_buf + scp->ypos * scp->xsize; dst = src + n * scp->xsize; count = scp->ysize - (scp->ypos + n); - bcopyw(src, dst, count * scp->xsize * sizeof(u_short)); + bcopy(src, dst, count * scp->xsize * sizeof(u_short)); fillw(scp->term.cur_color | scr_map[0x20], src, n * scp->xsize); mark_for_update(scp, scp->ypos * scp->xsize); @@ -1920,7 +1934,7 @@ dst = scp->scr_buf + scp->ypos * scp->xsize; src = dst + n * scp->xsize; count = scp->ysize - (scp->ypos + n); - bcopyw(src, dst, count * scp->xsize * sizeof(u_short)); + bcopy(src, dst, count * scp->xsize * sizeof(u_short)); src = dst + count * scp->xsize; fillw(scp->term.cur_color | scr_map[0x20], src, n * scp->xsize); @@ -1935,7 +1949,7 @@ dst = scp->cursor_pos; src = dst + n; count = scp->xsize - (scp->xpos + n); - bcopyw(src, dst, count * sizeof(u_short)); + bcopy(src, dst, count * sizeof(u_short)); src = dst + count; fillw(scp->term.cur_color | scr_map[0x20], src, n); mark_for_update(scp, scp->cursor_pos - scp->scr_buf); @@ -1949,7 +1963,7 @@ src = scp->cursor_pos; dst = src + n; count = scp->xsize - (scp->xpos + n); - bcopyw(src, dst, count * sizeof(u_short)); + bcopy(src, dst, count * sizeof(u_short)); fillw(scp->term.cur_color | scr_map[0x20], src, n); mark_for_update(scp, scp->cursor_pos - scp->scr_buf); mark_for_update(scp, scp->cursor_pos - scp->scr_buf + n + count); @@ -1959,7 +1973,7 @@ n = scp->term.param[0]; if (n < 1) n = 1; if (n > scp->ysize) n = scp->ysize; - bcopyw(scp->scr_buf + (scp->xsize * n), + bcopy(scp->scr_buf + (scp->xsize * n), scp->scr_buf, scp->xsize * (scp->ysize - n) * sizeof(u_short)); fillw(scp->term.cur_color | scr_map[0x20], @@ -1972,7 +1986,7 @@ n = scp->term.param[0]; if (n < 1) n = 1; if (n > scp->ysize) n = scp->ysize; - bcopyw(scp->scr_buf, + bcopy(scp->scr_buf, scp->scr_buf + (scp->xsize * n), scp->xsize * (scp->ysize - n) * sizeof(u_short)); @@ -2342,14 +2356,14 @@ if (scp->cursor_pos >= scp->scr_buf + scp->ysize * scp->xsize) { remove_cutmarking(scp); if (scp->history) { - bcopyw(scp->scr_buf, scp->history_head, + bcopy(scp->scr_buf, scp->history_head, scp->xsize * sizeof(u_short)); scp->history_head += scp->xsize; if (scp->history_head + scp->xsize > scp->history + scp->history_size) scp->history_head = scp->history; } - bcopyw(scp->scr_buf + scp->xsize, scp->scr_buf, + bcopy(scp->scr_buf + scp->xsize, scp->scr_buf, scp->xsize * (scp->ysize - 1) * sizeof(u_short)); fillw(scp->term.cur_color | scr_map[0x20], scp->scr_buf + scp->xsize * (scp->ysize - 1), @@ -2431,6 +2445,7 @@ u_long segoff; crtc_vga = TRUE; + read_vgaregs(vgaregs); /* Get the BIOS video mode pointer */ segoff = *(u_long *)pa_to_va(0x4a8); @@ -2447,8 +2462,14 @@ init_scp(console[0]); cur_console = console[0]; + /* discard the video mode table if we are not familiar with it... */ + if (video_mode_ptr) { + if (comp_vgaregs(vgaregs, video_mode_ptr + 64*console[0]->mode)) + video_mode_ptr = NULL; + } + /* copy screen to temporary buffer */ - bcopyw(Crtat, sc_buffer, + sc_bcopy(Crtat, sc_buffer, console[0]->xsize * console[0]->ysize * sizeof(u_short)); console[0]->scr_buf = console[0]->mouse_pos = sc_buffer; @@ -2577,7 +2598,7 @@ int i; for (i=0; iysize; i++) - bcopyw(scp->history + (((scp->history_pos - scp->history) + + bcopy(scp->history + (((scp->history_pos - scp->history) + scp->history_size-((i+1)*scp->xsize))%scp->history_size), scp->scr_buf + (scp->xsize * (scp->ysize-1 - i)), scp->xsize * sizeof(u_short)); @@ -2759,7 +2780,7 @@ /* copy screen into top of history buffer */ for (i=0; iysize; i++) { - bcopyw(cur_console->scr_buf + (cur_console->xsize * i), + bcopy(cur_console->scr_buf + (cur_console->xsize * i), cur_console->history_head, cur_console->xsize * sizeof(u_short)); cur_console->history_head += cur_console->xsize; @@ -2941,7 +2962,7 @@ u_short *ptr = cur_console->history_save; for (i=0; iysize; i++) { - bcopyw(ptr, + bcopy(ptr, cur_console->scr_buf + (cur_console->xsize*i), cur_console->xsize * sizeof(u_short)); @@ -3110,11 +3131,12 @@ /* disable the keyboard and mouse interrupt */ s = spltty(); +#if 0 c = get_controller_command_byte(sc_kbdc); if ((c == -1) || !set_controller_command_byte(sc_kbdc, kbdc_get_device_mask(sc_kbdc), - KBD_ENABLE_KBD_PORT | KBD_DISABLE_KBD_INT + KBD_DISABLE_KBD_PORT | KBD_DISABLE_KBD_INT | KBD_DISABLE_AUX_PORT | KBD_DISABLE_AUX_INT)) { /* CONTROLLER ERROR */ kbdc_lock(sc_kbdc, FALSE); @@ -3129,15 +3151,21 @@ * by the lock flag set via `kbdc_lock()' */ splx(s); +#endif - send_kbd_command_and_data(sc_kbdc, command, data); + if (send_kbd_command_and_data(sc_kbdc, command, data) != KBD_ACK) + send_kbd_command(sc_kbdc, KBDC_ENABLE_KBD); +#if 0 /* restore the interrupts */ if (!set_controller_command_byte(sc_kbdc, kbdc_get_device_mask(sc_kbdc), c & (KBD_KBD_CONTROL_BITS | KBD_AUX_CONTROL_BITS))) { /* CONTROLLER ERROR */ } +#else + splx(s); +#endif kbdc_lock(sc_kbdc, FALSE); } @@ -3169,22 +3197,22 @@ /* setup video hardware for the given mode */ switch (scp->mode) { case M_VGA_M80x60: - bcopyw(video_mode_ptr+(64*M_VGA_M80x25), &special_modetable, 64); + bcopy(video_mode_ptr+(64*M_VGA_M80x25), &special_modetable, 64); goto special_80x60; case M_VGA_C80x60: - bcopyw(video_mode_ptr+(64*M_VGA_C80x25), &special_modetable, 64); + bcopy(video_mode_ptr+(64*M_VGA_C80x25), &special_modetable, 64); special_80x60: special_modetable[2] = 0x08; special_modetable[19] = 0x47; goto special_480l; case M_VGA_M80x30: - bcopyw(video_mode_ptr+(64*M_VGA_M80x25), &special_modetable, 64); + bcopy(video_mode_ptr+(64*M_VGA_M80x25), &special_modetable, 64); goto special_80x30; case M_VGA_C80x30: - bcopyw(video_mode_ptr+(64*M_VGA_C80x25), &special_modetable, 64); + bcopy(video_mode_ptr+(64*M_VGA_C80x25), &special_modetable, 64); special_80x30: special_modetable[19] = 0x4f; special_480l: @@ -3199,21 +3227,21 @@ goto setup_mode; case M_ENH_B80x43: - bcopyw(video_mode_ptr+(64*M_ENH_B80x25), &special_modetable, 64); + bcopy(video_mode_ptr+(64*M_ENH_B80x25), &special_modetable, 64); goto special_80x43; case M_ENH_C80x43: - bcopyw(video_mode_ptr+(64*M_ENH_C80x25), &special_modetable, 64); + bcopy(video_mode_ptr+(64*M_ENH_C80x25), &special_modetable, 64); special_80x43: special_modetable[28] = 87; goto special_80x50; case M_VGA_M80x50: - bcopyw(video_mode_ptr+(64*M_VGA_M80x25), &special_modetable, 64); + bcopy(video_mode_ptr+(64*M_VGA_M80x25), &special_modetable, 64); goto special_80x50; case M_VGA_C80x50: - bcopyw(video_mode_ptr+(64*M_VGA_C80x25), &special_modetable, 64); + bcopy(video_mode_ptr+(64*M_VGA_C80x25), &special_modetable, 64); special_80x50: special_modetable[2] = 8; special_modetable[19] = 7; @@ -3316,6 +3344,86 @@ } static void +read_vgaregs(char *buf) +{ + int i, j; + int s; + + bzero(buf, 64); + + s = splhigh(); + + outb(TSIDX, 0x00); outb(TSREG, 0x01); /* stop sequencer */ + outb(TSIDX, 0x07); outb(TSREG, 0x00); /* unlock registers */ + for (i=0, j=5; i<4; i++) { + outb(TSIDX, i+1); + buf[j++] = inb(TSREG); + } + buf[9] = inb(MISC + 10); /* dot-clock */ + outb(TSIDX, 0x00); outb(TSREG, 0x03); /* start sequencer */ + + for (i=0, j=10; i<25; i++) { /* crtc */ + outb(crtc_addr, i); + buf[j++] = inb(crtc_addr+1); + } + for (i=0, j=35; i<20; i++) { /* attribute ctrl */ + inb(crtc_addr+6); /* reset flip-flop */ + outb(ATC, i); + buf[j++] = inb(ATC + 1); + } + for (i=0, j=55; i<9; i++) { /* graph data ctrl */ + outb(GDCIDX, i); + buf[j++] = inb(GDCREG); + } + inb(crtc_addr+6); /* reset flip-flop */ + outb(ATC, 0x20); /* enable palette */ + + buf[0] = *(char *)pa_to_va(0x44a); /* COLS */ + buf[1] = *(char *)pa_to_va(0x484); /* ROWS */ + buf[2] = *(char *)pa_to_va(0x485); /* POINTS */ + buf[3] = *(char *)pa_to_va(0x44c); + buf[4] = *(char *)pa_to_va(0x44d); + + splx(s); +} + +static int +comp_vgaregs(u_char *buf1, u_char *buf2) +{ + int i; + + for(i = 0; i < 20; ++i) { + if (*buf1++ != *buf2++) + return 1; + } + buf1 += 2; /* skip the cursor shape */ + buf2 += 2; + for(i = 22; i < 24; ++i) { + if (*buf1++ != *buf2++) + return 1; + } + buf1 += 2; /* skip the cursor position */ + buf2 += 2; + for(i = 26; i < 64; ++i) { + if (*buf1++ != *buf2++) + return 1; + } + return 0; +} + +static void +dump_vgaregs(u_char *buf) +{ + int i; + + for(i = 0; i < 64;) { + printf("%02x ", buf[i]); + if ((++i % 16) == 0) + printf("\n"); + } +} + +static void set_font_mode() { int s = splhigh(); @@ -3387,6 +3495,9 @@ modetable = video_mode_ptr + (64*M_VGA_C80x25); } + if (video_mode_ptr == NULL) + modetable = vgaregs; + /* setup vga for normal operation mode again */ inb(crtc_addr+6); /* reset flip-flop */ outb(ATC, 0x10); outb(ATC, modetable[0x10+35]); @@ -3481,19 +3592,19 @@ if (scp->status & MOUSE_VISIBLE) { if ((scp->cursor_saveunder & 0xff) == 0xd0) - bcopyw(&scp->mouse_cursor[0], cursor, scp->font_size); + bcopy(&scp->mouse_cursor[0], cursor, scp->font_size); else if ((scp->cursor_saveunder & 0xff) == 0xd1) - bcopyw(&scp->mouse_cursor[32], cursor, scp->font_size); + bcopy(&scp->mouse_cursor[32], cursor, scp->font_size); else if ((scp->cursor_saveunder & 0xff) == 0xd2) - bcopyw(&scp->mouse_cursor[64], cursor, scp->font_size); + bcopy(&scp->mouse_cursor[64], cursor, scp->font_size); else if ((scp->cursor_saveunder & 0xff) == 0xd3) - bcopyw(&scp->mouse_cursor[96], cursor, scp->font_size); + bcopy(&scp->mouse_cursor[96], cursor, scp->font_size); else - bcopyw(font_buffer+((scp->cursor_saveunder & 0xff)*scp->font_size), + bcopy(font_buffer+((scp->cursor_saveunder & 0xff)*scp->font_size), cursor, scp->font_size); } else - bcopyw(font_buffer + ((scp->cursor_saveunder & 0xff) * scp->font_size), + bcopy(font_buffer + ((scp->cursor_saveunder & 0xff) * scp->font_size), cursor, scp->font_size); for (i=0; i<32; i++) if ((i >= scp->cursor_start && i <= scp->cursor_end) || @@ -3503,7 +3614,7 @@ while (!(inb(crtc_addr+6) & 0x08)) /* wait for vertical retrace */ ; #endif set_font_mode(); - bcopy(cursor, (char *)pa_to_va(address) + DEAD_CHAR * 32, 32); + sc_bcopy(cursor, (char *)pa_to_va(address) + DEAD_CHAR * 32, 32); set_normal_mode(); } @@ -3630,13 +3741,13 @@ yoffset = scp->mouse_ypos % font_size; /* prepare mousepointer char's bitmaps */ - bcopyw(font_buffer + ((*(scp->mouse_pos) & 0xff) * font_size), + bcopy(font_buffer + ((*(scp->mouse_pos) & 0xff) * font_size), &scp->mouse_cursor[0], font_size); - bcopyw(font_buffer + ((*(scp->mouse_pos+1) & 0xff) * font_size), + bcopy(font_buffer + ((*(scp->mouse_pos+1) & 0xff) * font_size), &scp->mouse_cursor[32], font_size); - bcopyw(font_buffer + ((*(scp->mouse_pos+scp->xsize) & 0xff) * font_size), + bcopy(font_buffer + ((*(scp->mouse_pos+scp->xsize) & 0xff) * font_size), &scp->mouse_cursor[64], font_size); - bcopyw(font_buffer + ((*(scp->mouse_pos+scp->xsize+1) & 0xff) * font_size), + bcopy(font_buffer + ((*(scp->mouse_pos+scp->xsize+1) & 0xff) * font_size), &scp->mouse_cursor[96], font_size); for (i=0; imouse_cursor[i]<<8 | scp->mouse_cursor[i+32]; @@ -3663,7 +3774,7 @@ while (!(inb(crtc_addr+6) & 0x08)) /* idle */ ; #endif set_font_mode(); - bcopy(scp->mouse_cursor, (char *)pa_to_va(address) + 0xd0 * 32, 128); + sc_bcopy(scp->mouse_cursor, (char *)pa_to_va(address) + 0xd0 * 32, 128); set_normal_mode(); *(crt_pos) = (*(scp->mouse_pos)&0xff00)|0xd0; *(crt_pos+scp->xsize) = (*(scp->mouse_pos+scp->xsize)&0xff00)|0xd2; @@ -3798,8 +3909,12 @@ { static int toggle = 0; static u_char save_mode; - int s = splhigh(); + int s; + + if (video_mode_ptr == NULL) + return; + s = splhigh(); if (toggle) { scp->mode = save_mode; scp->status &= ~UNKNOWN_MODE;