From 92decc2ca41dd153be52ba3ed1dcb86cc69865b6 Mon Sep 17 00:00:00 2001 From: "Peter H. Froehlich" Date: Tue, 20 Oct 2015 11:54:30 -0400 Subject: [PATCH] Internal locking now disables interrupts. --- debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 -- 2.50.1