diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 2004-06-13 21:49:30 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 2004-06-13 21:49:30 +0000 |
commit | 2dd254afa61a7c0cc5ae920b463d3d4266852804 (patch) | |
tree | 7adbebef3be24ba910fd83ee1ba09e1577ae21a8 /sys/kern/subr_prf.c | |
parent | 4d62e331dcde739b4067d712dd602c0927ce11b3 (diff) |
debranch SMP, have fun
Diffstat (limited to 'sys/kern/subr_prf.c')
-rw-r--r-- | sys/kern/subr_prf.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 906ce028770..a843c2f1dc2 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_prf.c,v 1.58 2004/01/03 14:08:53 espie Exp $ */ +/* $OpenBSD: subr_prf.c,v 1.59 2004/06/13 21:49:26 niklas Exp $ */ /* $NetBSD: subr_prf.c,v 1.45 1997/10/24 18:14:25 chuck Exp $ */ /*- @@ -47,6 +47,7 @@ #include <sys/ioctl.h> #include <sys/vnode.h> #include <sys/file.h> +#include <sys/simplelock.h> #include <sys/tty.h> #include <sys/tprintf.h> #include <sys/syslog.h> @@ -97,6 +98,50 @@ extern int uvm_doswapencrypt; int kprintf(const char *, int, void *, char *, va_list); void kputchar(int, int, struct tty *); +#ifdef MULTIPROCESSOR + +#ifdef notdef + +struct simplelock kprintf_slock; + +#define KPRINTF_MUTEX_ENTER(s) \ +do { \ + (s) = splhigh(); \ + simple_lock(&kprintf_slock); \ +} while (/*CONSTCOND*/0) + +#define KPRINTF_MUTEX_EXIT(s) \ +do { \ + simple_unlock(&kprintf_slock); \ + splx((s)); \ +} while (/*CONSTCOND*/0) + +#else + +struct __mp_lock kprintf_slock; + +#define KPRINTF_MUTEX_ENTER(s) \ +do { \ + (s) = splhigh(); \ + __mp_lock(&kprintf_slock); \ +} while (/*CONSTCOND*/0) + +#define KPRINTF_MUTEX_EXIT(s) \ +do { \ + __mp_unlock(&kprintf_slock); \ + splx((s)); \ +} while (/*CONSTCOND*/0) + +#endif + +#else + +struct simplelock kprintf_slock; +#define KPRINTF_MUTEX_ENTER(s) (s) = splhigh() +#define KPRINTF_MUTEX_EXIT(s) splx((s)) + +#endif /* MULTIPROCESSOR */ + /* * globals */ @@ -506,6 +551,9 @@ printf(const char *fmt, ...) { va_list ap; int savintr, retval; + int s; + + KPRINTF_MUTEX_ENTER(s); savintr = consintr; /* disable interrupts */ consintr = 0; @@ -515,6 +563,9 @@ printf(const char *fmt, ...) if (!panicstr) logwakeup(); consintr = savintr; /* reenable interrupts */ + + KPRINTF_MUTEX_EXIT(s); + return(retval); } |