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

TOMOYO Linux Cross Reference
Linux/arch/m68k/include/asm/mcf_pgalloc.h

Version: ~ [ linux-5.17-rc1 ] ~ [ linux-5.16.2 ] ~ [ linux-5.15.16 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.93 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.173 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.225 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.262 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.297 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.299 ] ~ [ 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 #ifndef M68K_MCF_PGALLOC_H
  2 #define M68K_MCF_PGALLOC_H
  3 
  4 #include <asm/tlb.h>
  5 #include <asm/tlbflush.h>
  6 
  7 extern inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
  8 {
  9         free_page((unsigned long) pte);
 10 }
 11 
 12 extern const char bad_pmd_string[];
 13 
 14 extern inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
 15         unsigned long address)
 16 {
 17         unsigned long page = __get_free_page(GFP_DMA|__GFP_REPEAT);
 18 
 19         if (!page)
 20                 return NULL;
 21 
 22         memset((void *)page, 0, PAGE_SIZE);
 23         return (pte_t *) (page);
 24 }
 25 
 26 extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
 27 {
 28         return (pmd_t *) pgd;
 29 }
 30 
 31 #define pmd_alloc_one_fast(mm, address) ({ BUG(); ((pmd_t *)1); })
 32 #define pmd_alloc_one(mm, address)      ({ BUG(); ((pmd_t *)2); })
 33 
 34 #define pte_alloc_one_fast(mm, addr) pte_alloc_one(mm, addr)
 35 
 36 #define pmd_populate(mm, pmd, page) (pmd_val(*pmd) = \
 37         (unsigned long)(page_address(page)))
 38 
 39 #define pmd_populate_kernel(mm, pmd, pte) (pmd_val(*pmd) = (unsigned long)(pte))
 40 
 41 #define pmd_pgtable(pmd) pmd_page(pmd)
 42 
 43 static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page,
 44                                   unsigned long address)
 45 {
 46         __free_page(page);
 47 }
 48 
 49 #define __pmd_free_tlb(tlb, pmd, address) do { } while (0)
 50 
 51 static inline struct page *pte_alloc_one(struct mm_struct *mm,
 52         unsigned long address)
 53 {
 54         struct page *page = alloc_pages(GFP_DMA|__GFP_REPEAT, 0);
 55         pte_t *pte;
 56 
 57         if (!page)
 58                 return NULL;
 59 
 60         pte = kmap(page);
 61         if (pte) {
 62                 clear_page(pte);
 63                 __flush_page_to_ram(pte);
 64                 flush_tlb_kernel_page(pte);
 65                 nocache_page(pte);
 66         }
 67         kunmap(page);
 68 
 69         return page;
 70 }
 71 
 72 extern inline void pte_free(struct mm_struct *mm, struct page *page)
 73 {
 74         __free_page(page);
 75 }
 76 
 77 /*
 78  * In our implementation, each pgd entry contains 1 pmd that is never allocated
 79  * or freed.  pgd_present is always 1, so this should never be called. -NL
 80  */
 81 #define pmd_free(mm, pmd) BUG()
 82 
 83 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
 84 {
 85         free_page((unsigned long) pgd);
 86 }
 87 
 88 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
 89 {
 90         pgd_t *new_pgd;
 91 
 92         new_pgd = (pgd_t *)__get_free_page(GFP_DMA | __GFP_NOWARN);
 93         if (!new_pgd)
 94                 return NULL;
 95         memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE);
 96         memset(new_pgd, 0, PAGE_OFFSET >> PGDIR_SHIFT);
 97         return new_pgd;
 98 }
 99 
100 #define pgd_populate(mm, pmd, pte) BUG()
101 
102 #endif /* M68K_MCF_PGALLOC_H */
103 

~ [ 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