treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / x86 / include / asm / pgtable.h
blob7e118660bbd9840538ab26f90e9a3fe3d768b8e4
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_PGTABLE_H
3 #define _ASM_X86_PGTABLE_H
5 #include <linux/mem_encrypt.h>
6 #include <asm/page.h>
7 #include <asm/pgtable_types.h>
9 /*
10 * Macro to mark a page protection value as UC-
12 #define pgprot_noncached(prot) \
13 ((boot_cpu_data.x86 > 3) \
14 ? (__pgprot(pgprot_val(prot) | \
15 cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS))) \
16 : (prot))
19 * Macros to add or remove encryption attribute
21 #define pgprot_encrypted(prot) __pgprot(__sme_set(pgprot_val(prot)))
22 #define pgprot_decrypted(prot) __pgprot(__sme_clr(pgprot_val(prot)))
24 #ifndef __ASSEMBLY__
25 #include <asm/x86_init.h>
26 #include <asm/fpu/xstate.h>
27 #include <asm/fpu/api.h>
29 extern pgd_t early_top_pgt[PTRS_PER_PGD];
30 int __init __early_make_pgtable(unsigned long address, pmdval_t pmd);
32 void ptdump_walk_pgd_level(struct seq_file *m, struct mm_struct *mm);
33 void ptdump_walk_pgd_level_debugfs(struct seq_file *m, struct mm_struct *mm,
34 bool user);
35 void ptdump_walk_pgd_level_checkwx(void);
36 void ptdump_walk_user_pgd_level_checkwx(void);
38 #ifdef CONFIG_DEBUG_WX
39 #define debug_checkwx() ptdump_walk_pgd_level_checkwx()
40 #define debug_checkwx_user() ptdump_walk_user_pgd_level_checkwx()
41 #else
42 #define debug_checkwx() do { } while (0)
43 #define debug_checkwx_user() do { } while (0)
44 #endif
47 * ZERO_PAGE is a global shared page that is always zero: used
48 * for zero-mapped memory areas etc..
50 extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]
51 __visible;
52 #define ZERO_PAGE(vaddr) ((void)(vaddr),virt_to_page(empty_zero_page))
54 extern spinlock_t pgd_lock;
55 extern struct list_head pgd_list;
57 extern struct mm_struct *pgd_page_get_mm(struct page *page);
59 extern pmdval_t early_pmd_flags;
61 #ifdef CONFIG_PARAVIRT_XXL
62 #include <asm/paravirt.h>
63 #else /* !CONFIG_PARAVIRT_XXL */
64 #define set_pte(ptep, pte) native_set_pte(ptep, pte)
65 #define set_pte_at(mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte)
67 #define set_pte_atomic(ptep, pte) \
68 native_set_pte_atomic(ptep, pte)
70 #define set_pmd(pmdp, pmd) native_set_pmd(pmdp, pmd)
72 #ifndef __PAGETABLE_P4D_FOLDED
73 #define set_pgd(pgdp, pgd) native_set_pgd(pgdp, pgd)
74 #define pgd_clear(pgd) (pgtable_l5_enabled() ? native_pgd_clear(pgd) : 0)
75 #endif
77 #ifndef set_p4d
78 # define set_p4d(p4dp, p4d) native_set_p4d(p4dp, p4d)
79 #endif
81 #ifndef __PAGETABLE_PUD_FOLDED
82 #define p4d_clear(p4d) native_p4d_clear(p4d)
83 #endif
85 #ifndef set_pud
86 # define set_pud(pudp, pud) native_set_pud(pudp, pud)
87 #endif
89 #ifndef __PAGETABLE_PUD_FOLDED
90 #define pud_clear(pud) native_pud_clear(pud)
91 #endif
93 #define pte_clear(mm, addr, ptep) native_pte_clear(mm, addr, ptep)
94 #define pmd_clear(pmd) native_pmd_clear(pmd)
96 #define pgd_val(x) native_pgd_val(x)
97 #define __pgd(x) native_make_pgd(x)
99 #ifndef __PAGETABLE_P4D_FOLDED
100 #define p4d_val(x) native_p4d_val(x)
101 #define __p4d(x) native_make_p4d(x)
102 #endif
104 #ifndef __PAGETABLE_PUD_FOLDED
105 #define pud_val(x) native_pud_val(x)
106 #define __pud(x) native_make_pud(x)
107 #endif
109 #ifndef __PAGETABLE_PMD_FOLDED
110 #define pmd_val(x) native_pmd_val(x)
111 #define __pmd(x) native_make_pmd(x)
112 #endif
114 #define pte_val(x) native_pte_val(x)
115 #define __pte(x) native_make_pte(x)
117 #define arch_end_context_switch(prev) do {} while(0)
118 #endif /* CONFIG_PARAVIRT_XXL */
121 * The following only work if pte_present() is true.
122 * Undefined behaviour if not..
124 static inline int pte_dirty(pte_t pte)
126 return pte_flags(pte) & _PAGE_DIRTY;
130 static inline u32 read_pkru(void)
132 if (boot_cpu_has(X86_FEATURE_OSPKE))
133 return rdpkru();
134 return 0;
137 static inline void write_pkru(u32 pkru)
139 struct pkru_state *pk;
141 if (!boot_cpu_has(X86_FEATURE_OSPKE))
142 return;
144 pk = get_xsave_addr(&current->thread.fpu.state.xsave, XFEATURE_PKRU);
147 * The PKRU value in xstate needs to be in sync with the value that is
148 * written to the CPU. The FPU restore on return to userland would
149 * otherwise load the previous value again.
151 fpregs_lock();
152 if (pk)
153 pk->pkru = pkru;
154 __write_pkru(pkru);
155 fpregs_unlock();
158 static inline int pte_young(pte_t pte)
160 return pte_flags(pte) & _PAGE_ACCESSED;
163 static inline int pmd_dirty(pmd_t pmd)
165 return pmd_flags(pmd) & _PAGE_DIRTY;
168 static inline int pmd_young(pmd_t pmd)
170 return pmd_flags(pmd) & _PAGE_ACCESSED;
173 static inline int pud_dirty(pud_t pud)
175 return pud_flags(pud) & _PAGE_DIRTY;
178 static inline int pud_young(pud_t pud)
180 return pud_flags(pud) & _PAGE_ACCESSED;
183 static inline int pte_write(pte_t pte)
185 return pte_flags(pte) & _PAGE_RW;
188 static inline int pte_huge(pte_t pte)
190 return pte_flags(pte) & _PAGE_PSE;
193 static inline int pte_global(pte_t pte)
195 return pte_flags(pte) & _PAGE_GLOBAL;
198 static inline int pte_exec(pte_t pte)
200 return !(pte_flags(pte) & _PAGE_NX);
203 static inline int pte_special(pte_t pte)
205 return pte_flags(pte) & _PAGE_SPECIAL;
208 /* Entries that were set to PROT_NONE are inverted */
210 static inline u64 protnone_mask(u64 val);
212 static inline unsigned long pte_pfn(pte_t pte)
214 phys_addr_t pfn = pte_val(pte);
215 pfn ^= protnone_mask(pfn);
216 return (pfn & PTE_PFN_MASK) >> PAGE_SHIFT;
219 static inline unsigned long pmd_pfn(pmd_t pmd)
221 phys_addr_t pfn = pmd_val(pmd);
222 pfn ^= protnone_mask(pfn);
223 return (pfn & pmd_pfn_mask(pmd)) >> PAGE_SHIFT;
226 static inline unsigned long pud_pfn(pud_t pud)
228 phys_addr_t pfn = pud_val(pud);
229 pfn ^= protnone_mask(pfn);
230 return (pfn & pud_pfn_mask(pud)) >> PAGE_SHIFT;
233 static inline unsigned long p4d_pfn(p4d_t p4d)
235 return (p4d_val(p4d) & p4d_pfn_mask(p4d)) >> PAGE_SHIFT;
238 static inline unsigned long pgd_pfn(pgd_t pgd)
240 return (pgd_val(pgd) & PTE_PFN_MASK) >> PAGE_SHIFT;
243 #define p4d_leaf p4d_large
244 static inline int p4d_large(p4d_t p4d)
246 /* No 512 GiB pages yet */
247 return 0;
250 #define pte_page(pte) pfn_to_page(pte_pfn(pte))
252 #define pmd_leaf pmd_large
253 static inline int pmd_large(pmd_t pte)
255 return pmd_flags(pte) & _PAGE_PSE;
258 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
259 static inline int pmd_trans_huge(pmd_t pmd)
261 return (pmd_val(pmd) & (_PAGE_PSE|_PAGE_DEVMAP)) == _PAGE_PSE;
264 #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
265 static inline int pud_trans_huge(pud_t pud)
267 return (pud_val(pud) & (_PAGE_PSE|_PAGE_DEVMAP)) == _PAGE_PSE;
269 #endif
271 #define has_transparent_hugepage has_transparent_hugepage
272 static inline int has_transparent_hugepage(void)
274 return boot_cpu_has(X86_FEATURE_PSE);
277 #ifdef CONFIG_ARCH_HAS_PTE_DEVMAP
278 static inline int pmd_devmap(pmd_t pmd)
280 return !!(pmd_val(pmd) & _PAGE_DEVMAP);
283 #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
284 static inline int pud_devmap(pud_t pud)
286 return !!(pud_val(pud) & _PAGE_DEVMAP);
288 #else
289 static inline int pud_devmap(pud_t pud)
291 return 0;
293 #endif
295 static inline int pgd_devmap(pgd_t pgd)
297 return 0;
299 #endif
300 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
302 static inline pte_t pte_set_flags(pte_t pte, pteval_t set)
304 pteval_t v = native_pte_val(pte);
306 return native_make_pte(v | set);
309 static inline pte_t pte_clear_flags(pte_t pte, pteval_t clear)
311 pteval_t v = native_pte_val(pte);
313 return native_make_pte(v & ~clear);
316 static inline pte_t pte_mkclean(pte_t pte)
318 return pte_clear_flags(pte, _PAGE_DIRTY);
321 static inline pte_t pte_mkold(pte_t pte)
323 return pte_clear_flags(pte, _PAGE_ACCESSED);
326 static inline pte_t pte_wrprotect(pte_t pte)
328 return pte_clear_flags(pte, _PAGE_RW);
331 static inline pte_t pte_mkexec(pte_t pte)
333 return pte_clear_flags(pte, _PAGE_NX);
336 static inline pte_t pte_mkdirty(pte_t pte)
338 return pte_set_flags(pte, _PAGE_DIRTY | _PAGE_SOFT_DIRTY);
341 static inline pte_t pte_mkyoung(pte_t pte)
343 return pte_set_flags(pte, _PAGE_ACCESSED);
346 static inline pte_t pte_mkwrite(pte_t pte)
348 return pte_set_flags(pte, _PAGE_RW);
351 static inline pte_t pte_mkhuge(pte_t pte)
353 return pte_set_flags(pte, _PAGE_PSE);
356 static inline pte_t pte_clrhuge(pte_t pte)
358 return pte_clear_flags(pte, _PAGE_PSE);
361 static inline pte_t pte_mkglobal(pte_t pte)
363 return pte_set_flags(pte, _PAGE_GLOBAL);
366 static inline pte_t pte_clrglobal(pte_t pte)
368 return pte_clear_flags(pte, _PAGE_GLOBAL);
371 static inline pte_t pte_mkspecial(pte_t pte)
373 return pte_set_flags(pte, _PAGE_SPECIAL);
376 static inline pte_t pte_mkdevmap(pte_t pte)
378 return pte_set_flags(pte, _PAGE_SPECIAL|_PAGE_DEVMAP);
381 static inline pmd_t pmd_set_flags(pmd_t pmd, pmdval_t set)
383 pmdval_t v = native_pmd_val(pmd);
385 return native_make_pmd(v | set);
388 static inline pmd_t pmd_clear_flags(pmd_t pmd, pmdval_t clear)
390 pmdval_t v = native_pmd_val(pmd);
392 return native_make_pmd(v & ~clear);
395 static inline pmd_t pmd_mkold(pmd_t pmd)
397 return pmd_clear_flags(pmd, _PAGE_ACCESSED);
400 static inline pmd_t pmd_mkclean(pmd_t pmd)
402 return pmd_clear_flags(pmd, _PAGE_DIRTY);
405 static inline pmd_t pmd_wrprotect(pmd_t pmd)
407 return pmd_clear_flags(pmd, _PAGE_RW);
410 static inline pmd_t pmd_mkdirty(pmd_t pmd)
412 return pmd_set_flags(pmd, _PAGE_DIRTY | _PAGE_SOFT_DIRTY);
415 static inline pmd_t pmd_mkdevmap(pmd_t pmd)
417 return pmd_set_flags(pmd, _PAGE_DEVMAP);
420 static inline pmd_t pmd_mkhuge(pmd_t pmd)
422 return pmd_set_flags(pmd, _PAGE_PSE);
425 static inline pmd_t pmd_mkyoung(pmd_t pmd)
427 return pmd_set_flags(pmd, _PAGE_ACCESSED);
430 static inline pmd_t pmd_mkwrite(pmd_t pmd)
432 return pmd_set_flags(pmd, _PAGE_RW);
435 static inline pud_t pud_set_flags(pud_t pud, pudval_t set)
437 pudval_t v = native_pud_val(pud);
439 return native_make_pud(v | set);
442 static inline pud_t pud_clear_flags(pud_t pud, pudval_t clear)
444 pudval_t v = native_pud_val(pud);
446 return native_make_pud(v & ~clear);
449 static inline pud_t pud_mkold(pud_t pud)
451 return pud_clear_flags(pud, _PAGE_ACCESSED);
454 static inline pud_t pud_mkclean(pud_t pud)
456 return pud_clear_flags(pud, _PAGE_DIRTY);
459 static inline pud_t pud_wrprotect(pud_t pud)
461 return pud_clear_flags(pud, _PAGE_RW);
464 static inline pud_t pud_mkdirty(pud_t pud)
466 return pud_set_flags(pud, _PAGE_DIRTY | _PAGE_SOFT_DIRTY);
469 static inline pud_t pud_mkdevmap(pud_t pud)
471 return pud_set_flags(pud, _PAGE_DEVMAP);
474 static inline pud_t pud_mkhuge(pud_t pud)
476 return pud_set_flags(pud, _PAGE_PSE);
479 static inline pud_t pud_mkyoung(pud_t pud)
481 return pud_set_flags(pud, _PAGE_ACCESSED);
484 static inline pud_t pud_mkwrite(pud_t pud)
486 return pud_set_flags(pud, _PAGE_RW);
489 #ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY
490 static inline int pte_soft_dirty(pte_t pte)
492 return pte_flags(pte) & _PAGE_SOFT_DIRTY;
495 static inline int pmd_soft_dirty(pmd_t pmd)
497 return pmd_flags(pmd) & _PAGE_SOFT_DIRTY;
500 static inline int pud_soft_dirty(pud_t pud)
502 return pud_flags(pud) & _PAGE_SOFT_DIRTY;
505 static inline pte_t pte_mksoft_dirty(pte_t pte)
507 return pte_set_flags(pte, _PAGE_SOFT_DIRTY);
510 static inline pmd_t pmd_mksoft_dirty(pmd_t pmd)
512 return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY);
515 static inline pud_t pud_mksoft_dirty(pud_t pud)
517 return pud_set_flags(pud, _PAGE_SOFT_DIRTY);
520 static inline pte_t pte_clear_soft_dirty(pte_t pte)
522 return pte_clear_flags(pte, _PAGE_SOFT_DIRTY);
525 static inline pmd_t pmd_clear_soft_dirty(pmd_t pmd)
527 return pmd_clear_flags(pmd, _PAGE_SOFT_DIRTY);
530 static inline pud_t pud_clear_soft_dirty(pud_t pud)
532 return pud_clear_flags(pud, _PAGE_SOFT_DIRTY);
535 #endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */
538 * Mask out unsupported bits in a present pgprot. Non-present pgprots
539 * can use those bits for other purposes, so leave them be.
541 static inline pgprotval_t massage_pgprot(pgprot_t pgprot)
543 pgprotval_t protval = pgprot_val(pgprot);
545 if (protval & _PAGE_PRESENT)
546 protval &= __supported_pte_mask;
548 return protval;
551 static inline pgprotval_t check_pgprot(pgprot_t pgprot)
553 pgprotval_t massaged_val = massage_pgprot(pgprot);
555 /* mmdebug.h can not be included here because of dependencies */
556 #ifdef CONFIG_DEBUG_VM
557 WARN_ONCE(pgprot_val(pgprot) != massaged_val,
558 "attempted to set unsupported pgprot: %016llx "
559 "bits: %016llx supported: %016llx\n",
560 (u64)pgprot_val(pgprot),
561 (u64)pgprot_val(pgprot) ^ massaged_val,
562 (u64)__supported_pte_mask);
563 #endif
565 return massaged_val;
568 static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
570 phys_addr_t pfn = (phys_addr_t)page_nr << PAGE_SHIFT;
571 pfn ^= protnone_mask(pgprot_val(pgprot));
572 pfn &= PTE_PFN_MASK;
573 return __pte(pfn | check_pgprot(pgprot));
576 static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
578 phys_addr_t pfn = (phys_addr_t)page_nr << PAGE_SHIFT;
579 pfn ^= protnone_mask(pgprot_val(pgprot));
580 pfn &= PHYSICAL_PMD_PAGE_MASK;
581 return __pmd(pfn | check_pgprot(pgprot));
584 static inline pud_t pfn_pud(unsigned long page_nr, pgprot_t pgprot)
586 phys_addr_t pfn = (phys_addr_t)page_nr << PAGE_SHIFT;
587 pfn ^= protnone_mask(pgprot_val(pgprot));
588 pfn &= PHYSICAL_PUD_PAGE_MASK;
589 return __pud(pfn | check_pgprot(pgprot));
592 static inline pmd_t pmd_mknotpresent(pmd_t pmd)
594 return pfn_pmd(pmd_pfn(pmd),
595 __pgprot(pmd_flags(pmd) & ~(_PAGE_PRESENT|_PAGE_PROTNONE)));
598 static inline pud_t pud_mknotpresent(pud_t pud)
600 return pfn_pud(pud_pfn(pud),
601 __pgprot(pud_flags(pud) & ~(_PAGE_PRESENT|_PAGE_PROTNONE)));
604 static inline u64 flip_protnone_guard(u64 oldval, u64 val, u64 mask);
606 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
608 pteval_t val = pte_val(pte), oldval = val;
611 * Chop off the NX bit (if present), and add the NX portion of
612 * the newprot (if present):
614 val &= _PAGE_CHG_MASK;
615 val |= check_pgprot(newprot) & ~_PAGE_CHG_MASK;
616 val = flip_protnone_guard(oldval, val, PTE_PFN_MASK);
617 return __pte(val);
620 static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
622 pmdval_t val = pmd_val(pmd), oldval = val;
624 val &= _HPAGE_CHG_MASK;
625 val |= check_pgprot(newprot) & ~_HPAGE_CHG_MASK;
626 val = flip_protnone_guard(oldval, val, PHYSICAL_PMD_PAGE_MASK);
627 return __pmd(val);
630 /* mprotect needs to preserve PAT bits when updating vm_page_prot */
631 #define pgprot_modify pgprot_modify
632 static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
634 pgprotval_t preservebits = pgprot_val(oldprot) & _PAGE_CHG_MASK;
635 pgprotval_t addbits = pgprot_val(newprot);
636 return __pgprot(preservebits | addbits);
639 #define pte_pgprot(x) __pgprot(pte_flags(x))
640 #define pmd_pgprot(x) __pgprot(pmd_flags(x))
641 #define pud_pgprot(x) __pgprot(pud_flags(x))
642 #define p4d_pgprot(x) __pgprot(p4d_flags(x))
644 #define canon_pgprot(p) __pgprot(massage_pgprot(p))
646 static inline pgprot_t arch_filter_pgprot(pgprot_t prot)
648 return canon_pgprot(prot);
651 static inline int is_new_memtype_allowed(u64 paddr, unsigned long size,
652 enum page_cache_mode pcm,
653 enum page_cache_mode new_pcm)
656 * PAT type is always WB for untracked ranges, so no need to check.
658 if (x86_platform.is_untracked_pat_range(paddr, paddr + size))
659 return 1;
662 * Certain new memtypes are not allowed with certain
663 * requested memtype:
664 * - request is uncached, return cannot be write-back
665 * - request is write-combine, return cannot be write-back
666 * - request is write-through, return cannot be write-back
667 * - request is write-through, return cannot be write-combine
669 if ((pcm == _PAGE_CACHE_MODE_UC_MINUS &&
670 new_pcm == _PAGE_CACHE_MODE_WB) ||
671 (pcm == _PAGE_CACHE_MODE_WC &&
672 new_pcm == _PAGE_CACHE_MODE_WB) ||
673 (pcm == _PAGE_CACHE_MODE_WT &&
674 new_pcm == _PAGE_CACHE_MODE_WB) ||
675 (pcm == _PAGE_CACHE_MODE_WT &&
676 new_pcm == _PAGE_CACHE_MODE_WC)) {
677 return 0;
680 return 1;
683 pmd_t *populate_extra_pmd(unsigned long vaddr);
684 pte_t *populate_extra_pte(unsigned long vaddr);
686 #ifdef CONFIG_PAGE_TABLE_ISOLATION
687 pgd_t __pti_set_user_pgtbl(pgd_t *pgdp, pgd_t pgd);
690 * Take a PGD location (pgdp) and a pgd value that needs to be set there.
691 * Populates the user and returns the resulting PGD that must be set in
692 * the kernel copy of the page tables.
694 static inline pgd_t pti_set_user_pgtbl(pgd_t *pgdp, pgd_t pgd)
696 if (!static_cpu_has(X86_FEATURE_PTI))
697 return pgd;
698 return __pti_set_user_pgtbl(pgdp, pgd);
700 #else /* CONFIG_PAGE_TABLE_ISOLATION */
701 static inline pgd_t pti_set_user_pgtbl(pgd_t *pgdp, pgd_t pgd)
703 return pgd;
705 #endif /* CONFIG_PAGE_TABLE_ISOLATION */
707 #endif /* __ASSEMBLY__ */
710 #ifdef CONFIG_X86_32
711 # include <asm/pgtable_32.h>
712 #else
713 # include <asm/pgtable_64.h>
714 #endif
716 #ifndef __ASSEMBLY__
717 #include <linux/mm_types.h>
718 #include <linux/mmdebug.h>
719 #include <linux/log2.h>
720 #include <asm/fixmap.h>
722 static inline int pte_none(pte_t pte)
724 return !(pte.pte & ~(_PAGE_KNL_ERRATUM_MASK));
727 #define __HAVE_ARCH_PTE_SAME
728 static inline int pte_same(pte_t a, pte_t b)
730 return a.pte == b.pte;
733 static inline int pte_present(pte_t a)
735 return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE);
738 #ifdef CONFIG_ARCH_HAS_PTE_DEVMAP
739 static inline int pte_devmap(pte_t a)
741 return (pte_flags(a) & _PAGE_DEVMAP) == _PAGE_DEVMAP;
743 #endif
745 #define pte_accessible pte_accessible
746 static inline bool pte_accessible(struct mm_struct *mm, pte_t a)
748 if (pte_flags(a) & _PAGE_PRESENT)
749 return true;
751 if ((pte_flags(a) & _PAGE_PROTNONE) &&
752 mm_tlb_flush_pending(mm))
753 return true;
755 return false;
758 static inline int pmd_present(pmd_t pmd)
761 * Checking for _PAGE_PSE is needed too because
762 * split_huge_page will temporarily clear the present bit (but
763 * the _PAGE_PSE flag will remain set at all times while the
764 * _PAGE_PRESENT bit is clear).
766 return pmd_flags(pmd) & (_PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_PSE);
769 #ifdef CONFIG_NUMA_BALANCING
771 * These work without NUMA balancing but the kernel does not care. See the
772 * comment in include/asm-generic/pgtable.h
774 static inline int pte_protnone(pte_t pte)
776 return (pte_flags(pte) & (_PAGE_PROTNONE | _PAGE_PRESENT))
777 == _PAGE_PROTNONE;
780 static inline int pmd_protnone(pmd_t pmd)
782 return (pmd_flags(pmd) & (_PAGE_PROTNONE | _PAGE_PRESENT))
783 == _PAGE_PROTNONE;
785 #endif /* CONFIG_NUMA_BALANCING */
787 static inline int pmd_none(pmd_t pmd)
789 /* Only check low word on 32-bit platforms, since it might be
790 out of sync with upper half. */
791 unsigned long val = native_pmd_val(pmd);
792 return (val & ~_PAGE_KNL_ERRATUM_MASK) == 0;
795 static inline unsigned long pmd_page_vaddr(pmd_t pmd)
797 return (unsigned long)__va(pmd_val(pmd) & pmd_pfn_mask(pmd));
801 * Currently stuck as a macro due to indirect forward reference to
802 * linux/mmzone.h's __section_mem_map_addr() definition:
804 #define pmd_page(pmd) pfn_to_page(pmd_pfn(pmd))
807 * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD]
809 * this macro returns the index of the entry in the pmd page which would
810 * control the given virtual address
812 static inline unsigned long pmd_index(unsigned long address)
814 return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
818 * Conversion functions: convert a page and protection to a page entry,
819 * and a page entry and page directory to the page they refer to.
821 * (Currently stuck as a macro because of indirect forward reference
822 * to linux/mm.h:page_to_nid())
824 #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
827 * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
829 * this function returns the index of the entry in the pte page which would
830 * control the given virtual address
832 static inline unsigned long pte_index(unsigned long address)
834 return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1);
837 static inline pte_t *pte_offset_kernel(pmd_t *pmd, unsigned long address)
839 return (pte_t *)pmd_page_vaddr(*pmd) + pte_index(address);
842 static inline int pmd_bad(pmd_t pmd)
844 return (pmd_flags(pmd) & ~_PAGE_USER) != _KERNPG_TABLE;
847 static inline unsigned long pages_to_mb(unsigned long npg)
849 return npg >> (20 - PAGE_SHIFT);
852 #if CONFIG_PGTABLE_LEVELS > 2
853 static inline int pud_none(pud_t pud)
855 return (native_pud_val(pud) & ~(_PAGE_KNL_ERRATUM_MASK)) == 0;
858 static inline int pud_present(pud_t pud)
860 return pud_flags(pud) & _PAGE_PRESENT;
863 static inline unsigned long pud_page_vaddr(pud_t pud)
865 return (unsigned long)__va(pud_val(pud) & pud_pfn_mask(pud));
869 * Currently stuck as a macro due to indirect forward reference to
870 * linux/mmzone.h's __section_mem_map_addr() definition:
872 #define pud_page(pud) pfn_to_page(pud_pfn(pud))
874 /* Find an entry in the second-level page table.. */
875 static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
877 return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address);
880 #define pud_leaf pud_large
881 static inline int pud_large(pud_t pud)
883 return (pud_val(pud) & (_PAGE_PSE | _PAGE_PRESENT)) ==
884 (_PAGE_PSE | _PAGE_PRESENT);
887 static inline int pud_bad(pud_t pud)
889 return (pud_flags(pud) & ~(_KERNPG_TABLE | _PAGE_USER)) != 0;
891 #else
892 #define pud_leaf pud_large
893 static inline int pud_large(pud_t pud)
895 return 0;
897 #endif /* CONFIG_PGTABLE_LEVELS > 2 */
899 static inline unsigned long pud_index(unsigned long address)
901 return (address >> PUD_SHIFT) & (PTRS_PER_PUD - 1);
904 #if CONFIG_PGTABLE_LEVELS > 3
905 static inline int p4d_none(p4d_t p4d)
907 return (native_p4d_val(p4d) & ~(_PAGE_KNL_ERRATUM_MASK)) == 0;
910 static inline int p4d_present(p4d_t p4d)
912 return p4d_flags(p4d) & _PAGE_PRESENT;
915 static inline unsigned long p4d_page_vaddr(p4d_t p4d)
917 return (unsigned long)__va(p4d_val(p4d) & p4d_pfn_mask(p4d));
921 * Currently stuck as a macro due to indirect forward reference to
922 * linux/mmzone.h's __section_mem_map_addr() definition:
924 #define p4d_page(p4d) pfn_to_page(p4d_pfn(p4d))
926 /* Find an entry in the third-level page table.. */
927 static inline pud_t *pud_offset(p4d_t *p4d, unsigned long address)
929 return (pud_t *)p4d_page_vaddr(*p4d) + pud_index(address);
932 static inline int p4d_bad(p4d_t p4d)
934 unsigned long ignore_flags = _KERNPG_TABLE | _PAGE_USER;
936 if (IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION))
937 ignore_flags |= _PAGE_NX;
939 return (p4d_flags(p4d) & ~ignore_flags) != 0;
941 #endif /* CONFIG_PGTABLE_LEVELS > 3 */
943 static inline unsigned long p4d_index(unsigned long address)
945 return (address >> P4D_SHIFT) & (PTRS_PER_P4D - 1);
948 #if CONFIG_PGTABLE_LEVELS > 4
949 static inline int pgd_present(pgd_t pgd)
951 if (!pgtable_l5_enabled())
952 return 1;
953 return pgd_flags(pgd) & _PAGE_PRESENT;
956 static inline unsigned long pgd_page_vaddr(pgd_t pgd)
958 return (unsigned long)__va((unsigned long)pgd_val(pgd) & PTE_PFN_MASK);
962 * Currently stuck as a macro due to indirect forward reference to
963 * linux/mmzone.h's __section_mem_map_addr() definition:
965 #define pgd_page(pgd) pfn_to_page(pgd_pfn(pgd))
967 /* to find an entry in a page-table-directory. */
968 static inline p4d_t *p4d_offset(pgd_t *pgd, unsigned long address)
970 if (!pgtable_l5_enabled())
971 return (p4d_t *)pgd;
972 return (p4d_t *)pgd_page_vaddr(*pgd) + p4d_index(address);
975 static inline int pgd_bad(pgd_t pgd)
977 unsigned long ignore_flags = _PAGE_USER;
979 if (!pgtable_l5_enabled())
980 return 0;
982 if (IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION))
983 ignore_flags |= _PAGE_NX;
985 return (pgd_flags(pgd) & ~ignore_flags) != _KERNPG_TABLE;
988 static inline int pgd_none(pgd_t pgd)
990 if (!pgtable_l5_enabled())
991 return 0;
993 * There is no need to do a workaround for the KNL stray
994 * A/D bit erratum here. PGDs only point to page tables
995 * except on 32-bit non-PAE which is not supported on
996 * KNL.
998 return !native_pgd_val(pgd);
1000 #endif /* CONFIG_PGTABLE_LEVELS > 4 */
1002 #endif /* __ASSEMBLY__ */
1005 * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD]
1007 * this macro returns the index of the entry in the pgd page which would
1008 * control the given virtual address
1010 #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
1013 * pgd_offset() returns a (pgd_t *)
1014 * pgd_index() is used get the offset into the pgd page's array of pgd_t's;
1016 #define pgd_offset_pgd(pgd, address) (pgd + pgd_index((address)))
1018 * a shortcut to get a pgd_t in a given mm
1020 #define pgd_offset(mm, address) pgd_offset_pgd((mm)->pgd, (address))
1022 * a shortcut which implies the use of the kernel's pgd, instead
1023 * of a process's
1025 #define pgd_offset_k(address) pgd_offset(&init_mm, (address))
1028 #define KERNEL_PGD_BOUNDARY pgd_index(PAGE_OFFSET)
1029 #define KERNEL_PGD_PTRS (PTRS_PER_PGD - KERNEL_PGD_BOUNDARY)
1031 #ifndef __ASSEMBLY__
1033 extern int direct_gbpages;
1034 void init_mem_mapping(void);
1035 void early_alloc_pgt_buf(void);
1036 extern void memblock_find_dma_reserve(void);
1038 #ifdef CONFIG_X86_64
1039 /* Realmode trampoline initialization. */
1040 extern pgd_t trampoline_pgd_entry;
1041 static inline void __meminit init_trampoline_default(void)
1043 /* Default trampoline pgd value */
1044 trampoline_pgd_entry = init_top_pgt[pgd_index(__PAGE_OFFSET)];
1047 void __init poking_init(void);
1049 # ifdef CONFIG_RANDOMIZE_MEMORY
1050 void __meminit init_trampoline(void);
1051 # else
1052 # define init_trampoline init_trampoline_default
1053 # endif
1054 #else
1055 static inline void init_trampoline(void) { }
1056 #endif
1058 /* local pte updates need not use xchg for locking */
1059 static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep)
1061 pte_t res = *ptep;
1063 /* Pure native function needs no input for mm, addr */
1064 native_pte_clear(NULL, 0, ptep);
1065 return res;
1068 static inline pmd_t native_local_pmdp_get_and_clear(pmd_t *pmdp)
1070 pmd_t res = *pmdp;
1072 native_pmd_clear(pmdp);
1073 return res;
1076 static inline pud_t native_local_pudp_get_and_clear(pud_t *pudp)
1078 pud_t res = *pudp;
1080 native_pud_clear(pudp);
1081 return res;
1084 static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr,
1085 pte_t *ptep , pte_t pte)
1087 native_set_pte(ptep, pte);
1090 static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
1091 pmd_t *pmdp, pmd_t pmd)
1093 set_pmd(pmdp, pmd);
1096 static inline void set_pud_at(struct mm_struct *mm, unsigned long addr,
1097 pud_t *pudp, pud_t pud)
1099 native_set_pud(pudp, pud);
1103 * We only update the dirty/accessed state if we set
1104 * the dirty bit by hand in the kernel, since the hardware
1105 * will do the accessed bit for us, and we don't want to
1106 * race with other CPU's that might be updating the dirty
1107 * bit at the same time.
1109 struct vm_area_struct;
1111 #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
1112 extern int ptep_set_access_flags(struct vm_area_struct *vma,
1113 unsigned long address, pte_t *ptep,
1114 pte_t entry, int dirty);
1116 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
1117 extern int ptep_test_and_clear_young(struct vm_area_struct *vma,
1118 unsigned long addr, pte_t *ptep);
1120 #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
1121 extern int ptep_clear_flush_young(struct vm_area_struct *vma,
1122 unsigned long address, pte_t *ptep);
1124 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
1125 static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
1126 pte_t *ptep)
1128 pte_t pte = native_ptep_get_and_clear(ptep);
1129 return pte;
1132 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
1133 static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
1134 unsigned long addr, pte_t *ptep,
1135 int full)
1137 pte_t pte;
1138 if (full) {
1140 * Full address destruction in progress; paravirt does not
1141 * care about updates and native needs no locking
1143 pte = native_local_ptep_get_and_clear(ptep);
1144 } else {
1145 pte = ptep_get_and_clear(mm, addr, ptep);
1147 return pte;
1150 #define __HAVE_ARCH_PTEP_SET_WRPROTECT
1151 static inline void ptep_set_wrprotect(struct mm_struct *mm,
1152 unsigned long addr, pte_t *ptep)
1154 clear_bit(_PAGE_BIT_RW, (unsigned long *)&ptep->pte);
1157 #define flush_tlb_fix_spurious_fault(vma, address) do { } while (0)
1159 #define mk_pmd(page, pgprot) pfn_pmd(page_to_pfn(page), (pgprot))
1161 #define __HAVE_ARCH_PMDP_SET_ACCESS_FLAGS
1162 extern int pmdp_set_access_flags(struct vm_area_struct *vma,
1163 unsigned long address, pmd_t *pmdp,
1164 pmd_t entry, int dirty);
1165 extern int pudp_set_access_flags(struct vm_area_struct *vma,
1166 unsigned long address, pud_t *pudp,
1167 pud_t entry, int dirty);
1169 #define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG
1170 extern int pmdp_test_and_clear_young(struct vm_area_struct *vma,
1171 unsigned long addr, pmd_t *pmdp);
1172 extern int pudp_test_and_clear_young(struct vm_area_struct *vma,
1173 unsigned long addr, pud_t *pudp);
1175 #define __HAVE_ARCH_PMDP_CLEAR_YOUNG_FLUSH
1176 extern int pmdp_clear_flush_young(struct vm_area_struct *vma,
1177 unsigned long address, pmd_t *pmdp);
1180 #define pmd_write pmd_write
1181 static inline int pmd_write(pmd_t pmd)
1183 return pmd_flags(pmd) & _PAGE_RW;
1186 #define __HAVE_ARCH_PMDP_HUGE_GET_AND_CLEAR
1187 static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, unsigned long addr,
1188 pmd_t *pmdp)
1190 return native_pmdp_get_and_clear(pmdp);
1193 #define __HAVE_ARCH_PUDP_HUGE_GET_AND_CLEAR
1194 static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm,
1195 unsigned long addr, pud_t *pudp)
1197 return native_pudp_get_and_clear(pudp);
1200 #define __HAVE_ARCH_PMDP_SET_WRPROTECT
1201 static inline void pmdp_set_wrprotect(struct mm_struct *mm,
1202 unsigned long addr, pmd_t *pmdp)
1204 clear_bit(_PAGE_BIT_RW, (unsigned long *)pmdp);
1207 #define pud_write pud_write
1208 static inline int pud_write(pud_t pud)
1210 return pud_flags(pud) & _PAGE_RW;
1213 #ifndef pmdp_establish
1214 #define pmdp_establish pmdp_establish
1215 static inline pmd_t pmdp_establish(struct vm_area_struct *vma,
1216 unsigned long address, pmd_t *pmdp, pmd_t pmd)
1218 if (IS_ENABLED(CONFIG_SMP)) {
1219 return xchg(pmdp, pmd);
1220 } else {
1221 pmd_t old = *pmdp;
1222 WRITE_ONCE(*pmdp, pmd);
1223 return old;
1226 #endif
1228 * Page table pages are page-aligned. The lower half of the top
1229 * level is used for userspace and the top half for the kernel.
1231 * Returns true for parts of the PGD that map userspace and
1232 * false for the parts that map the kernel.
1234 static inline bool pgdp_maps_userspace(void *__ptr)
1236 unsigned long ptr = (unsigned long)__ptr;
1238 return (((ptr & ~PAGE_MASK) / sizeof(pgd_t)) < PGD_KERNEL_START);
1241 #define pgd_leaf pgd_large
1242 static inline int pgd_large(pgd_t pgd) { return 0; }
1244 #ifdef CONFIG_PAGE_TABLE_ISOLATION
1246 * All top-level PAGE_TABLE_ISOLATION page tables are order-1 pages
1247 * (8k-aligned and 8k in size). The kernel one is at the beginning 4k and
1248 * the user one is in the last 4k. To switch between them, you
1249 * just need to flip the 12th bit in their addresses.
1251 #define PTI_PGTABLE_SWITCH_BIT PAGE_SHIFT
1254 * This generates better code than the inline assembly in
1255 * __set_bit().
1257 static inline void *ptr_set_bit(void *ptr, int bit)
1259 unsigned long __ptr = (unsigned long)ptr;
1261 __ptr |= BIT(bit);
1262 return (void *)__ptr;
1264 static inline void *ptr_clear_bit(void *ptr, int bit)
1266 unsigned long __ptr = (unsigned long)ptr;
1268 __ptr &= ~BIT(bit);
1269 return (void *)__ptr;
1272 static inline pgd_t *kernel_to_user_pgdp(pgd_t *pgdp)
1274 return ptr_set_bit(pgdp, PTI_PGTABLE_SWITCH_BIT);
1277 static inline pgd_t *user_to_kernel_pgdp(pgd_t *pgdp)
1279 return ptr_clear_bit(pgdp, PTI_PGTABLE_SWITCH_BIT);
1282 static inline p4d_t *kernel_to_user_p4dp(p4d_t *p4dp)
1284 return ptr_set_bit(p4dp, PTI_PGTABLE_SWITCH_BIT);
1287 static inline p4d_t *user_to_kernel_p4dp(p4d_t *p4dp)
1289 return ptr_clear_bit(p4dp, PTI_PGTABLE_SWITCH_BIT);
1291 #endif /* CONFIG_PAGE_TABLE_ISOLATION */
1294 * clone_pgd_range(pgd_t *dst, pgd_t *src, int count);
1296 * dst - pointer to pgd range anwhere on a pgd page
1297 * src - ""
1298 * count - the number of pgds to copy.
1300 * dst and src can be on the same page, but the range must not overlap,
1301 * and must not cross a page boundary.
1303 static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)
1305 memcpy(dst, src, count * sizeof(pgd_t));
1306 #ifdef CONFIG_PAGE_TABLE_ISOLATION
1307 if (!static_cpu_has(X86_FEATURE_PTI))
1308 return;
1309 /* Clone the user space pgd as well */
1310 memcpy(kernel_to_user_pgdp(dst), kernel_to_user_pgdp(src),
1311 count * sizeof(pgd_t));
1312 #endif
1315 #define PTE_SHIFT ilog2(PTRS_PER_PTE)
1316 static inline int page_level_shift(enum pg_level level)
1318 return (PAGE_SHIFT - PTE_SHIFT) + level * PTE_SHIFT;
1320 static inline unsigned long page_level_size(enum pg_level level)
1322 return 1UL << page_level_shift(level);
1324 static inline unsigned long page_level_mask(enum pg_level level)
1326 return ~(page_level_size(level) - 1);
1330 * The x86 doesn't have any external MMU info: the kernel page
1331 * tables contain all the necessary information.
1333 static inline void update_mmu_cache(struct vm_area_struct *vma,
1334 unsigned long addr, pte_t *ptep)
1337 static inline void update_mmu_cache_pmd(struct vm_area_struct *vma,
1338 unsigned long addr, pmd_t *pmd)
1341 static inline void update_mmu_cache_pud(struct vm_area_struct *vma,
1342 unsigned long addr, pud_t *pud)
1346 #ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY
1347 static inline pte_t pte_swp_mksoft_dirty(pte_t pte)
1349 return pte_set_flags(pte, _PAGE_SWP_SOFT_DIRTY);
1352 static inline int pte_swp_soft_dirty(pte_t pte)
1354 return pte_flags(pte) & _PAGE_SWP_SOFT_DIRTY;
1357 static inline pte_t pte_swp_clear_soft_dirty(pte_t pte)
1359 return pte_clear_flags(pte, _PAGE_SWP_SOFT_DIRTY);
1362 #ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
1363 static inline pmd_t pmd_swp_mksoft_dirty(pmd_t pmd)
1365 return pmd_set_flags(pmd, _PAGE_SWP_SOFT_DIRTY);
1368 static inline int pmd_swp_soft_dirty(pmd_t pmd)
1370 return pmd_flags(pmd) & _PAGE_SWP_SOFT_DIRTY;
1373 static inline pmd_t pmd_swp_clear_soft_dirty(pmd_t pmd)
1375 return pmd_clear_flags(pmd, _PAGE_SWP_SOFT_DIRTY);
1377 #endif
1378 #endif
1380 #define PKRU_AD_BIT 0x1
1381 #define PKRU_WD_BIT 0x2
1382 #define PKRU_BITS_PER_PKEY 2
1384 #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
1385 extern u32 init_pkru_value;
1386 #else
1387 #define init_pkru_value 0
1388 #endif
1390 static inline bool __pkru_allows_read(u32 pkru, u16 pkey)
1392 int pkru_pkey_bits = pkey * PKRU_BITS_PER_PKEY;
1393 return !(pkru & (PKRU_AD_BIT << pkru_pkey_bits));
1396 static inline bool __pkru_allows_write(u32 pkru, u16 pkey)
1398 int pkru_pkey_bits = pkey * PKRU_BITS_PER_PKEY;
1400 * Access-disable disables writes too so we need to check
1401 * both bits here.
1403 return !(pkru & ((PKRU_AD_BIT|PKRU_WD_BIT) << pkru_pkey_bits));
1406 static inline u16 pte_flags_pkey(unsigned long pte_flags)
1408 #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
1409 /* ifdef to avoid doing 59-bit shift on 32-bit values */
1410 return (pte_flags & _PAGE_PKEY_MASK) >> _PAGE_BIT_PKEY_BIT0;
1411 #else
1412 return 0;
1413 #endif
1416 static inline bool __pkru_allows_pkey(u16 pkey, bool write)
1418 u32 pkru = read_pkru();
1420 if (!__pkru_allows_read(pkru, pkey))
1421 return false;
1422 if (write && !__pkru_allows_write(pkru, pkey))
1423 return false;
1425 return true;
1429 * 'pteval' can come from a PTE, PMD or PUD. We only check
1430 * _PAGE_PRESENT, _PAGE_USER, and _PAGE_RW in here which are the
1431 * same value on all 3 types.
1433 static inline bool __pte_access_permitted(unsigned long pteval, bool write)
1435 unsigned long need_pte_bits = _PAGE_PRESENT|_PAGE_USER;
1437 if (write)
1438 need_pte_bits |= _PAGE_RW;
1440 if ((pteval & need_pte_bits) != need_pte_bits)
1441 return 0;
1443 return __pkru_allows_pkey(pte_flags_pkey(pteval), write);
1446 #define pte_access_permitted pte_access_permitted
1447 static inline bool pte_access_permitted(pte_t pte, bool write)
1449 return __pte_access_permitted(pte_val(pte), write);
1452 #define pmd_access_permitted pmd_access_permitted
1453 static inline bool pmd_access_permitted(pmd_t pmd, bool write)
1455 return __pte_access_permitted(pmd_val(pmd), write);
1458 #define pud_access_permitted pud_access_permitted
1459 static inline bool pud_access_permitted(pud_t pud, bool write)
1461 return __pte_access_permitted(pud_val(pud), write);
1464 #define __HAVE_ARCH_PFN_MODIFY_ALLOWED 1
1465 extern bool pfn_modify_allowed(unsigned long pfn, pgprot_t prot);
1467 static inline bool arch_has_pfn_modify_check(void)
1469 return boot_cpu_has_bug(X86_BUG_L1TF);
1472 #define arch_faults_on_old_pte arch_faults_on_old_pte
1473 static inline bool arch_faults_on_old_pte(void)
1475 return false;
1478 #include <asm-generic/pgtable.h>
1479 #endif /* __ASSEMBLY__ */
1481 #endif /* _ASM_X86_PGTABLE_H */