2 * linux/include/asm-arm/pgalloc.h
4 * Copyright (C) 2000-2001 Russell King
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 #ifndef _ASMARM_PGALLOC_H
11 #define _ASMARM_PGALLOC_H
13 #include <asm/processor.h>
14 #include <asm/cacheflush.h>
15 #include <asm/tlbflush.h>
16 #include <linux/slab.h>
18 extern struct kmem_cache *pte_cache;
20 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr){
21 return kmem_cache_alloc(pte_cache, GFP_KERNEL);
24 static inline void pte_free_kernel(pte_t *pte){
26 kmem_cache_free(pte_cache, pte);
30 * Populate the pmdp entry with a pointer to the pte. This pmd is part
31 * of the mm address space.
33 * If 'mm' is the init tasks mm, then we are doing a vmalloc, and we
34 * need to set stuff up correctly for it.
37 pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep)
39 //FIXME - is this doing the right thing?
40 set_pmd(pmdp, (unsigned long)ptep | 1/*FIXME _PMD_PRESENT*/);
44 * FIXME - We use the old 2.5.5-rmk1 hack for this.
45 * This is not truly correct, but should be functional.
47 #define pte_alloc_one(mm,addr) ((struct page *)pte_alloc_one_kernel(mm,addr))
48 #define pte_free(pte) pte_free_kernel((pte_t *)pte)
49 #define pmd_populate(mm,pmdp,ptep) pmd_populate_kernel(mm,pmdp,(pte_t *)ptep)
52 * Since we have only two-level page tables, these are trivial
54 * trick __pmd_alloc into optimising away. The actual value is irrelevant though as it
55 * is thrown away. It just cant be zero. -IM
58 #define pmd_alloc_one(mm,addr) ({ BUG(); ((pmd_t *)2); })
59 #define pmd_free(pmd) do { } while (0)
60 #define pgd_populate(mm,pmd,pte) BUG()
62 extern pgd_t *get_pgd_slow(struct mm_struct *mm);
63 extern void free_pgd_slow(pgd_t *pgd);
65 #define pgd_alloc(mm) get_pgd_slow(mm)
66 #define pgd_free(pgd) free_pgd_slow(pgd)
68 #define check_pgt_cache() do { } while (0)