Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
page.h
Go to the documentation of this file.
1 /*
2  * linux/arch/unicore32/include/asm/page.h
3  *
4  * Code specific to PKUnity SoC and UniCore ISA
5  *
6  * Copyright (C) 2001-2010 GUAN Xue-tao
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12 #ifndef __UNICORE_PAGE_H__
13 #define __UNICORE_PAGE_H__
14 
15 /* PAGE_SHIFT determines the page size */
16 #define PAGE_SHIFT 12
17 #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
18 #define PAGE_MASK (~(PAGE_SIZE-1))
19 
20 #ifndef __ASSEMBLY__
21 
22 struct page;
23 struct vm_area_struct;
24 
25 #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
26 extern void copy_page(void *to, const void *from);
27 
28 #define clear_user_page(page, vaddr, pg) clear_page(page)
29 #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
30 
31 #undef STRICT_MM_TYPECHECKS
32 
33 #ifdef STRICT_MM_TYPECHECKS
34 /*
35  * These are used to make use of C type-checking..
36  */
37 typedef struct { unsigned long pte; } pte_t;
38 typedef struct { unsigned long pgd; } pgd_t;
39 typedef struct { unsigned long pgprot; } pgprot_t;
40 
41 #define pte_val(x) ((x).pte)
42 #define pgd_val(x) ((x).pgd)
43 #define pgprot_val(x) ((x).pgprot)
44 
45 #define __pte(x) ((pte_t) { (x) })
46 #define __pgd(x) ((pgd_t) { (x) })
47 #define __pgprot(x) ((pgprot_t) { (x) })
48 
49 #else
50 /*
51  * .. while these make it easier on the compiler
52  */
53 typedef unsigned long pte_t;
54 typedef unsigned long pgd_t;
55 typedef unsigned long pgprot_t;
56 
57 #define pte_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 
67 typedef struct page *pgtable_t;
68 
69 extern int pfn_valid(unsigned long);
70 
71 #include <asm/memory.h>
72 
73 #endif /* !__ASSEMBLY__ */
74 
75 #define VM_DATA_DEFAULT_FLAGS \
76  (VM_READ | VM_WRITE | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
77 
78 #include <asm-generic/getorder.h>
79 
80 #endif