xref: /linux/arch/um/include/asm/pgtable-2level.h (revision fac7757e)
1*f2f4bf5aSAlex Dewar /* SPDX-License-Identifier: GPL-2.0 */
28ede0bdbSAl Viro /*
38ede0bdbSAl Viro  * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
48ede0bdbSAl Viro  * Copyright 2003 PathScale, Inc.
58ede0bdbSAl Viro  * Derived from include/asm-i386/pgtable.h
68ede0bdbSAl Viro  */
78ede0bdbSAl Viro 
88ede0bdbSAl Viro #ifndef __UM_PGTABLE_2LEVEL_H
98ede0bdbSAl Viro #define __UM_PGTABLE_2LEVEL_H
108ede0bdbSAl Viro 
118ede0bdbSAl Viro #include <asm-generic/pgtable-nopmd.h>
128ede0bdbSAl Viro 
138ede0bdbSAl Viro /* PGDIR_SHIFT determines what a third-level page table entry can map */
148ede0bdbSAl Viro 
158ede0bdbSAl Viro #define PGDIR_SHIFT	22
168ede0bdbSAl Viro #define PGDIR_SIZE	(1UL << PGDIR_SHIFT)
178ede0bdbSAl Viro #define PGDIR_MASK	(~(PGDIR_SIZE-1))
188ede0bdbSAl Viro 
198ede0bdbSAl Viro /*
208ede0bdbSAl Viro  * entries per page directory level: the i386 is two-level, so
218ede0bdbSAl Viro  * we don't really have any PMD directory physically.
228ede0bdbSAl Viro  */
238ede0bdbSAl Viro #define PTRS_PER_PTE	1024
248ede0bdbSAl Viro #define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE)
258ede0bdbSAl Viro #define PTRS_PER_PGD	1024
268ede0bdbSAl Viro 
278ede0bdbSAl Viro #define pte_ERROR(e) \
288ede0bdbSAl Viro         printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), \
298ede0bdbSAl Viro 	       pte_val(e))
308ede0bdbSAl Viro #define pgd_ERROR(e) \
318ede0bdbSAl Viro         printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), \
328ede0bdbSAl Viro 	       pgd_val(e))
338ede0bdbSAl Viro 
pgd_newpage(pgd_t pgd)348ede0bdbSAl Viro static inline int pgd_newpage(pgd_t pgd)	{ return 0; }
pgd_mkuptodate(pgd_t pgd)358ede0bdbSAl Viro static inline void pgd_mkuptodate(pgd_t pgd)	{ }
368ede0bdbSAl Viro 
378ede0bdbSAl Viro #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
388ede0bdbSAl Viro 
398ede0bdbSAl Viro #define pte_pfn(x) phys_to_pfn(pte_val(x))
408ede0bdbSAl Viro #define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot))
418ede0bdbSAl Viro #define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot))
428ede0bdbSAl Viro 
438ede0bdbSAl Viro #endif
44