x86/mm/pkeys: Add functions to fetch PKRU
[cascardo/linux.git] / arch / x86 / include / asm / pgtable.h
index 0687c47..e997dcc 100644 (file)
@@ -99,6 +99,14 @@ static inline int pte_dirty(pte_t pte)
        return pte_flags(pte) & _PAGE_DIRTY;
 }
 
+
+static inline u32 read_pkru(void)
+{
+       if (boot_cpu_has(X86_FEATURE_OSPKE))
+               return __read_pkru();
+       return 0;
+}
+
 static inline int pte_young(pte_t pte)
 {
        return pte_flags(pte) & _PAGE_ACCESSED;