提交 fbea6684 编写于 作者: G Guy Martin 提交者: James Bottomley

parisc : Remove broken line wrapping handling pdc_iodc_print()

Remove the broken line wrapping handling in pdc_iodc_print().
It is broken in 3 ways :
  - It doesn't keep track of the current screen position, it just
    assumes that the new buffer will be printed at the begining of the
    screen.
  - It doesn't take in account that non printable characters won't
    increase the current position on the screen.
  - And last but not least, it triggers a kernel panic if a backspace
    is the first char in the provided buffer :

 Backtrace:
  [<0000000040128ec4>] pdc_console_write+0x44/0x78
  [<0000000040128f18>] pdc_console_tty_write+0x20/0x38
  [<000000004032f1ac>] n_tty_write+0x2a4/0x550
  [<000000004032b158>] tty_write+0x1e0/0x2d8
  [<00000000401bb420>] vfs_write+0xb8/0x188
  [<00000000401bb630>] sys_write+0x68/0xb8
  [<0000000040104eb8>] syscall_exit+0x0/0x14

Most terminals handle the line wrapping just fine. I've confirmed that
it works correctly on a C8000 with both vga and serial output.
Signed-off-by: NGuy Martin <gmsoft@tuxicoman.be>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
上级 38567333
...@@ -1126,15 +1126,13 @@ int pdc_iodc_print(const unsigned char *str, unsigned count) ...@@ -1126,15 +1126,13 @@ int pdc_iodc_print(const unsigned char *str, unsigned count)
unsigned int i; unsigned int i;
unsigned long flags; unsigned long flags;
for (i = 0; i < count && i < 79;) { for (i = 0; i < count;) {
switch(str[i]) { switch(str[i]) {
case '\n': case '\n':
iodc_dbuf[i+0] = '\r'; iodc_dbuf[i+0] = '\r';
iodc_dbuf[i+1] = '\n'; iodc_dbuf[i+1] = '\n';
i += 2; i += 2;
goto print; goto print;
case '\b': /* BS */
i--; /* overwrite last */
default: default:
iodc_dbuf[i] = str[i]; iodc_dbuf[i] = str[i];
i++; i++;
...@@ -1142,15 +1140,6 @@ int pdc_iodc_print(const unsigned char *str, unsigned count) ...@@ -1142,15 +1140,6 @@ int pdc_iodc_print(const unsigned char *str, unsigned count)
} }
} }
/* if we're at the end of line, and not already inserting a newline,
* insert one anyway. iodc console doesn't claim to support >79 char
* lines. don't account for this in the return value.
*/
if (i == 79 && iodc_dbuf[i-1] != '\n') {
iodc_dbuf[i+0] = '\r';
iodc_dbuf[i+1] = '\n';
}
print: print:
spin_lock_irqsave(&pdc_lock, flags); spin_lock_irqsave(&pdc_lock, flags);
real32_call(PAGE0->mem_cons.iodc_io, real32_call(PAGE0->mem_cons.iodc_io,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册