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=e80b8a193eb5fcafc08dfab7a9c2ef274a274eca;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; }