aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-alpha/page.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-alpha/page.h')
-rw-r--r--include/asm-alpha/page.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h
new file mode 100644
index 000000000000..0577daffc720
--- /dev/null
+++ b/include/asm-alpha/page.h
@@ -0,0 +1,115 @@
1#ifndef _ALPHA_PAGE_H
2#define _ALPHA_PAGE_H
3
4#include <linux/config.h>
5#include <asm/pal.h>
6
7/* PAGE_SHIFT determines the page size */
8#define PAGE_SHIFT 13
9#define PAGE_SIZE (1UL << PAGE_SHIFT)
10#define PAGE_MASK (~(PAGE_SIZE-1))
11
12#ifdef __KERNEL__
13
14#ifndef __ASSEMBLY__
15
16#define STRICT_MM_TYPECHECKS
17
18extern void clear_page(void *page);
19#define clear_user_page(page, vaddr, pg) clear_page(page)
20
21#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vmaddr)
22#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
23
24extern void copy_page(void * _to, void * _from);
25#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
26
27#ifdef STRICT_MM_TYPECHECKS
28/*
29 * These are used to make use of C type-checking..
30 */
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
36#define pte_val(x) ((x).pte)
37#define pmd_val(x) ((x).pmd)
38#define pgd_val(x) ((x).pgd)
39#define pgprot_val(x) ((x).pgprot)
40
41#define __pte(x) ((pte_t) { (x) } )
42#define __pmd(x) ((pmd_t) { (x) } )
43#define __pgd(x) ((pgd_t) { (x) } )
44#define __pgprot(x) ((pgprot_t) { (x) } )
45
46#else
47/*
48 * .. while these make it easier on the compiler
49 */
50typedef unsigned long pte_t;
51typedef unsigned long pmd_t;
52typedef unsigned long pgd_t;
53typedef unsigned long pgprot_t;
54
55#define pte_val(x) (x)
56#define pmd_val(x) (x)
57#define pgd_val(x) (x)
58#define pgprot_val(x) (x)
59
60#define __pte(x) (x)
61#define __pgd(x) (x)
62#define __pgprot(x) (x)
63
64#endif /* STRICT_MM_TYPECHECKS */
65
66/* Pure 2^n version of get_order */
67extern __inline__ int get_order(unsigned long size)
68{
69 int order;
70
71 size = (size-1) >> (PAGE_SHIFT-1);
72 order = -1;
73 do {
74 size >>= 1;
75 order++;
76 } while (size);
77 return order;
78}
79
80#ifdef USE_48_BIT_KSEG
81#define PAGE_OFFSET 0xffff800000000000UL
82#else
83#define PAGE_OFFSET 0xfffffc0000000000UL
84#endif
85
86#else
87
88#ifdef USE_48_BIT_KSEG
89#define PAGE_OFFSET 0xffff800000000000
90#else
91#define PAGE_OFFSET 0xfffffc0000000000
92#endif
93
94#endif /* !__ASSEMBLY__ */
95
96/* to align the pointer to the (next) page boundary */
97#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
98
99#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
100#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
101#ifndef CONFIG_DISCONTIGMEM
102#define pfn_to_page(pfn) (mem_map + (pfn))
103#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
104#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
105
106#define pfn_valid(pfn) ((pfn) < max_mapnr)
107#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
108#endif /* CONFIG_DISCONTIGMEM */
109
110#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
111 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
112
113#endif /* __KERNEL__ */
114
115#endif /* _ALPHA_PAGE_H */