Merge tag 'vmwgfx-fixes-3.14-2014-02-05' of git://people.freedesktop.org/~thomash...
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / x86 / boot / cpuflags.c
index a9fcb7c..431fa5f 100644 (file)
@@ -28,20 +28,35 @@ static int has_fpu(void)
        return fsw == 0 && (fcw & 0x103f) == 0x003f;
 }
 
+/*
+ * For building the 16-bit code we want to explicitly specify 32-bit
+ * push/pop operations, rather than just saying 'pushf' or 'popf' and
+ * letting the compiler choose. But this is also included from the
+ * compressed/ directory where it may be 64-bit code, and thus needs
+ * to be 'pushfq' or 'popfq' in that case.
+ */
+#ifdef __x86_64__
+#define PUSHF "pushfq"
+#define POPF "popfq"
+#else
+#define PUSHF "pushfl"
+#define POPF "popfl"
+#endif
+
 int has_eflag(unsigned long mask)
 {
        unsigned long f0, f1;
 
-       asm volatile("pushf     \n\t"
-                    "pushf     \n\t"
+       asm volatile(PUSHF "    \n\t"
+                    PUSHF "    \n\t"
                     "pop %0    \n\t"
                     "mov %0,%1 \n\t"
                     "xor %2,%1 \n\t"
                     "push %1   \n\t"
-                    "popf      \n\t"
-                    "pushf     \n\t"
+                    POPF "     \n\t"
+                    PUSHF "    \n\t"
                     "pop %1    \n\t"
-                    "popf"
+                    POPF
                     : "=&r" (f0), "=&r" (f1)
                     : "ri" (mask));