~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/openrisc/include/asm/pgalloc.h

Version: ~ [ linux-5.16-rc3 ] ~ [ linux-5.15.5 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.82 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.162 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.218 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.256 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.291 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.293 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * OpenRISC Linux
  3  *
  4  * Linux architectural port borrowing liberally from similar works of
  5  * others.  All original copyrights apply as per the original source
  6  * declaration.
  7  *
  8  * OpenRISC implementation:
  9  * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
 10  * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
 11  * et al.
 12  *
 13  * This program is free software; you can redistribute it and/or modify
 14  * it under the terms of the GNU General Public License as published by
 15  * the Free Software Foundation; either version 2 of the License, or
 16  * (at your option) any later version.
 17  */
 18 
 19 #ifndef __ASM_OPENRISC_PGALLOC_H
 20 #define __ASM_OPENRISC_PGALLOC_H
 21 
 22 #include <asm/page.h>
 23 #include <linux/threads.h>
 24 #include <linux/mm.h>
 25 #include <linux/memblock.h>
 26 
 27 extern int mem_init_done;
 28 
 29 #define pmd_populate_kernel(mm, pmd, pte) \
 30         set_pmd(pmd, __pmd(_KERNPG_TABLE + __pa(pte)))
 31 
 32 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
 33                                 struct page *pte)
 34 {
 35         set_pmd(pmd, __pmd(_KERNPG_TABLE +
 36                      ((unsigned long)page_to_pfn(pte) <<
 37                      (unsigned long) PAGE_SHIFT)));
 38 }
 39 
 40 /*
 41  * Allocate and free page tables.
 42  */
 43 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
 44 {
 45         pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL);
 46 
 47         if (ret) {
 48                 memset(ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
 49                 memcpy(ret + USER_PTRS_PER_PGD,
 50                        swapper_pg_dir + USER_PTRS_PER_PGD,
 51                        (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
 52 
 53         }
 54         return ret;
 55 }
 56 
 57 #if 0
 58 /* FIXME: This seems to be the preferred style, but we are using
 59  * current_pgd (from mm->pgd) to load kernel pages so we need it
 60  * initialized.  This needs to be looked into.
 61  */
 62 extern inline pgd_t *pgd_alloc(struct mm_struct *mm)
 63 {
 64         return (pgd_t *)get_zeroed_page(GFP_KERNEL);
 65 }
 66 #endif
 67 
 68 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
 69 {
 70         free_page((unsigned long)pgd);
 71 }
 72 
 73 extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address);
 74 
 75 static inline struct page *pte_alloc_one(struct mm_struct *mm,
 76                                          unsigned long address)
 77 {
 78         struct page *pte;
 79         pte = alloc_pages(GFP_KERNEL, 0);
 80         if (!pte)
 81                 return NULL;
 82         clear_page(page_address(pte));
 83         if (!pgtable_page_ctor(pte)) {
 84                 __free_page(pte);
 85                 return NULL;
 86         }
 87         return pte;
 88 }
 89 
 90 static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
 91 {
 92         free_page((unsigned long)pte);
 93 }
 94 
 95 static inline void pte_free(struct mm_struct *mm, struct page *pte)
 96 {
 97         pgtable_page_dtor(pte);
 98         __free_page(pte);
 99 }
100 
101 
102 #define __pte_free_tlb(tlb, pte, addr) tlb_remove_page((tlb), (pte))
103 #define pmd_pgtable(pmd) pmd_page(pmd)
104 
105 #define check_pgt_cache()          do { } while (0)
106 
107 #endif
108 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp