blob: d2bed3cb33ff106309d297afe747cf73513276fd [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ALPHA_PAGE_H
2#define _ALPHA_PAGE_H
3
David Woodhouse7f9d77d2006-09-16 12:15:49 -07004#ifdef __KERNEL__
5
Linus Torvalds1da177e2005-04-16 15:20:36 -07006#include <asm/pal.h>
7
8/* PAGE_SHIFT determines the page size */
9#define PAGE_SHIFT 13
10#define PAGE_SIZE (1UL << PAGE_SHIFT)
11#define PAGE_MASK (~(PAGE_SIZE-1))
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#ifndef __ASSEMBLY__
14
15#define STRICT_MM_TYPECHECKS
16
17extern void clear_page(void *page);
18#define clear_user_page(page, vaddr, pg) clear_page(page)
19
20#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vmaddr)
21#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
22
23extern void copy_page(void * _to, void * _from);
24#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
25
26#ifdef STRICT_MM_TYPECHECKS
27/*
28 * These are used to make use of C type-checking..
29 */
30typedef struct { unsigned long pte; } pte_t;
31typedef struct { unsigned long pmd; } pmd_t;
32typedef struct { unsigned long pgd; } pgd_t;
33typedef struct { unsigned long pgprot; } pgprot_t;
34
35#define pte_val(x) ((x).pte)
36#define pmd_val(x) ((x).pmd)
37#define pgd_val(x) ((x).pgd)
38#define pgprot_val(x) ((x).pgprot)
39
40#define __pte(x) ((pte_t) { (x) } )
41#define __pmd(x) ((pmd_t) { (x) } )
42#define __pgd(x) ((pgd_t) { (x) } )
43#define __pgprot(x) ((pgprot_t) { (x) } )
44
45#else
46/*
47 * .. while these make it easier on the compiler
48 */
49typedef unsigned long pte_t;
50typedef unsigned long pmd_t;
51typedef unsigned long pgd_t;
52typedef unsigned long pgprot_t;
53
54#define pte_val(x) (x)
55#define pmd_val(x) (x)
56#define pgd_val(x) (x)
57#define pgprot_val(x) (x)
58
59#define __pte(x) (x)
60#define __pgd(x) (x)
61#define __pgprot(x) (x)
62
63#endif /* STRICT_MM_TYPECHECKS */
64
Linus Torvalds1da177e2005-04-16 15:20:36 -070065#ifdef USE_48_BIT_KSEG
66#define PAGE_OFFSET 0xffff800000000000UL
67#else
68#define PAGE_OFFSET 0xfffffc0000000000UL
69#endif
70
71#else
72
73#ifdef USE_48_BIT_KSEG
74#define PAGE_OFFSET 0xffff800000000000
75#else
76#define PAGE_OFFSET 0xfffffc0000000000
77#endif
78
79#endif /* !__ASSEMBLY__ */
80
81/* to align the pointer to the (next) page boundary */
82#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
83
84#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
85#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
86#ifndef CONFIG_DISCONTIGMEM
Linus Torvalds1da177e2005-04-16 15:20:36 -070087#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
88
89#define pfn_valid(pfn) ((pfn) < max_mapnr)
90#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
91#endif /* CONFIG_DISCONTIGMEM */
92
93#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
94 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
Linus Torvalds1da177e2005-04-16 15:20:36 -070095
KAMEZAWA Hiroyuki1c05dda2006-03-27 01:15:36 -080096#include <asm-generic/memory_model.h>
Stephen Rothwellfd4fd5a2005-09-03 15:54:30 -070097#include <asm-generic/page.h>
98
David Woodhouse7f9d77d2006-09-16 12:15:49 -070099#endif /* __KERNEL__ */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100#endif /* _ALPHA_PAGE_H */