summaryrefslogtreecommitdiff
path: root/kern/printk.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2012-11-17 20:37:24 +0100
committerRichard Braun <rbraun@sceen.net>2012-11-17 20:49:31 +0100
commit3119195c519d1289362b9530785709b6a398590e (patch)
tree5999970edc8ad172dbeb88734e72feba8bb2b576 /kern/printk.c
parent19d64b4177f7720c6e2aab520436af14db0ffa54 (diff)
kern/spinlock: don't disable interrupts
Let the users deal with interrupts themselves. It allows greater freedom to modules that need to carefully change the machine state.
Diffstat (limited to 'kern/printk.c')
-rw-r--r--kern/printk.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/kern/printk.c b/kern/printk.c
index 386ac979..6ea8bd35 100644
--- a/kern/printk.c
+++ b/kern/printk.c
@@ -18,6 +18,7 @@
#include <kern/printk.h>
#include <kern/spinlock.h>
#include <kern/sprintf.h>
+#include <machine/cpu.h>
/*
* Size of the static buffer.
@@ -52,14 +53,16 @@ vprintk(const char *format, va_list ap)
int length;
char *ptr;
- flags = spinlock_lock(&printk_lock);
+ flags = cpu_intr_save();
+ spinlock_lock(&printk_lock);
length = vsnprintf(printk_buffer, sizeof(printk_buffer), format, ap);
for (ptr = printk_buffer; *ptr != '\0'; ptr++)
console_write_byte(*ptr);
- spinlock_unlock(&printk_lock, flags);
+ spinlock_unlock(&printk_lock);
+ cpu_intr_restore(flags);
return length;
}