blob: 8cc97bfd37893583e850b26f9fbd1f1b24265dc7 [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
Sam Ravnborgb2b5d372007-10-16 01:26:35 -07006#include <linux/const.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#include <asm/pal.h>
8
9/* PAGE_SHIFT determines the page size */
10#define PAGE_SHIFT 13
Sam Ravnborgb2b5d372007-10-16 01:26:35 -070011#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#define PAGE_MASK (~(PAGE_SIZE-1))
13
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#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
Mel Gorman769848c2007-07-17 04:03:05 -070021#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
22 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vmaddr)
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
24
25extern void copy_page(void * _to, void * _from);
26#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
27
28#ifdef STRICT_MM_TYPECHECKS
29/*
30 * These are used to make use of C type-checking..
31 */
32typedef struct { unsigned long pte; } pte_t;
33typedef struct { unsigned long pmd; } pmd_t;
34typedef struct { unsigned long pgd; } pgd_t;
35typedef struct { unsigned long pgprot; } pgprot_t;
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#else
48/*
49 * .. while these make it easier on the compiler
50 */
51typedef unsigned long pte_t;
52typedef unsigned long pmd_t;
53typedef unsigned long pgd_t;
54typedef unsigned long pgprot_t;
55
56#define pte_val(x) (x)
57#define pmd_val(x) (x)
58#define pgd_val(x) (x)
59#define pgprot_val(x) (x)
60
61#define __pte(x) (x)
62#define __pgd(x) (x)
63#define __pgprot(x) (x)
64
65#endif /* STRICT_MM_TYPECHECKS */
66
Linus Torvalds1da177e2005-04-16 15:20:36 -070067#ifdef USE_48_BIT_KSEG
68#define PAGE_OFFSET 0xffff800000000000UL
69#else
70#define PAGE_OFFSET 0xfffffc0000000000UL
71#endif
72
73#else
74
75#ifdef USE_48_BIT_KSEG
76#define PAGE_OFFSET 0xffff800000000000
77#else
78#define PAGE_OFFSET 0xfffffc0000000000
79#endif
80
81#endif /* !__ASSEMBLY__ */
82
83/* to align the pointer to the (next) page boundary */
84#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
85
86#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
87#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
88#ifndef CONFIG_DISCONTIGMEM
Linus Torvalds1da177e2005-04-16 15:20:36 -070089#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
90
91#define pfn_valid(pfn) ((pfn) < max_mapnr)
92#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
93#endif /* CONFIG_DISCONTIGMEM */
94
95#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
96 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
Linus Torvalds1da177e2005-04-16 15:20:36 -070097
KAMEZAWA Hiroyuki1c05dda2006-03-27 01:15:36 -080098#include <asm-generic/memory_model.h>
Stephen Rothwellfd4fd5a2005-09-03 15:54:30 -070099#include <asm-generic/page.h>
100
David Woodhouse7f9d77d2006-09-16 12:15:49 -0700101#endif /* __KERNEL__ */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102#endif /* _ALPHA_PAGE_H */