From: Ben Pfaff Date: Sun, 10 Oct 2004 23:56:14 +0000 (+0000) Subject: Add volatile to asm statement in intr_get_level(), X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07af4666a5d90db8500abacfe73d6fc2aeb6a7b7;p=pintos-anon Add volatile to asm statement in intr_get_level(), otherwise GCC will assume that two calls to this function can be optimized into one, even across asm("sti") or asm("cli"). --- diff --git a/src/threads/interrupt.c b/src/threads/interrupt.c index 8e7d575..3637b00 100644 --- a/src/threads/interrupt.c +++ b/src/threads/interrupt.c @@ -51,7 +51,7 @@ intr_get_level (void) { uint32_t flags; - asm ("pushfl; popl %0" : "=g" (flags)); + asm volatile ("pushfl; popl %0" : "=g" (flags)); return flags & FLAG_IF ? INTR_ON : INTR_OFF; }