patch-2.1.125 linux/drivers/char/console.c
Next file: linux/drivers/char/i2c.c
Previous file: linux/drivers/char/Makefile
Back to the patch index
Back to the overall index
- Lines: 78
- Date:
Wed Oct 7 11:18:31 1998
- Orig file:
v2.1.124/linux/drivers/char/console.c
- Orig date:
Mon Oct 5 13:13:39 1998
diff -u --recursive --new-file v2.1.124/linux/drivers/char/console.c linux/drivers/char/console.c
@@ -99,6 +99,7 @@
#include <asm/io.h>
#include <asm/system.h>
#include <asm/uaccess.h>
+#include <asm/bitops.h>
#include <asm/linux_logo.h>
@@ -1953,23 +1954,29 @@
}
}
+#ifdef CONFIG_VT_CONSOLE
+
/*
* Console on virtual terminal
+ *
+ * NOTE NOTE NOTE! This code can do no global locking. In particular,
+ * we can't disable interrupts or bottom half handlers globally, because
+ * we can be called from contexts that hold critical spinlocks, and
+ * trying do get a global lock at this point will lead to deadlocks.
*/
-#ifdef CONFIG_VT_CONSOLE
void vt_console_print(struct console *co, const char * b, unsigned count)
{
int currcons = fg_console;
unsigned char c;
- static int printing = 0;
+ static unsigned long printing = 0;
const ushort *start;
ushort cnt = 0;
ushort myx = x;
- if (!printable || printing)
- return; /* console not yet initialized */
- printing = 1;
+ /* console busy or not yet initialized */
+ if (!printable || test_and_set_bit(0, &printing))
+ return;
if (kmsg_redirect && vc_cons_allocated(kmsg_redirect - 1))
currcons = kmsg_redirect - 1;
@@ -1981,7 +1988,7 @@
}
if (vcmode != KD_TEXT)
- return;
+ goto quit;
/* undraw cursor first */
if (IS_FG)
@@ -1991,11 +1998,8 @@
/* Contrived structure to try to emulate original need_wrap behaviour
* Problems caused when we have need_wrap set on '\n' character */
- disable_bh(CONSOLE_BH);
while (count--) {
- enable_bh(CONSOLE_BH);
c = *b++;
- disable_bh(CONSOLE_BH);
if (c == 10 || c == 13 || c == 8 || need_wrap) {
if (cnt > 0) {
if (IS_VISIBLE)
@@ -2037,12 +2041,11 @@
need_wrap = 1;
}
}
- enable_bh(CONSOLE_BH);
set_cursor(currcons);
poke_blanked_console();
quit:
- printing = 0;
+ clear_bit(0, &printing);
}
static kdev_t vt_console_device(struct console *c)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov