Skip to content

Commit

Permalink
x86: move more pagetable-related definitions into pgtable*.h
Browse files Browse the repository at this point in the history
PAGETABLE_LEVELS and the PTE masks should be in pgtable*.h

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
  • Loading branch information
Jeremy Fitzhardinge committed Feb 13, 2009
1 parent 0341c14 commit 9b3651c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
2 changes: 0 additions & 2 deletions arch/x86/include/asm/page_32_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@
/* 44=32+12, the limit we can fit into an unsigned long pfn */
#define __PHYSICAL_MASK_SHIFT 44
#define __VIRTUAL_MASK_SHIFT 32
#define PAGETABLE_LEVELS 3

#else /* !CONFIG_X86_PAE */
#define __PHYSICAL_MASK_SHIFT 32
#define __VIRTUAL_MASK_SHIFT 32
#define PAGETABLE_LEVELS 2
#endif /* CONFIG_X86_PAE */

#ifndef __ASSEMBLY__
Expand Down
2 changes: 0 additions & 2 deletions arch/x86/include/asm/page_64_types.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef _ASM_X86_PAGE_64_DEFS_H
#define _ASM_X86_PAGE_64_DEFS_H

#define PAGETABLE_LEVELS 4

#define THREAD_ORDER 1
#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
#define CURRENT_MASK (~(THREAD_SIZE - 1))
Expand Down
6 changes: 0 additions & 6 deletions arch/x86/include/asm/page_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
(ie, 32-bit PAE). */
#define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK)

/* PTE_PFN_MASK extracts the PFN from a (pte|pmd|pud|pgd)val_t */
#define PTE_PFN_MASK ((pteval_t)PHYSICAL_PAGE_MASK)

/* PTE_FLAGS_MASK extracts the flags from a (pte|pmd|pud|pgd)val_t */
#define PTE_FLAGS_MASK (~PTE_PFN_MASK)

#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))

Expand Down
2 changes: 2 additions & 0 deletions arch/x86/include/asm/pgtable-2level_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ typedef union {
#endif /* !__ASSEMBLY__ */

#define SHARED_KERNEL_PMD 0
#define PAGETABLE_LEVELS 2

/*
* traditional i386 two-level paging structure:
Expand All @@ -25,6 +26,7 @@ typedef union {
#define PGDIR_SHIFT 22
#define PTRS_PER_PGD 1024


/*
* the i386 is two-level, so we don't really have any
* PMD directory physically.
Expand Down
2 changes: 2 additions & 0 deletions arch/x86/include/asm/pgtable-3level_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ typedef union {
#define SHARED_KERNEL_PMD 1
#endif

#define PAGETABLE_LEVELS 3

/*
* PGDIR_SHIFT determines what a top-level page table entry can map
*/
Expand Down
1 change: 1 addition & 0 deletions arch/x86/include/asm/pgtable_64_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ typedef struct { pteval_t pte; } pte_t;
#endif /* !__ASSEMBLY__ */

#define SHARED_KERNEL_PMD 0
#define PAGETABLE_LEVELS 4

/*
* PGDIR_SHIFT determines what a top-level page table entry can map
Expand Down
6 changes: 6 additions & 0 deletions arch/x86/include/asm/pgtable_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@

#include <linux/types.h>

/* PTE_PFN_MASK extracts the PFN from a (pte|pmd|pud|pgd)val_t */
#define PTE_PFN_MASK ((pteval_t)PHYSICAL_PAGE_MASK)

/* PTE_FLAGS_MASK extracts the flags from a (pte|pmd|pud|pgd)val_t */
#define PTE_FLAGS_MASK (~PTE_PFN_MASK)

typedef struct pgprot { pgprotval_t pgprot; } pgprot_t;

typedef struct { pgdval_t pgd; } pgd_t;
Expand Down

0 comments on commit 9b3651c

Please sign in to comment.