mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-29 23:53:55 +08:00
46a82b2d55
One of the changes necessary for shared page tables is to standardize the pxx_page macros. pte_page and pmd_page have always returned the struct page associated with their entry, while pte_page_kernel and pmd_page_kernel have returned the kernel virtual address. pud_page and pgd_page, on the other hand, return the kernel virtual address. Shared page tables needs pud_page and pgd_page to return the actual page structures. There are very few actual users of these functions, so it is simple to standardize their usage. Since this is basic cleanup, I am submitting these changes as a standalone patch. Per Hugh Dickins' comments about it, I am also changing the pxx_page_kernel macros to pxx_page_vaddr to clarify their meaning. Signed-off-by: Dave McCracken <dmccr@us.ibm.com> Cc: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
71 lines
2.0 KiB
C
71 lines
2.0 KiB
C
#ifndef __ASM_SH_PGTABLE_2LEVEL_H
|
|
#define __ASM_SH_PGTABLE_2LEVEL_H
|
|
|
|
/*
|
|
* traditional two-level paging structure:
|
|
*/
|
|
|
|
#define PGDIR_SHIFT 22
|
|
#define PTRS_PER_PGD 1024
|
|
|
|
/*
|
|
* this is two-level, so we don't really have any
|
|
* PMD directory physically.
|
|
*/
|
|
#define PMD_SHIFT 22
|
|
#define PTRS_PER_PMD 1
|
|
|
|
#define PTRS_PER_PTE 1024
|
|
|
|
#ifndef __ASSEMBLY__
|
|
#define pte_ERROR(e) \
|
|
printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
|
|
#define pmd_ERROR(e) \
|
|
printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
|
|
#define pgd_ERROR(e) \
|
|
printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
|
|
|
|
/*
|
|
* The "pgd_xxx()" functions here are trivial for a folded two-level
|
|
* setup: the pgd is never bad, and a pmd always exists (as it's folded
|
|
* into the pgd entry)
|
|
*/
|
|
static inline int pgd_none(pgd_t pgd) { return 0; }
|
|
static inline int pgd_bad(pgd_t pgd) { return 0; }
|
|
static inline int pgd_present(pgd_t pgd) { return 1; }
|
|
static inline void pgd_clear (pgd_t * pgdp) { }
|
|
|
|
/*
|
|
* Certain architectures need to do special things when PTEs
|
|
* within a page table are directly modified. Thus, the following
|
|
* hook is made available.
|
|
*/
|
|
#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
|
|
#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
|
|
|
|
/*
|
|
* (pmds are folded into pgds so this doesn't get actually called,
|
|
* but the define is needed for a generic inline function.)
|
|
*/
|
|
#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
|
|
#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval)
|
|
|
|
#define pgd_page_vaddr(pgd) \
|
|
((unsigned long) __va(pgd_val(pgd) & PAGE_MASK))
|
|
|
|
#define pgd_page(pgd) \
|
|
(phys_to_page(pgd_val(pgd)))
|
|
|
|
static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
|
|
{
|
|
return (pmd_t *) dir;
|
|
}
|
|
|
|
#define pte_pfn(x) ((unsigned long)(((x).pte >> PAGE_SHIFT)))
|
|
#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
|
|
#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
|
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
|
#endif /* __ASM_SH_PGTABLE_2LEVEL_H */
|