Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/include/asm-arm/pgalloc.h |
| 3 | * |
| 4 | * Copyright (C) 2000-2001 Russell King |
| 5 | * |
| 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. |
| 9 | */ |
| 10 | #ifndef _ASMARM_PGALLOC_H |
| 11 | #define _ASMARM_PGALLOC_H |
| 12 | |
| 13 | #include <asm/processor.h> |
| 14 | #include <asm/cacheflush.h> |
| 15 | #include <asm/tlbflush.h> |
| 16 | #include <linux/slab.h> |
| 17 | |
| 18 | extern kmem_cache_t *pte_cache; |
| 19 | |
| 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); |
| 22 | } |
| 23 | |
| 24 | static inline void pte_free_kernel(pte_t *pte){ |
| 25 | if (pte) |
| 26 | kmem_cache_free(pte_cache, pte); |
| 27 | } |
| 28 | |
| 29 | /* |
| 30 | * Populate the pmdp entry with a pointer to the pte. This pmd is part |
| 31 | * of the mm address space. |
| 32 | * |
| 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. |
| 35 | */ |
| 36 | static inline void |
| 37 | pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep) |
| 38 | { |
| 39 | //FIXME - is this doing the right thing? |
| 40 | set_pmd(pmdp, (unsigned long)ptep | 1/*FIXME _PMD_PRESENT*/); |
| 41 | } |
| 42 | |
| 43 | /* |
| 44 | * FIXME - We use the old 2.5.5-rmk1 hack for this. |
| 45 | * This is not truly correct, but should be functional. |
| 46 | */ |
| 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) |
| 50 | |
| 51 | /* |
| 52 | * Since we have only two-level page tables, these are trivial |
| 53 | * |
| 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 |
| 56 | */ |
| 57 | |
| 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() |
| 61 | |
| 62 | extern pgd_t *get_pgd_slow(struct mm_struct *mm); |
| 63 | extern void free_pgd_slow(pgd_t *pgd); |
| 64 | |
| 65 | #define pgd_alloc(mm) get_pgd_slow(mm) |
| 66 | #define pgd_free(pgd) free_pgd_slow(pgd) |
| 67 | |
| 68 | #define check_pgt_cache() do { } while (0) |
| 69 | |
| 70 | #endif |