#ifndef _ASM_X86_PGTABLE_DEFS_H
#define _ASM_X86_PGTABLE_DEFS_H
#include <linux/const.h>
#include <linux/mem_encrypt.h>
#include <asm/page_types.h>
#define _PAGE_BIT_PRESENT …
#define _PAGE_BIT_RW …
#define _PAGE_BIT_USER …
#define _PAGE_BIT_PWT …
#define _PAGE_BIT_PCD …
#define _PAGE_BIT_ACCESSED …
#define _PAGE_BIT_DIRTY …
#define _PAGE_BIT_PSE …
#define _PAGE_BIT_PAT …
#define _PAGE_BIT_GLOBAL …
#define _PAGE_BIT_SOFTW1 …
#define _PAGE_BIT_SOFTW2 …
#define _PAGE_BIT_SOFTW3 …
#define _PAGE_BIT_PAT_LARGE …
#define _PAGE_BIT_SOFTW4 …
#define _PAGE_BIT_SOFTW5 …
#define _PAGE_BIT_PKEY_BIT0 …
#define _PAGE_BIT_PKEY_BIT1 …
#define _PAGE_BIT_PKEY_BIT2 …
#define _PAGE_BIT_PKEY_BIT3 …
#define _PAGE_BIT_NX …
#define _PAGE_BIT_SPECIAL …
#define _PAGE_BIT_CPA_TEST …
#define _PAGE_BIT_UFFD_WP …
#define _PAGE_BIT_SOFT_DIRTY …
#define _PAGE_BIT_DEVMAP …
#ifdef CONFIG_X86_64
#define _PAGE_BIT_SAVED_DIRTY …
#else
#define _PAGE_BIT_SAVED_DIRTY …
#endif
#define _PAGE_BIT_PROTNONE …
#define _PAGE_PRESENT …
#define _PAGE_RW …
#define _PAGE_USER …
#define _PAGE_PWT …
#define _PAGE_PCD …
#define _PAGE_ACCESSED …
#define _PAGE_DIRTY …
#define _PAGE_PSE …
#define _PAGE_GLOBAL …
#define _PAGE_SOFTW1 …
#define _PAGE_SOFTW2 …
#define _PAGE_SOFTW3 …
#define _PAGE_PAT …
#define _PAGE_PAT_LARGE …
#define _PAGE_SPECIAL …
#define _PAGE_CPA_TEST …
#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
#define _PAGE_PKEY_BIT0 …
#define _PAGE_PKEY_BIT1 …
#define _PAGE_PKEY_BIT2 …
#define _PAGE_PKEY_BIT3 …
#else
#define _PAGE_PKEY_BIT0 …
#define _PAGE_PKEY_BIT1 …
#define _PAGE_PKEY_BIT2 …
#define _PAGE_PKEY_BIT3 …
#endif
#define _PAGE_PKEY_MASK …
#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
#define _PAGE_KNL_ERRATUM_MASK …
#else
#define _PAGE_KNL_ERRATUM_MASK …
#endif
#ifdef CONFIG_MEM_SOFT_DIRTY
#define _PAGE_SOFT_DIRTY …
#else
#define _PAGE_SOFT_DIRTY …
#endif
#ifdef CONFIG_MEM_SOFT_DIRTY
#define _PAGE_SWP_SOFT_DIRTY …
#else
#define _PAGE_SWP_SOFT_DIRTY …
#endif
#ifdef CONFIG_HAVE_ARCH_USERFAULTFD_WP
#define _PAGE_UFFD_WP …
#define _PAGE_SWP_UFFD_WP …
#else
#define _PAGE_UFFD_WP …
#define _PAGE_SWP_UFFD_WP …
#endif
#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
#define _PAGE_NX …
#define _PAGE_DEVMAP …
#define _PAGE_SOFTW4 …
#else
#define _PAGE_NX …
#define _PAGE_DEVMAP …
#define _PAGE_SOFTW4 …
#endif
#define _PAGE_SAVED_DIRTY …
#define _PAGE_DIRTY_BITS …
#define _PAGE_PROTNONE …
#define _COMMON_PAGE_CHG_MASK …
#define _PAGE_CHG_MASK …
#define _HPAGE_CHG_MASK …
#ifndef __ASSEMBLY__
enum page_cache_mode { … };
#endif
#define _PAGE_CC …
#define _PAGE_ENC …
#define _PAGE_CACHE_MASK …
#define _PAGE_LARGE_CACHE_MASK …
#define _PAGE_NOCACHE …
#define _PAGE_CACHE_WP …
#define __PP …
#define __RW …
#define _USR …
#define ___A …
#define ___D …
#define ___G …
#define __NX …
#define _ENC …
#define __WP …
#define __NC …
#define _PSE …
#define pgprot_val(x) …
#define __pgprot(x) …
#define __pg(x) …
#define PAGE_NONE …
#define PAGE_SHARED …
#define PAGE_SHARED_EXEC …
#define PAGE_COPY_NOEXEC …
#define PAGE_COPY_EXEC …
#define PAGE_COPY …
#define PAGE_READONLY …
#define PAGE_READONLY_EXEC …
#define __PAGE_KERNEL …
#define __PAGE_KERNEL_EXEC …
#define _KERNPG_TABLE_NOENC …
#define _KERNPG_TABLE …
#define _PAGE_TABLE_NOENC …
#define _PAGE_TABLE …
#define __PAGE_KERNEL_RO …
#define __PAGE_KERNEL_ROX …
#define __PAGE_KERNEL …
#define __PAGE_KERNEL_EXEC …
#define __PAGE_KERNEL_NOCACHE …
#define __PAGE_KERNEL_VVAR …
#define __PAGE_KERNEL_LARGE …
#define __PAGE_KERNEL_LARGE_EXEC …
#define __PAGE_KERNEL_WP …
#define __PAGE_KERNEL_IO …
#define __PAGE_KERNEL_IO_NOCACHE …
#ifndef __ASSEMBLY__
#define __PAGE_KERNEL_ENC …
#define __PAGE_KERNEL_ENC_WP …
#define __PAGE_KERNEL_NOENC …
#define __PAGE_KERNEL_NOENC_WP …
#define __pgprot_mask(x) …
#define PAGE_KERNEL …
#define PAGE_KERNEL_NOENC …
#define PAGE_KERNEL_RO …
#define PAGE_KERNEL_EXEC …
#define PAGE_KERNEL_EXEC_NOENC …
#define PAGE_KERNEL_ROX …
#define PAGE_KERNEL_NOCACHE …
#define PAGE_KERNEL_LARGE …
#define PAGE_KERNEL_LARGE_EXEC …
#define PAGE_KERNEL_VVAR …
#define PAGE_KERNEL_IO …
#define PAGE_KERNEL_IO_NOCACHE …
#endif
#ifdef CONFIG_X86_64
#define __PAGE_KERNEL_IDENT_LARGE_EXEC …
#else
#define PTE_IDENT_ATTR …
#define PDE_IDENT_ATTR …
#define PGD_IDENT_ATTR …
#endif
#ifdef CONFIG_X86_32
# include <asm/pgtable_32_types.h>
#else
# include <asm/pgtable_64_types.h>
#endif
#ifndef __ASSEMBLY__
#include <linux/types.h>
#define PTE_PFN_MASK …
#define PTE_FLAGS_MASK …
pgprot_t;
pgd_t;
static inline pgprot_t pgprot_nx(pgprot_t prot)
{ … }
#define pgprot_nx …
#ifdef CONFIG_X86_PAE
#define PGD_PAE_PAGE_MASK …
#define PGD_PAE_PHYS_MASK …
#define PGD_ALLOWED_BITS …
#else
#define PGD_ALLOWED_BITS …
#endif
static inline pgd_t native_make_pgd(pgdval_t val)
{ … }
static inline pgdval_t native_pgd_val(pgd_t pgd)
{ … }
static inline pgdval_t pgd_flags(pgd_t pgd)
{ … }
#if CONFIG_PGTABLE_LEVELS > 4
p4d_t;
static inline p4d_t native_make_p4d(pudval_t val)
{ … }
static inline p4dval_t native_p4d_val(p4d_t p4d)
{ … }
#else
#include <asm-generic/pgtable-nop4d.h>
static inline p4d_t native_make_p4d(pudval_t val)
{
return (p4d_t) { .pgd = native_make_pgd((pgdval_t)val) };
}
static inline p4dval_t native_p4d_val(p4d_t p4d)
{
return native_pgd_val(p4d.pgd);
}
#endif
#if CONFIG_PGTABLE_LEVELS > 3
pud_t;
static inline pud_t native_make_pud(pmdval_t val)
{ … }
static inline pudval_t native_pud_val(pud_t pud)
{ … }
#else
#include <asm-generic/pgtable-nopud.h>
static inline pud_t native_make_pud(pudval_t val)
{
return (pud_t) { .p4d.pgd = native_make_pgd(val) };
}
static inline pudval_t native_pud_val(pud_t pud)
{
return native_pgd_val(pud.p4d.pgd);
}
#endif
#if CONFIG_PGTABLE_LEVELS > 2
static inline pmd_t native_make_pmd(pmdval_t val)
{ … }
static inline pmdval_t native_pmd_val(pmd_t pmd)
{ … }
#else
#include <asm-generic/pgtable-nopmd.h>
static inline pmd_t native_make_pmd(pmdval_t val)
{
return (pmd_t) { .pud.p4d.pgd = native_make_pgd(val) };
}
static inline pmdval_t native_pmd_val(pmd_t pmd)
{
return native_pgd_val(pmd.pud.p4d.pgd);
}
#endif
static inline p4dval_t p4d_pfn_mask(p4d_t p4d)
{ … }
static inline p4dval_t p4d_flags_mask(p4d_t p4d)
{ … }
static inline p4dval_t p4d_flags(p4d_t p4d)
{ … }
static inline pudval_t pud_pfn_mask(pud_t pud)
{ … }
static inline pudval_t pud_flags_mask(pud_t pud)
{ … }
static inline pudval_t pud_flags(pud_t pud)
{ … }
static inline pmdval_t pmd_pfn_mask(pmd_t pmd)
{ … }
static inline pmdval_t pmd_flags_mask(pmd_t pmd)
{ … }
static inline pmdval_t pmd_flags(pmd_t pmd)
{ … }
static inline pte_t native_make_pte(pteval_t val)
{ … }
static inline pteval_t native_pte_val(pte_t pte)
{ … }
static inline pteval_t pte_flags(pte_t pte)
{ … }
#define __pte2cm_idx(cb) …
#define __cm_idx2pte(i) …
unsigned long cachemode2protval(enum page_cache_mode pcm);
static inline pgprotval_t protval_4k_2_large(pgprotval_t val)
{ … }
static inline pgprot_t pgprot_4k_2_large(pgprot_t pgprot)
{ … }
static inline pgprotval_t protval_large_2_4k(pgprotval_t val)
{ … }
static inline pgprot_t pgprot_large_2_4k(pgprot_t pgprot)
{ … }
pgtable_t;
extern pteval_t __supported_pte_mask;
extern pteval_t __default_kernel_pte_mask;
#define pgprot_writecombine …
extern pgprot_t pgprot_writecombine(pgprot_t prot);
#define pgprot_writethrough …
extern pgprot_t pgprot_writethrough(pgprot_t prot);
#define __HAVE_PFNMAP_TRACKING
#define __HAVE_PHYS_MEM_ACCESS_PROT
struct file;
pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
unsigned long size, pgprot_t vma_prot);
void set_pte_vaddr(unsigned long vaddr, pte_t pte);
#ifdef CONFIG_X86_32
extern void native_pagetable_init(void);
#else
#define native_pagetable_init …
#endif
enum pg_level { … };
#ifdef CONFIG_PROC_FS
extern void update_page_count(int level, unsigned long pages);
#else
static inline void update_page_count(int level, unsigned long pages) { }
#endif
extern pte_t *lookup_address(unsigned long address, unsigned int *level);
extern pte_t *lookup_address_in_pgd(pgd_t *pgd, unsigned long address,
unsigned int *level);
pte_t *lookup_address_in_pgd_attr(pgd_t *pgd, unsigned long address,
unsigned int *level, bool *nx, bool *rw);
extern pmd_t *lookup_pmd_address(unsigned long address);
extern phys_addr_t slow_virt_to_phys(void *__address);
extern int __init kernel_map_pages_in_pgd(pgd_t *pgd, u64 pfn,
unsigned long address,
unsigned numpages,
unsigned long page_flags);
extern int __init kernel_unmap_pages_in_pgd(pgd_t *pgd, unsigned long address,
unsigned long numpages);
#endif
#endif