]> hydra-www.ietfng.org Git - xv6-public/commitdiff
Internal locking now disables interrupts.
authorPeter H. Froehlich <peter.hans.froehlich@gmail.com>
Tue, 20 Oct 2015 15:54:30 +0000 (11:54 -0400)
committerPeter H. Froehlich <peter.hans.froehlich@gmail.com>
Tue, 20 Oct 2015 15:54:30 +0000 (11:54 -0400)
debug.c

diff --git a/debug.c b/debug.c
index d62c5f180aa3324a0b0c4f224b90a34b1a61409a..20fe2d3ed8514d914b6e3ef346b5da291b5ecd52 100644 (file)
--- a/debug.c
+++ b/debug.c
@@ -4,8 +4,7 @@
 //
 // We want to allow debug output as early as possible and from anywhere,
 // including the spinlock code. This requires a custom lock to make sure
-// output is complete and consistent. Our custom lock cannot possibly be
-// acquired from an interrupt context so it doesn't disable interrupts.
+// output is complete and consistent.
 
 #include "types.h"
 #include "defs.h"
@@ -18,6 +17,7 @@ static volatile uint locked;  // custom lock
 static void
 lock(void)
 {
+  pushcli();
   while(xchg(&locked, 1) != 0)
     ;
 }
@@ -26,6 +26,7 @@ static void
 unlock(void)
 {
   xchg(&locked, 0);
+  popcli();
 }
 
 static int