1 /* SPDX-License-Identifier: GPL-2.0 */
3 * reorganization around 2.3.39, routines moved from sun3_pgtable.h
6 * 02/27/2002 -- Modified to support "highpte" implementation in 2.5.5 (Sam)
8 * moved 1/26/2000 Sam Creasey
11 #ifndef _SUN3_PGALLOC_H
12 #define _SUN3_PGALLOC_H
16 #include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */
18 extern const char bad_pmd_string[];
20 #define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); })
22 #define __pte_free_tlb(tlb,pte,addr) \
24 pgtable_pte_page_dtor(pte); \
25 tlb_remove_page((tlb), pte); \
28 static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
30 pmd_val(*pmd) = __pa((unsigned long)pte);
33 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t page)
35 pmd_val(*pmd) = __pa((unsigned long)page_address(page));
37 #define pmd_pgtable(pmd) pmd_page(pmd)
40 * allocating and freeing a pmd is trivial: the 1-entry pmd is
41 * inside the pgd, so has no extra memory associated with it.
43 #define pmd_free(mm, x) do { } while (0)
44 #define __pmd_free_tlb(tlb, x, addr) do { } while (0)
46 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
48 free_page((unsigned long) pgd);
51 static inline pgd_t * pgd_alloc(struct mm_struct *mm)
55 new_pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL);
56 memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE);
57 memset(new_pgd, 0, (PAGE_OFFSET >> PGDIR_SHIFT));
61 #define pgd_populate(mm, pmd, pte) BUG()
63 #endif /* SUN3_PGALLOC_H */