aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-cris/page.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-cris/page.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-cris/page.h')
-rw-r--r--include/asm-cris/page.h105
1 files changed, 105 insertions, 0 deletions
diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h
new file mode 100644
index 000000000000..ddd8915e41e6
--- /dev/null
+++ b/include/asm-cris/page.h
@@ -0,0 +1,105 @@
1#ifndef _CRIS_PAGE_H
2#define _CRIS_PAGE_H
3
4#include <linux/config.h>
5#include <asm/arch/page.h>
6
7/* PAGE_SHIFT determines the page size */
8#define PAGE_SHIFT 13
9#ifndef __ASSEMBLY__
10#define PAGE_SIZE (1UL << PAGE_SHIFT)
11#else
12#define PAGE_SIZE (1 << PAGE_SHIFT)
13#endif
14#define PAGE_MASK (~(PAGE_SIZE-1))
15
16#ifdef __KERNEL__
17
18#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
19#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
20
21#define clear_user_page(page, vaddr, pg) clear_page(page)
22#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
23
24#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr)
25#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
26
27/*
28 * These are used to make use of C type-checking..
29 */
30#ifndef __ASSEMBLY__
31typedef struct { unsigned long pte; } pte_t;
32typedef struct { unsigned long pmd; } pmd_t;
33typedef struct { unsigned long pgd; } pgd_t;
34typedef struct { unsigned long pgprot; } pgprot_t;
35#endif
36
37#define pte_val(x) ((x).pte)
38#define pmd_val(x) ((x).pmd)
39#define pgd_val(x) ((x).pgd)
40#define pgprot_val(x) ((x).pgprot)
41
42#define __pte(x) ((pte_t) { (x) } )
43#define __pmd(x) ((pmd_t) { (x) } )
44#define __pgd(x) ((pgd_t) { (x) } )
45#define __pgprot(x) ((pgprot_t) { (x) } )
46
47/* On CRIS the PFN numbers doesn't start at 0 so we have to compensate */
48/* for that before indexing into the page table starting at mem_map */
49#define pfn_to_page(pfn) (mem_map + ((pfn) - (PAGE_OFFSET >> PAGE_SHIFT)))
50#define page_to_pfn(page) ((unsigned long)((page) - mem_map) + (PAGE_OFFSET >> PAGE_SHIFT))
51#define pfn_valid(pfn) (((pfn) - (PAGE_OFFSET >> PAGE_SHIFT)) < max_mapnr)
52
53/* to index into the page map. our pages all start at physical addr PAGE_OFFSET so
54 * we can let the map start there. notice that we subtract PAGE_OFFSET because
55 * we start our mem_map there - in other ports they map mem_map physically and
56 * use __pa instead. in our system both the physical and virtual address of DRAM
57 * is too high to let mem_map start at 0, so we do it this way instead (similar
58 * to arm and m68k I think)
59 */
60
61#define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT))
62#define VALID_PAGE(page) (((page) - mem_map) < max_mapnr)
63#define virt_addr_valid(kaddr) pfn_valid((unsigned)(kaddr) >> PAGE_SHIFT)
64
65/* convert a page (based on mem_map and forward) to a physical address
66 * do this by figuring out the virtual address and then use __pa
67 */
68
69#define page_to_phys(page) __pa((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
70
71/* to align the pointer to the (next) page boundary */
72#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
73
74#ifndef __ASSEMBLY__
75
76#define BUG() do { \
77 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
78} while (0)
79
80#define PAGE_BUG(page) do { \
81 BUG(); \
82} while (0)
83
84/* Pure 2^n version of get_order */
85static inline int get_order(unsigned long size)
86{
87 int order;
88
89 size = (size-1) >> (PAGE_SHIFT-1);
90 order = -1;
91 do {
92 size >>= 1;
93 order++;
94 } while (size);
95 return order;
96}
97#endif /* __ASSEMBLY__ */
98
99#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
100 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
101
102#endif /* __KERNEL__ */
103
104#endif /* _CRIS_PAGE_H */
105