summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-07-18 16:17:50 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-07-18 18:57:03 +0200
commitc9e087748246622d824b5ab83ad8cc79b31014d1 (patch)
treed27cbf6f6fdde246fe14e2b163bb949f4aba25e2
parent1451a958347f5e683c63466cd7dfb893c1651f19 (diff)
kern/printf: do not serialize printf and co
A lot of code assumes that printf is re-entrant, e.g. the pagination code in the debugger, or any use of assert inside the console driver. * kern/printf.c: Drop the lock serializing calls to `_doprnt'. (printf_init): Remove function. * kern/printf.h (printf_init): Remove declaration. * kern/startup.c (setup_main): Remove call to `printf_init'.
-rw-r--r--kern/printf.c33
-rw-r--r--kern/printf.h2
-rw-r--r--kern/startup.c2
3 files changed, 0 insertions, 37 deletions
diff --git a/kern/printf.c b/kern/printf.c
index 13f2dc05..50f23623 100644
--- a/kern/printf.c
+++ b/kern/printf.c
@@ -151,21 +151,6 @@ void printnum(
boolean_t _doprnt_truncates = FALSE;
-/* printf could be called at _any_ point during system initialization,
- including before printf_init() gets called from the "normal" place
- in kern/startup.c. */
-boolean_t _doprnt_lock_initialized = FALSE;
-decl_simple_lock_data(,_doprnt_lock)
-
-void printf_init(void)
-{
- if (!_doprnt_lock_initialized)
- {
- _doprnt_lock_initialized = TRUE;
- simple_lock_init(&_doprnt_lock);
- }
-}
-
void _doprnt(
const char *fmt,
va_list argp,
@@ -187,22 +172,6 @@ void _doprnt(
int base;
char c;
- printf_init();
-
-#if 0
- /* Make sure that we get *some* printout, no matter what */
- simple_lock(&_doprnt_lock);
-#else
- {
- int i = 0;
- while (i < 1*1024*1024) {
- if (simple_lock_try(&_doprnt_lock))
- break;
- i++;
- }
- }
-#endif
-
while ((c = *fmt) != '\0') {
if (c != '%') {
(*putc)(c, putc_arg);
@@ -522,8 +491,6 @@ void _doprnt(
}
fmt++;
}
-
- simple_unlock(&_doprnt_lock);
}
/*
diff --git a/kern/printf.h b/kern/printf.h
index 76047f0b..b72640aa 100644
--- a/kern/printf.h
+++ b/kern/printf.h
@@ -27,8 +27,6 @@
#include <sys/types.h>
#include <stdarg.h>
-extern void printf_init (void);
-
extern void _doprnt (const char *fmt,
va_list argp,
void (*putc)(char, vm_offset_t),
diff --git a/kern/startup.c b/kern/startup.c
index f9f0c347..30cff5c0 100644
--- a/kern/startup.c
+++ b/kern/startup.c
@@ -39,7 +39,6 @@
#include <kern/machine.h>
#include <kern/mach_factor.h>
#include <kern/mach_clock.h>
-#include <kern/printf.h>
#include <kern/processor.h>
#include <kern/rdxtree.h>
#include <kern/sched_prim.h>
@@ -109,7 +108,6 @@ void setup_main(void)
#endif /* MACH_KDB */
panic_init();
- printf_init();
sched_init();
vm_mem_bootstrap();