X-Yow: Yow! Am I in Milwaukee? To: Geert Uytterhoeven Cc: Linux/m68k Subject: Re: L68K: New console scheme patches References: X-Yow: .. One FISHWICH coming up!! From: Andreas Schwab Date: 02 Jan 1998 10:53:04 +0100 Sender: owner-linux-m68k@phil.uni-sb.de Geert Uytterhoeven writes: |> In case you've been wondering where my patches were: here they are! I had to |> fix a bug in the console handling first (the negative index, cfr. Roman's fix). |> I'm still wondering why I don't suffer from that problem on PPC... Perhaps because it has already been fixed properly in 2.1.73+, obsoleting Roman's fix. I have included it here for reference. Other things i have changed: - console.new.c (do_con_write): Ignore tty->stopped, otherwise characters may be lost since the console driver does no buffering. Add braces to avoid warning from gcc 2.8. - vc_screen.c (vcs_read, vcs_write): Handle big endian when read/write count or file offset is odd. - selection.h (scr_write, scr_read): Don't waste time swapping bytes. HNY, everyone! Andreas. ---------------------------------------------------------------------- --- drivers/char/console.new.c.~1~ Mon Dec 29 22:09:09 1997 +++ drivers/char/console.new.c Mon Dec 29 22:23:44 1997 @@ -1551,7 +1551,7 @@ } disable_bh(CONSOLE_BH); - while (!tty->stopped && count) { + while (count) { enable_bh(CONSOLE_BH); if (from_user) __get_user(c, buf); @@ -1904,11 +1904,12 @@ set_cursor(currcons); continue; case 'n': - if (!ques) + if (!ques) { if (par[0] == 5) status_report(tty); else if (par[0] == 6) cursor_report(currcons,tty); + } continue; } if (ques) { @@ -2211,7 +2212,7 @@ static kdev_t vt_console_device(struct console *c) { - return MKDEV(TTY_MAJOR, c->index > 0 ? c->index : fg_console + 1); + return MKDEV(TTY_MAJOR, c->index ? c->index : fg_console + 1); } extern int keyboard_wait_for_keypress(struct console *); --- drivers/char/vc_screen.c.~1~ Fri Nov 7 19:13:49 1997 +++ drivers/char/vc_screen.c Fri Nov 7 19:57:57 1997 @@ -150,7 +150,11 @@ p -= HEADER_SIZE; org = screen_pos(currcons, p/2, viewed); if ((p & 1) && count > 0) +#ifdef __BIG_ENDIAN + { count--; put_user(func_scr_readw(org++) & 0xff, buf++); } +#else { count--; put_user(func_scr_readw(org++) >> 8, buf++); } +#endif } while (count > 1) { put_user(func_scr_readw(org++), (unsigned short *) buf); @@ -158,7 +162,11 @@ count -= 2; } if (count > 0) +#ifdef __BIG_ENDIAN + put_user(func_scr_readw(org) >> 8, buf++); +#else put_user(func_scr_readw(org) & 0xff, buf++); +#endif } read = buf - buf0; *ppos += read; @@ -220,8 +228,13 @@ char c; count--; get_user(c,buf++); +#ifdef __BIG_ENDIAN + func_scr_writew(c | + (func_scr_readw(org) & 0xff00), org); +#else func_scr_writew((c << 8) | (func_scr_readw(org) & 0xff), org); +#endif org++; } } @@ -235,7 +248,11 @@ if (count > 0) { unsigned char c; get_user(c, (const unsigned char*)buf++); +#ifdef __BIG_ENDIAN + func_scr_writew((func_scr_readw(org) & 0xff) | (c << 8), org); +#else func_scr_writew((func_scr_readw(org) & 0xff00) | c, org); +#endif } } #ifdef CONFIG_ABSTRACT_CONSOLE --- include/linux/selection.h.~3~ Tue Dec 30 00:13:53 1997 +++ include/linux/selection.h Tue Dec 30 00:14:08 1997 @@ -150,12 +150,12 @@ static inline void scr_writew(unsigned short val, unsigned short *addr) { /* simply store the value in the "shadow screen" memory */ - *addr = cpu_to_le16(val); + *addr = val; } static inline unsigned short scr_readw(unsigned short * addr) { - return le16_to_cpu(*addr); + return *addr; } #else /* CONFIG_TGA_CONSOLE || CONFIG_SUN_CONSOLE || CONFIG_ABSTRACT_CONSOLE */ --- kernel/printk.c.~1~ Wed Dec 17 19:58:17 1997 +++ kernel/printk.c Mon Dec 15 19:25:24 1997 @@ -317,6 +317,8 @@ * that registers here. */ if (selected_console == 0) { + if (console->index < 0) + console->index = 0; if (console->setup == NULL || console->setup(console, NULL) == 0) { console->flags |= CON_ENABLED | CON_FIRST;