disable sstrip when using musl
[openwrt/openwrt.git] / target / linux / ubicom32 / files / arch / ubicom32 / include / asm / page.h
1 /*
2 * arch/ubicom32/include/asm/page.h
3 * Memory page related operations and definitions.
4 *
5 * (C) Copyright 2009, Ubicom, Inc.
6 *
7 * This file is part of the Ubicom32 Linux Kernel Port.
8 *
9 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
10 * it and/or modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation, either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with the Ubicom32 Linux Kernel Port. If not,
21 * see <http://www.gnu.org/licenses/>.
22 *
23 * Ubicom32 implementation derived from (with many thanks):
24 * arch/m68knommu
25 * arch/blackfin
26 * arch/parisc
27 */
28 #ifndef _ASM_UBICOM32_PAGE_H
29 #define _ASM_UBICOM32_PAGE_H
30
31 #include <linux/const.h>
32
33 /* PAGE_SHIFT determines the page size */
34
35 #define PAGE_SHIFT (12)
36 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
37 #define PAGE_MASK (~(PAGE_SIZE-1))
38
39 #include <asm/setup.h>
40
41 #ifndef __ASSEMBLY__
42
43 #define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
44 #define free_user_page(page, addr) free_page(addr)
45
46 #define clear_page(page) memset((page), 0, PAGE_SIZE)
47 #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
48
49 #define clear_user_page(page, vaddr, pg) clear_page(page)
50 #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
51
52 #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
53 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
54 #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
55
56 /*
57 * These are used to make use of C type-checking..
58 */
59 typedef struct { unsigned long pte; } pte_t;
60 typedef struct { unsigned long pmd[16]; } pmd_t;
61 typedef struct { unsigned long pgd; } pgd_t;
62 typedef struct { unsigned long pgprot; } pgprot_t;
63 typedef struct page *pgtable_t;
64
65 #define pte_val(x) ((x).pte)
66 #define pmd_val(x) ((&x)->pmd[0])
67 #define pgd_val(x) ((x).pgd)
68 #define pgprot_val(x) ((x).pgprot)
69
70 #define __pte(x) ((pte_t) { (x) } )
71 #define __pmd(x) ((pmd_t) { (x) } )
72 #define __pgd(x) ((pgd_t) { (x) } )
73 #define __pgprot(x) ((pgprot_t) { (x) } )
74
75 extern unsigned long memory_start;
76 extern unsigned long memory_end;
77
78 #endif /* !__ASSEMBLY__ */
79
80 #include <asm/page_offset.h>
81
82 #define PAGE_OFFSET (PAGE_OFFSET_RAW)
83
84 #ifndef __ASSEMBLY__
85
86 #define __pa(vaddr) virt_to_phys((void *)(vaddr))
87 #define __va(paddr) phys_to_virt((unsigned long)(paddr))
88
89 #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
90 #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
91
92 #define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
93 #define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
94
95 #define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn))
96 #define page_to_pfn(page) virt_to_pfn(page_to_virt(page))
97 #define pfn_valid(pfn) ((pfn) < max_mapnr)
98
99 #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
100 ((void *)(kaddr) < (void *)memory_end))
101
102 #endif /* __ASSEMBLY__ */
103
104 #define VM_DATA_DEFAULT_FLAGS \
105 (VM_READ | VM_WRITE | \
106 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
107 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
108
109 #include <linux/version.h>
110 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
111 #include <asm-generic/getorder.h>
112 #else
113 #include <asm-generic/page.h>
114 #endif
115
116 #endif /* _ASM_UBICOM32_PAGE_H */