x86: define pud_flags and pud_large properly to allow non-PAE builds
diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h
index c41e3e8..0733853 100644
--- a/arch/x86/include/asm/page_types.h
+++ b/arch/x86/include/asm/page_types.h
@@ -90,11 +90,6 @@
 #if PAGETABLE_LEVELS > 2
 typedef struct { pmdval_t pmd; } pmd_t;
 
-static inline pudval_t pud_flags(pud_t pud)
-{
-	return native_pud_val(pud) & PTE_FLAGS_MASK;
-}
-
 static inline pmd_t native_make_pmd(pmdval_t val)
 {
 	return (pmd_t) { val };
@@ -113,6 +108,11 @@
 }
 #endif
 
+static inline pudval_t pud_flags(pud_t pud)
+{
+	return native_pud_val(pud) & PTE_FLAGS_MASK;
+}
+
 static inline pmdval_t pmd_flags(pmd_t pmd)
 {
 	return native_pmd_val(pmd) & PTE_FLAGS_MASK;
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 10404e7..9f50850 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -398,7 +398,7 @@
 
 static inline int pud_large(pud_t pud)
 {
-	return (pud_flags(pud) & (_PAGE_PSE | _PAGE_PRESENT)) ==
+	return (pud_val(pud) & (_PAGE_PSE | _PAGE_PRESENT)) ==
 		(_PAGE_PSE | _PAGE_PRESENT);
 }
 
@@ -406,6 +406,11 @@
 {
 	return (pud_flags(pud) & ~(_KERNPG_TABLE | _PAGE_USER)) != 0;
 }
+#else
+static inline int pud_large(pud_t pud)
+{
+	return 0;
+}
 #endif	/* PAGETABLE_LEVELS > 2 */
 
 #if PAGETABLE_LEVELS > 3