]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/asm-i386/system.h
[PATCH] x86: Cr4 is valid on some 486s
[net-next-2.6.git] / include / asm-i386 / system.h
index 772f85da1206af441de3d5df59892921931a8b51..88b4d5c6f37a76367b5bf3b4b51e98a04d3f5752 100644 (file)
@@ -140,6 +140,19 @@ static inline unsigned long _get_base(char * addr)
                :"=r" (__dummy)); \
        __dummy; \
 })
+
+#define read_cr4_safe() ({                           \
+       unsigned int __dummy;                         \
+       /* This could fault if %cr4 does not exist */ \
+       __asm__("1: movl %%cr4, %0              \n"   \
+               "2:                             \n"   \
+               ".section __ex_table,\"a\"      \n"   \
+               ".long 1b,2b                    \n"   \
+               ".previous                      \n"   \
+               : "=r" (__dummy): "0" (0));           \
+       __dummy;                                      \
+})
+
 #define write_cr4(x) \
        __asm__ __volatile__("movl %0,%%cr4": :"r" (x));
 #define stts() write_cr0(8 | read_cr0())