Add volatile to asm statement in intr_get_level(),
[pintos-anon] / src / threads / interrupt.c
index fca145e10b96244cd8ee2872f76f46c432528854..3637b0013edd9c92f347f23f60e230ec00efcfbc 100644 (file)
@@ -3,6 +3,7 @@
 #include <inttypes.h>
 #include <stdint.h>
 #include <stdio.h>
+#include "threads/flags.h"
 #include "threads/intr-stubs.h"
 #include "threads/io.h"
 #include "threads/mmu.h"
@@ -50,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;
 }