File: rmap.h

package info (click to toggle)
linux-kernel-headers 2.5.999-test7-bk-17
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 28,268 kB
  • ctags: 214,024
  • sloc: ansic: 324,929; cpp: 783; makefile: 79; asm: 61; sh: 61
file content (66 lines) | stat: -rw-r--r-- 1,677 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef _ARM_RMAP_H
#define _ARM_RMAP_H

/*
 * linux/include/asm-arm26/proc-armv/rmap.h
 *
 * Architecture dependant parts of the reverse mapping code,
 *
 * ARM is different since hardware page tables are smaller than
 * the page size and Linux uses a "duplicate" one with extra info.
 * For rmap this means that the first 2 kB of a page are the hardware
 * page tables and the last 2 kB are the software page tables.
 */

static inline void pgtable_add_rmap(struct page *page, struct mm_struct * mm, unsigned long address)
{
        page->mapping = (void *)mm;
        page->index = address & ~((PTRS_PER_PTE * PAGE_SIZE) - 1);
        inc_page_state(nr_page_table_pages);
}

static inline void pgtable_remove_rmap(struct page *page)
{
        page->mapping = NULL;
        page->index = 0;
        dec_page_state(nr_page_table_pages);
}

static inline struct mm_struct * ptep_to_mm(pte_t * ptep)
{
	struct page * page = virt_to_page(ptep);
        return (struct mm_struct *)page->mapping;
}

/* The page table takes half of the page */
#define PTE_MASK  ((PAGE_SIZE / 2) - 1)

static inline unsigned long ptep_to_address(pte_t * ptep)
{
        struct page * page = virt_to_page(ptep);
        unsigned long low_bits;

        low_bits = ((unsigned long)ptep & PTE_MASK) * PTRS_PER_PTE;
        return page->index + low_bits;
}
 
//FIXME!!! IS these correct?
static inline pte_addr_t ptep_to_paddr(pte_t *ptep)
{
        return (pte_addr_t)ptep;
}

static inline pte_t *rmap_ptep_map(pte_addr_t pte_paddr)
{
        return (pte_t *)pte_paddr;
}

static inline void rmap_ptep_unmap(pte_t *pte)
{
        return;
}


//#include <asm-generic/rmap.h>

#endif /* _ARM_RMAP_H */