Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
0004  * Copyright 2003 PathScale, Inc.
0005  * Derived from include/asm-i386/pgtable.h
0006  */
0007 
0008 #ifndef __UM_PGTABLE_2LEVEL_H
0009 #define __UM_PGTABLE_2LEVEL_H
0010 
0011 #include <asm-generic/pgtable-nopmd.h>
0012 
0013 /* PGDIR_SHIFT determines what a third-level page table entry can map */
0014 
0015 #define PGDIR_SHIFT 22
0016 #define PGDIR_SIZE  (1UL << PGDIR_SHIFT)
0017 #define PGDIR_MASK  (~(PGDIR_SIZE-1))
0018 
0019 /*
0020  * entries per page directory level: the i386 is two-level, so
0021  * we don't really have any PMD directory physically.
0022  */
0023 #define PTRS_PER_PTE    1024
0024 #define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE)
0025 #define PTRS_PER_PGD    1024
0026 
0027 #define pte_ERROR(e) \
0028         printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), \
0029            pte_val(e))
0030 #define pgd_ERROR(e) \
0031         printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), \
0032            pgd_val(e))
0033 
0034 static inline int pgd_newpage(pgd_t pgd)    { return 0; }
0035 static inline void pgd_mkuptodate(pgd_t pgd)    { }
0036 
0037 #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
0038 
0039 #define pte_pfn(x) phys_to_pfn(pte_val(x))
0040 #define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot))
0041 #define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot))
0042 
0043 #endif