From: Peter H. Froehlich Date: Tue, 20 Oct 2015 15:54:30 +0000 (-0400) Subject: Internal locking now disables interrupts. X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=92decc2ca41dd153be52ba3ed1dcb86cc69865b6;p=xv6-public Internal locking now disables interrupts. --- diff --git a/debug.c b/debug.c index d62c5f1..20fe2d3 100644 --- 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