root/arch/mips/mm/pgtable-32.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. pgd_init
  2. mk_pmd
  3. set_pmd_at
  4. pagetable_init

   1 /*
   2  * This file is subject to the terms and conditions of the GNU General Public
   3  * License.  See the file "COPYING" in the main directory of this archive
   4  * for more details.
   5  *
   6  * Copyright (C) 2003 by Ralf Baechle
   7  */
   8 #include <linux/init.h>
   9 #include <linux/mm.h>
  10 #include <linux/memblock.h>
  11 #include <linux/highmem.h>
  12 #include <asm/fixmap.h>
  13 #include <asm/pgtable.h>
  14 #include <asm/pgalloc.h>
  15 #include <asm/tlbflush.h>
  16 
  17 void pgd_init(unsigned long page)
  18 {
  19         unsigned long *p = (unsigned long *) page;
  20         int i;
  21 
  22         for (i = 0; i < USER_PTRS_PER_PGD; i+=8) {
  23                 p[i + 0] = (unsigned long) invalid_pte_table;
  24                 p[i + 1] = (unsigned long) invalid_pte_table;
  25                 p[i + 2] = (unsigned long) invalid_pte_table;
  26                 p[i + 3] = (unsigned long) invalid_pte_table;
  27                 p[i + 4] = (unsigned long) invalid_pte_table;
  28                 p[i + 5] = (unsigned long) invalid_pte_table;
  29                 p[i + 6] = (unsigned long) invalid_pte_table;
  30                 p[i + 7] = (unsigned long) invalid_pte_table;
  31         }
  32 }
  33 
  34 #if defined(CONFIG_TRANSPARENT_HUGEPAGE)
  35 pmd_t mk_pmd(struct page *page, pgprot_t prot)
  36 {
  37         pmd_t pmd;
  38 
  39         pmd_val(pmd) = (page_to_pfn(page) << _PFN_SHIFT) | pgprot_val(prot);
  40 
  41         return pmd;
  42 }
  43 
  44 
  45 void set_pmd_at(struct mm_struct *mm, unsigned long addr,
  46                 pmd_t *pmdp, pmd_t pmd)
  47 {
  48         *pmdp = pmd;
  49         flush_tlb_all();
  50 }
  51 #endif /* defined(CONFIG_TRANSPARENT_HUGEPAGE) */
  52 
  53 void __init pagetable_init(void)
  54 {
  55         unsigned long vaddr;
  56         pgd_t *pgd_base;
  57 #ifdef CONFIG_HIGHMEM
  58         pgd_t *pgd;
  59         pud_t *pud;
  60         pmd_t *pmd;
  61         pte_t *pte;
  62 #endif
  63 
  64         /* Initialize the entire pgd.  */
  65         pgd_init((unsigned long)swapper_pg_dir);
  66         pgd_init((unsigned long)swapper_pg_dir
  67                  + sizeof(pgd_t) * USER_PTRS_PER_PGD);
  68 
  69         pgd_base = swapper_pg_dir;
  70 
  71         /*
  72          * Fixed mappings:
  73          */
  74         vaddr = __fix_to_virt(__end_of_fixed_addresses - 1);
  75         fixrange_init(vaddr & PMD_MASK, vaddr + FIXADDR_SIZE, pgd_base);
  76 
  77 #ifdef CONFIG_HIGHMEM
  78         /*
  79          * Permanent kmaps:
  80          */
  81         vaddr = PKMAP_BASE;
  82         fixrange_init(vaddr & PMD_MASK, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base);
  83 
  84         pgd = swapper_pg_dir + __pgd_offset(vaddr);
  85         pud = pud_offset(pgd, vaddr);
  86         pmd = pmd_offset(pud, vaddr);
  87         pte = pte_offset_kernel(pmd, vaddr);
  88         pkmap_page_table = pte;
  89 #endif
  90 }

/* [<][>][^][v][top][bottom][index][help] */