blob: 1f31b060cc8da823b2fe065cfa2f0bf783447417 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _M68KNOMMU_PAGE_H
2#define _M68KNOMMU_PAGE_H
3
Tim Abbott29857092009-09-07 17:26:49 +10004#include <linux/const.h>
5
Linus Torvalds1da177e2005-04-16 15:20:36 -07006/* PAGE_SHIFT determines the page size */
7
8#define PAGE_SHIFT (12)
Tim Abbott29857092009-09-07 17:26:49 +10009#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#define PAGE_MASK (~(PAGE_SIZE-1))
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <asm/setup.h>
13
14#ifndef __ASSEMBLY__
15
16#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
17#define free_user_page(page, addr) free_page(addr)
18
19#define clear_page(page) memset((page), 0, PAGE_SIZE)
20#define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
21
22#define clear_user_page(page, vaddr, pg) clear_page(page)
23#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
24
Mel Gorman769848c2007-07-17 04:03:05 -070025#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
26 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
28
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[16]; } pmd_t;
34typedef struct { unsigned long pgd; } pgd_t;
35typedef struct { unsigned long pgprot; } pgprot_t;
Martin Schwidefsky941edd02008-02-09 03:11:21 -080036typedef struct page *pgtable_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
38#define pte_val(x) ((x).pte)
39#define pmd_val(x) ((&x)->pmd[0])
40#define pgd_val(x) ((x).pgd)
41#define pgprot_val(x) ((x).pgprot)
42
43#define __pte(x) ((pte_t) { (x) } )
44#define __pmd(x) ((pmd_t) { (x) } )
45#define __pgd(x) ((pgd_t) { (x) } )
46#define __pgprot(x) ((pgprot_t) { (x) } )
47
Linus Torvalds1da177e2005-04-16 15:20:36 -070048extern unsigned long memory_start;
49extern unsigned long memory_end;
50
51#endif /* !__ASSEMBLY__ */
52
53#include <asm/page_offset.h>
54
55#define PAGE_OFFSET (PAGE_OFFSET_RAW)
56
57#ifndef __ASSEMBLY__
58
Greg Ungerere70bd112005-09-02 10:42:52 +100059#define __pa(vaddr) virt_to_phys((void *)(vaddr))
60#define __va(paddr) phys_to_virt((unsigned long)(paddr))
Linus Torvalds1da177e2005-04-16 15:20:36 -070061
62#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
63#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
64
65#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
66#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
67
68#define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn))
69#define page_to_pfn(page) virt_to_pfn(page_to_virt(page))
Greg Ungerere70bd112005-09-02 10:42:52 +100070#define pfn_valid(pfn) ((pfn) < max_mapnr)
Linus Torvalds1da177e2005-04-16 15:20:36 -070071
72#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
73 ((void *)(kaddr) < (void *)memory_end))
74
75#endif /* __ASSEMBLY__ */
76
Arnd Bergmann5b17e1c2009-05-13 22:56:30 +000077#include <asm-generic/getorder.h>
Stephen Rothwellfd4fd5a2005-09-03 15:54:30 -070078
Linus Torvalds1da177e2005-04-16 15:20:36 -070079#endif /* _M68KNOMMU_PAGE_H */