This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / asm-arm26 / rmap.h
1 #ifndef _ARM_RMAP_H
2 #define _ARM_RMAP_H
3
4 /*
5  * linux/include/asm-arm26/proc-armv/rmap.h
6  *
7  * Architecture dependant parts of the reverse mapping code,
8  *
9  * ARM is different since hardware page tables are smaller than
10  * the page size and Linux uses a "duplicate" one with extra info.
11  * For rmap this means that the first 2 kB of a page are the hardware
12  * page tables and the last 2 kB are the software page tables.
13  */
14
15 static inline void pgtable_add_rmap(struct page *page, struct mm_struct * mm, unsigned long address)
16 {
17         page->mapping = (void *)mm;
18         page->index = address & ~((PTRS_PER_PTE * PAGE_SIZE) - 1);
19         inc_page_state(nr_page_table_pages);
20 }
21
22 static inline void pgtable_remove_rmap(struct page *page)
23 {
24         page->mapping = NULL;
25         page->index = 0;
26         dec_page_state(nr_page_table_pages);
27 }
28
29 static inline struct mm_struct * ptep_to_mm(pte_t * ptep)
30 {
31         struct page * page = virt_to_page(ptep);
32         return (struct mm_struct *)page->mapping;
33 }
34
35 /* The page table takes half of the page */
36 #define PTE_MASK  ((PAGE_SIZE / 2) - 1)
37
38 static inline unsigned long ptep_to_address(pte_t * ptep)
39 {
40         struct page * page = virt_to_page(ptep);
41         unsigned long low_bits;
42
43         low_bits = ((unsigned long)ptep & PTE_MASK) * PTRS_PER_PTE;
44         return page->index + low_bits;
45 }
46  
47 //FIXME!!! IS these correct?
48 static inline pte_addr_t ptep_to_paddr(pte_t *ptep)
49 {
50         return (pte_addr_t)ptep;
51 }
52
53 static inline pte_t *rmap_ptep_map(pte_addr_t pte_paddr)
54 {
55         return (pte_t *)pte_paddr;
56 }
57
58 static inline void rmap_ptep_unmap(pte_t *pte)
59 {
60         return;
61 }
62
63
64 //#include <asm-generic/rmap.h>
65
66 #endif /* _ARM_RMAP_H */