Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Functions | Variables
pgtable.h File Reference
#include <asm/addrspace.h>
#include <linux/sched.h>
#include <asm/pgtable-2level.h>
#include <asm-generic/pgtable.h>

Go to the source code of this file.

Macros

#define PMD_SIZE   (1UL << PMD_SHIFT)
 
#define PMD_MASK   (~(PMD_SIZE-1))
 
#define PGDIR_SIZE   (1UL << PGDIR_SHIFT)
 
#define PGDIR_MASK   (~(PGDIR_SIZE-1))
 
#define USER_PTRS_PER_PGD   (TASK_SIZE / PGDIR_SIZE)
 
#define FIRST_USER_ADDRESS   0
 
#define ZERO_PAGE(vaddr)   (empty_zero_page)
 
#define VMALLOC_OFFSET   (8 * 1024 * 1024)
 
#define VMALLOC_START   (P3SEG + VMALLOC_OFFSET)
 
#define VMALLOC_END   (P4SEG - VMALLOC_OFFSET)
 
#define _TLBEHI_BIT_VALID   9
 
#define _TLBEHI_VALID   (1 << _TLBEHI_BIT_VALID)
 
#define _PAGE_BIT_WT   0 /* W-bit : write-through */
 
#define _PAGE_BIT_DIRTY   1 /* D-bit : page changed */
 
#define _PAGE_BIT_SZ0   2 /* SZ0-bit : Size of page */
 
#define _PAGE_BIT_SZ1   3 /* SZ1-bit : Size of page */
 
#define _PAGE_BIT_EXECUTE   4 /* X-bit : execute access allowed */
 
#define _PAGE_BIT_RW   5 /* AP0-bit : write access allowed */
 
#define _PAGE_BIT_USER   6 /* AP1-bit : user space access allowed */
 
#define _PAGE_BIT_BUFFER   7 /* B-bit : bufferable */
 
#define _PAGE_BIT_GLOBAL   8 /* G-bit : global (ignore ASID) */
 
#define _PAGE_BIT_CACHABLE   9 /* C-bit : cachable */
 
#define _PAGE_BIT_PRESENT   10
 
#define _PAGE_BIT_ACCESSED   11 /* software: page was accessed */
 
#define _PAGE_BIT_FILE   0 /* software: pagecache or swap? */
 
#define _PAGE_WT   (1 << _PAGE_BIT_WT)
 
#define _PAGE_DIRTY   (1 << _PAGE_BIT_DIRTY)
 
#define _PAGE_EXECUTE   (1 << _PAGE_BIT_EXECUTE)
 
#define _PAGE_RW   (1 << _PAGE_BIT_RW)
 
#define _PAGE_USER   (1 << _PAGE_BIT_USER)
 
#define _PAGE_BUFFER   (1 << _PAGE_BIT_BUFFER)
 
#define _PAGE_GLOBAL   (1 << _PAGE_BIT_GLOBAL)
 
#define _PAGE_CACHABLE   (1 << _PAGE_BIT_CACHABLE)
 
#define _PAGE_ACCESSED   (1 << _PAGE_BIT_ACCESSED)
 
#define _PAGE_PRESENT   (1 << _PAGE_BIT_PRESENT)
 
#define _PAGE_FILE   (1 << _PAGE_BIT_FILE)
 
#define _PAGE_TYPE_MASK   ((1 << _PAGE_BIT_SZ0) | (1 << _PAGE_BIT_SZ1))
 
#define _PAGE_TYPE_NONE   (0 << _PAGE_BIT_SZ0)
 
#define _PAGE_TYPE_SMALL   (1 << _PAGE_BIT_SZ0)
 
#define _PAGE_TYPE_MEDIUM   (2 << _PAGE_BIT_SZ0)
 
#define _PAGE_TYPE_LARGE   (3 << _PAGE_BIT_SZ0)
 
#define _PAGE_FLAGS_HARDWARE_MASK   0xfffff3ff
 
#define _PAGE_FLAGS_CACHE_MASK   (_PAGE_CACHABLE | _PAGE_BUFFER | _PAGE_WT)
 
#define _PAGE_CHG_MASK
 
#define _PAGE_FLAGS_READ   (_PAGE_CACHABLE | _PAGE_BUFFER)
 
#define _PAGE_FLAGS_WRITE   (_PAGE_FLAGS_READ | _PAGE_RW | _PAGE_DIRTY)
 
#define _PAGE_NORMAL(x)
 
#define PAGE_NONE   (_PAGE_ACCESSED | _PAGE_TYPE_NONE)
 
#define PAGE_READ   (_PAGE_FLAGS_READ | _PAGE_USER)
 
#define PAGE_EXEC   (_PAGE_FLAGS_READ | _PAGE_EXECUTE | _PAGE_USER)
 
#define PAGE_WRITE   (_PAGE_FLAGS_WRITE | _PAGE_USER)
 
#define PAGE_KERNEL   _PAGE_NORMAL(_PAGE_FLAGS_WRITE | _PAGE_EXECUTE | _PAGE_GLOBAL)
 
#define PAGE_KERNEL_RO   _PAGE_NORMAL(_PAGE_FLAGS_READ | _PAGE_EXECUTE | _PAGE_GLOBAL)
 
#define _PAGE_P(x)   _PAGE_NORMAL((x) & ~(_PAGE_RW | _PAGE_DIRTY))
 
#define _PAGE_S(x)   _PAGE_NORMAL(x)
 
#define PAGE_COPY   _PAGE_P(PAGE_WRITE | PAGE_READ)
 
#define PAGE_SHARED   _PAGE_S(PAGE_WRITE | PAGE_READ)
 
#define __P000   __pgprot(PAGE_NONE)
 
#define __P001   _PAGE_P(PAGE_READ)
 
#define __P010   _PAGE_P(PAGE_WRITE)
 
#define __P011   _PAGE_P(PAGE_WRITE | PAGE_READ)
 
#define __P100   _PAGE_P(PAGE_EXEC)
 
#define __P101   _PAGE_P(PAGE_EXEC | PAGE_READ)
 
#define __P110   _PAGE_P(PAGE_EXEC | PAGE_WRITE)
 
#define __P111   _PAGE_P(PAGE_EXEC | PAGE_WRITE | PAGE_READ)
 
#define __S000   __pgprot(PAGE_NONE)
 
#define __S001   _PAGE_S(PAGE_READ)
 
#define __S010   _PAGE_S(PAGE_WRITE)
 
#define __S011   _PAGE_S(PAGE_WRITE | PAGE_READ)
 
#define __S100   _PAGE_S(PAGE_EXEC)
 
#define __S101   _PAGE_S(PAGE_EXEC | PAGE_READ)
 
#define __S110   _PAGE_S(PAGE_EXEC | PAGE_WRITE)
 
#define __S111   _PAGE_S(PAGE_EXEC | PAGE_WRITE | PAGE_READ)
 
#define pte_none(x)   (!pte_val(x))
 
#define pte_present(x)   (pte_val(x) & _PAGE_PRESENT)
 
#define pte_clear(mm, addr, xp)
 
#define pmd_none(x)   (!pmd_val(x))
 
#define pmd_present(x)   (pmd_val(x))
 
#define pmd_bad(x)   (pmd_val(x) & ~PAGE_MASK)
 
#define pages_to_mb(x)   ((x) >> (20-PAGE_SHIFT))
 
#define pte_page(x)   (pfn_to_page(pte_pfn(x)))
 
#define pgprot_noncached(prot)   __pgprot(pgprot_val(prot) & ~(_PAGE_BUFFER | _PAGE_CACHABLE))
 
#define pgprot_writecombine(prot)   __pgprot((pgprot_val(prot) & ~_PAGE_CACHABLE) | _PAGE_BUFFER)
 
#define mk_pte(page, pgprot)   pfn_pte(page_to_pfn(page), (pgprot))
 
#define page_pte(page)   page_pte_prot(page, __pgprot(0))
 
#define pmd_page_vaddr(pmd)   pmd_val(pmd)
 
#define pmd_page(pmd)   (virt_to_page(pmd_val(pmd)))
 
#define pgd_index(address)
 
#define pgd_offset(mm, address)   ((mm)->pgd + pgd_index(address))
 
#define pgd_offset_k(address)   pgd_offset(&init_mm, address)
 
#define pte_index(address)   ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 
#define pte_offset(dir, address)   ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
 
#define pte_offset_kernel(dir, address)   ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
 
#define pte_offset_map(dir, address)   pte_offset_kernel(dir, address)
 
#define pte_unmap(pte)   do { } while (0)
 
#define __swp_type(x)   (((x).val >> 4) & 0x3f)
 
#define __swp_offset(x)   ((x).val >> 11)
 
#define __swp_entry(type, offset)   ((swp_entry_t) { ((type) << 4) | ((offset) << 11) })
 
#define __pte_to_swp_entry(pte)   ((swp_entry_t) { pte_val(pte) })
 
#define __swp_entry_to_pte(x)   ((pte_t) { (x).val })
 
#define PTE_FILE_MAX_BITS   30
 
#define pte_to_pgoff(pte)
 
#define pgoff_to_pte(off)
 
#define kern_addr_valid(addr)   (1)
 
#define io_remap_pfn_range(vma, vaddr, pfn, size, prot)   remap_pfn_range(vma, vaddr, pfn, size, prot)
 
#define pgtable_cache_init()   do { } while(0)
 

Typedefs

typedef pte_tpte_addr_t
 

Functions

void paging_init (void)
 
void update_mmu_cache (struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
 

Variables

pgd_t swapper_pg_dir [PTRS_PER_PGD]
 
struct pageempty_zero_page
 

Macro Definition Documentation

#define __P000   __pgprot(PAGE_NONE)

Definition at line 166 of file pgtable.h.

#define __P001   _PAGE_P(PAGE_READ)

Definition at line 167 of file pgtable.h.

#define __P010   _PAGE_P(PAGE_WRITE)

Definition at line 168 of file pgtable.h.

#define __P011   _PAGE_P(PAGE_WRITE | PAGE_READ)

Definition at line 169 of file pgtable.h.

#define __P100   _PAGE_P(PAGE_EXEC)

Definition at line 170 of file pgtable.h.

#define __P101   _PAGE_P(PAGE_EXEC | PAGE_READ)

Definition at line 171 of file pgtable.h.

#define __P110   _PAGE_P(PAGE_EXEC | PAGE_WRITE)

Definition at line 172 of file pgtable.h.

#define __P111   _PAGE_P(PAGE_EXEC | PAGE_WRITE | PAGE_READ)

Definition at line 173 of file pgtable.h.

#define __pte_to_swp_entry (   pte)    ((swp_entry_t) { pte_val(pte) })

Definition at line 346 of file pgtable.h.

#define __S000   __pgprot(PAGE_NONE)

Definition at line 175 of file pgtable.h.

#define __S001   _PAGE_S(PAGE_READ)

Definition at line 176 of file pgtable.h.

#define __S010   _PAGE_S(PAGE_WRITE)

Definition at line 177 of file pgtable.h.

#define __S011   _PAGE_S(PAGE_WRITE | PAGE_READ)

Definition at line 178 of file pgtable.h.

#define __S100   _PAGE_S(PAGE_EXEC)

Definition at line 179 of file pgtable.h.

#define __S101   _PAGE_S(PAGE_EXEC | PAGE_READ)

Definition at line 180 of file pgtable.h.

#define __S110   _PAGE_S(PAGE_EXEC | PAGE_WRITE)

Definition at line 181 of file pgtable.h.

#define __S111   _PAGE_S(PAGE_EXEC | PAGE_WRITE | PAGE_READ)

Definition at line 182 of file pgtable.h.

#define __swp_entry (   type,
  offset 
)    ((swp_entry_t) { ((type) << 4) | ((offset) << 11) })

Definition at line 345 of file pgtable.h.

#define __swp_entry_to_pte (   x)    ((pte_t) { (x).val })

Definition at line 347 of file pgtable.h.

#define __swp_offset (   x)    ((x).val >> 11)

Definition at line 344 of file pgtable.h.

#define __swp_type (   x)    (((x).val >> 4) & 0x3f)

Definition at line 343 of file pgtable.h.

#define _PAGE_ACCESSED   (1 << _PAGE_BIT_ACCESSED)

Definition at line 102 of file pgtable.h.

#define _PAGE_BIT_ACCESSED   11 /* software: page was accessed */

Definition at line 87 of file pgtable.h.

#define _PAGE_BIT_BUFFER   7 /* B-bit : bufferable */

Definition at line 81 of file pgtable.h.

#define _PAGE_BIT_CACHABLE   9 /* C-bit : cachable */

Definition at line 83 of file pgtable.h.

#define _PAGE_BIT_DIRTY   1 /* D-bit : page changed */

Definition at line 75 of file pgtable.h.

#define _PAGE_BIT_EXECUTE   4 /* X-bit : execute access allowed */

Definition at line 78 of file pgtable.h.

#define _PAGE_BIT_FILE   0 /* software: pagecache or swap? */

Definition at line 90 of file pgtable.h.

#define _PAGE_BIT_GLOBAL   8 /* G-bit : global (ignore ASID) */

Definition at line 82 of file pgtable.h.

#define _PAGE_BIT_PRESENT   10

Definition at line 86 of file pgtable.h.

#define _PAGE_BIT_RW   5 /* AP0-bit : write access allowed */

Definition at line 79 of file pgtable.h.

#define _PAGE_BIT_SZ0   2 /* SZ0-bit : Size of page */

Definition at line 76 of file pgtable.h.

#define _PAGE_BIT_SZ1   3 /* SZ1-bit : Size of page */

Definition at line 77 of file pgtable.h.

#define _PAGE_BIT_USER   6 /* AP1-bit : user space access allowed */

Definition at line 80 of file pgtable.h.

#define _PAGE_BIT_WT   0 /* W-bit : write-through */

Definition at line 74 of file pgtable.h.

#define _PAGE_BUFFER   (1 << _PAGE_BIT_BUFFER)

Definition at line 97 of file pgtable.h.

#define _PAGE_CACHABLE   (1 << _PAGE_BIT_CACHABLE)

Definition at line 99 of file pgtable.h.

#define _PAGE_CHG_MASK
Value:

Definition at line 133 of file pgtable.h.

#define _PAGE_DIRTY   (1 << _PAGE_BIT_DIRTY)

Definition at line 93 of file pgtable.h.

#define _PAGE_EXECUTE   (1 << _PAGE_BIT_EXECUTE)

Definition at line 94 of file pgtable.h.

#define _PAGE_FILE   (1 << _PAGE_BIT_FILE)

Definition at line 104 of file pgtable.h.

#define _PAGE_FLAGS_CACHE_MASK   (_PAGE_CACHABLE | _PAGE_BUFFER | _PAGE_WT)

Definition at line 130 of file pgtable.h.

#define _PAGE_FLAGS_HARDWARE_MASK   0xfffff3ff

Definition at line 128 of file pgtable.h.

#define _PAGE_FLAGS_READ   (_PAGE_CACHABLE | _PAGE_BUFFER)

Definition at line 136 of file pgtable.h.

#define _PAGE_FLAGS_WRITE   (_PAGE_FLAGS_READ | _PAGE_RW | _PAGE_DIRTY)

Definition at line 137 of file pgtable.h.

#define _PAGE_GLOBAL   (1 << _PAGE_BIT_GLOBAL)

Definition at line 98 of file pgtable.h.

#define _PAGE_NORMAL (   x)
Value:

Definition at line 139 of file pgtable.h.

#define _PAGE_P (   x)    _PAGE_NORMAL((x) & ~(_PAGE_RW | _PAGE_DIRTY))

Definition at line 149 of file pgtable.h.

#define _PAGE_PRESENT   (1 << _PAGE_BIT_PRESENT)

Definition at line 103 of file pgtable.h.

#define _PAGE_RW   (1 << _PAGE_BIT_RW)

Definition at line 95 of file pgtable.h.

#define _PAGE_S (   x)    _PAGE_NORMAL(x)

Definition at line 150 of file pgtable.h.

#define _PAGE_TYPE_LARGE   (3 << _PAGE_BIT_SZ0)

Definition at line 120 of file pgtable.h.

#define _PAGE_TYPE_MASK   ((1 << _PAGE_BIT_SZ0) | (1 << _PAGE_BIT_SZ1))

Definition at line 116 of file pgtable.h.

#define _PAGE_TYPE_MEDIUM   (2 << _PAGE_BIT_SZ0)

Definition at line 119 of file pgtable.h.

#define _PAGE_TYPE_NONE   (0 << _PAGE_BIT_SZ0)

Definition at line 117 of file pgtable.h.

#define _PAGE_TYPE_SMALL   (1 << _PAGE_BIT_SZ0)

Definition at line 118 of file pgtable.h.

#define _PAGE_USER   (1 << _PAGE_BIT_USER)

Definition at line 96 of file pgtable.h.

#define _PAGE_WT   (1 << _PAGE_BIT_WT)

Definition at line 92 of file pgtable.h.

#define _TLBEHI_BIT_VALID   9

Definition at line 71 of file pgtable.h.

#define _TLBEHI_VALID   (1 << _TLBEHI_BIT_VALID)

Definition at line 72 of file pgtable.h.

#define FIRST_USER_ADDRESS   0

Definition at line 33 of file pgtable.h.

#define io_remap_pfn_range (   vma,
  vaddr,
  pfn,
  size,
  prot 
)    remap_pfn_range(vma, vaddr, pfn, size, prot)

Definition at line 365 of file pgtable.h.

#define kern_addr_valid (   addr)    (1)

Definition at line 363 of file pgtable.h.

#define mk_pte (   page,
  pgprot 
)    pfn_pte(page_to_pfn(page), (pgprot))

Definition at line 292 of file pgtable.h.

#define PAGE_COPY   _PAGE_P(PAGE_WRITE | PAGE_READ)

Definition at line 152 of file pgtable.h.

#define PAGE_EXEC   (_PAGE_FLAGS_READ | _PAGE_EXECUTE | _PAGE_USER)

Definition at line 144 of file pgtable.h.

Definition at line 146 of file pgtable.h.

#define PAGE_KERNEL_RO   _PAGE_NORMAL(_PAGE_FLAGS_READ | _PAGE_EXECUTE | _PAGE_GLOBAL)

Definition at line 147 of file pgtable.h.

#define PAGE_NONE   (_PAGE_ACCESSED | _PAGE_TYPE_NONE)

Definition at line 142 of file pgtable.h.

#define page_pte (   page)    page_pte_prot(page, __pgprot(0))

Definition at line 301 of file pgtable.h.

#define PAGE_READ   (_PAGE_FLAGS_READ | _PAGE_USER)

Definition at line 143 of file pgtable.h.

#define PAGE_SHARED   _PAGE_S(PAGE_WRITE | PAGE_READ)

Definition at line 153 of file pgtable.h.

#define PAGE_WRITE   (_PAGE_FLAGS_WRITE | _PAGE_USER)

Definition at line 145 of file pgtable.h.

#define pages_to_mb (   x)    ((x) >> (20-PAGE_SHIFT))

Definition at line 271 of file pgtable.h.

#define pgd_index (   address)
Value:
& (PTRS_PER_PGD - 1))

Definition at line 307 of file pgtable.h.

#define pgd_offset (   mm,
  address 
)    ((mm)->pgd + pgd_index(address))

Definition at line 309 of file pgtable.h.

#define pgd_offset_k (   address)    pgd_offset(&init_mm, address)

Definition at line 312 of file pgtable.h.

#define PGDIR_MASK   (~(PGDIR_SIZE-1))

Definition at line 30 of file pgtable.h.

#define PGDIR_SIZE   (1UL << PGDIR_SHIFT)

Definition at line 29 of file pgtable.h.

#define pgoff_to_pte (   off)
Value:
((pte_t) { ((((off) & 0x1ff) << 1) \
| (((off) >> 9) << 11) \
| _PAGE_FILE) })

Definition at line 357 of file pgtable.h.

#define pgprot_noncached (   prot)    __pgprot(pgprot_val(prot) & ~(_PAGE_BUFFER | _PAGE_CACHABLE))

Definition at line 277 of file pgtable.h.

#define pgprot_writecombine (   prot)    __pgprot((pgprot_val(prot) & ~_PAGE_CACHABLE) | _PAGE_BUFFER)

Definition at line 283 of file pgtable.h.

#define pgtable_cache_init (   void)    do { } while(0)

Definition at line 369 of file pgtable.h.

#define pmd_bad (   x)    (pmd_val(x) & ~PAGE_MASK)

Definition at line 265 of file pgtable.h.

#define PMD_MASK   (~(PMD_SIZE-1))

Definition at line 28 of file pgtable.h.

#define pmd_none (   x)    (!pmd_val(x))

Definition at line 257 of file pgtable.h.

#define pmd_page (   pmd)    (virt_to_page(pmd_val(pmd)))

Definition at line 304 of file pgtable.h.

#define pmd_page_vaddr (   pmd)    pmd_val(pmd)

Definition at line 303 of file pgtable.h.

#define pmd_present (   x)    (pmd_val(x))

Definition at line 258 of file pgtable.h.

#define PMD_SIZE   (1UL << PMD_SHIFT)

Definition at line 27 of file pgtable.h.

#define pte_clear (   mm,
  addr,
  xp 
)
Value:
do { \
set_pte_at(mm, addr, xp, __pte(0)); \
} while (0)

Definition at line 187 of file pgtable.h.

#define PTE_FILE_MAX_BITS   30

Definition at line 354 of file pgtable.h.

#define pte_index (   address)    ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))

Definition at line 315 of file pgtable.h.

#define pte_none (   x)    (!pte_val(x))

Definition at line 184 of file pgtable.h.

#define pte_offset (   dir,
  address 
)    ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))

Definition at line 317 of file pgtable.h.

#define pte_offset_kernel (   dir,
  address 
)    ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))

Definition at line 319 of file pgtable.h.

#define pte_offset_map (   dir,
  address 
)    pte_offset_kernel(dir, address)

Definition at line 321 of file pgtable.h.

#define pte_page (   x)    (pfn_to_page(pte_pfn(x)))

Definition at line 272 of file pgtable.h.

#define pte_present (   x)    (pte_val(x) & _PAGE_PRESENT)

Definition at line 185 of file pgtable.h.

#define pte_to_pgoff (   pte)
Value:
(((pte_val(pte) >> 1) & 0x1ff) \
| ((pte_val(pte) >> 11) << 9))

Definition at line 355 of file pgtable.h.

#define pte_unmap (   pte)    do { } while (0)

Definition at line 322 of file pgtable.h.

#define USER_PTRS_PER_PGD   (TASK_SIZE / PGDIR_SIZE)

Definition at line 32 of file pgtable.h.

#define VMALLOC_END   (P4SEG - VMALLOC_OFFSET)

Definition at line 64 of file pgtable.h.

#define VMALLOC_OFFSET   (8 * 1024 * 1024)

Definition at line 62 of file pgtable.h.

#define VMALLOC_START   (P3SEG + VMALLOC_OFFSET)

Definition at line 63 of file pgtable.h.

#define ZERO_PAGE (   vaddr)    (empty_zero_page)

Definition at line 44 of file pgtable.h.

Typedef Documentation

typedef pte_t* pte_addr_t

Definition at line 361 of file pgtable.h.

Function Documentation

void paging_init ( void  )

paging_init - setup page tables

paging_init() sets up the page tables for each node of the system and frees the bootmem allocator memory for general use.

Definition at line 238 of file init.c.

void update_mmu_cache ( struct vm_area_struct vma,
unsigned long  address,
pte_t ptep 
)
inline

Definition at line 330 of file pgtable.h.

Variable Documentation

struct page* empty_zero_page

Definition at line 42 of file mmu.c.

pgd_t swapper_pg_dir[PTRS_PER_PGD]

Definition at line 36 of file init.c.