GNU Linux-libre 5.4.274-gnu1
[releases.git] / arch / unicore32 / include / asm / page.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * linux/arch/unicore32/include/asm/page.h
4  *
5  * Code specific to PKUnity SoC and UniCore ISA
6  *
7  * Copyright (C) 2001-2010 GUAN Xue-tao
8  */
9 #ifndef __UNICORE_PAGE_H__
10 #define __UNICORE_PAGE_H__
11
12 /* PAGE_SHIFT determines the page size */
13 #define PAGE_SHIFT              12
14 #define PAGE_SIZE               (_AC(1, UL) << PAGE_SHIFT)
15 #define PAGE_MASK               (~(PAGE_SIZE-1))
16
17 #ifndef __ASSEMBLY__
18
19 struct page;
20 struct vm_area_struct;
21
22 #define clear_page(page)        memset((void *)(page), 0, PAGE_SIZE)
23 extern void copy_page(void *to, const void *from);
24
25 #define clear_user_page(page, vaddr, pg)        clear_page(page)
26 #define copy_user_page(to, from, vaddr, pg)     copy_page(to, from)
27
28 #undef STRICT_MM_TYPECHECKS
29
30 #ifdef STRICT_MM_TYPECHECKS
31 /*
32  * These are used to make use of C type-checking..
33  */
34 typedef struct { unsigned long pte; } pte_t;
35 typedef struct { unsigned long pgd; } pgd_t;
36 typedef struct { unsigned long pgprot; } pgprot_t;
37
38 #define pte_val(x)      ((x).pte)
39 #define pgd_val(x)      ((x).pgd)
40 #define pgprot_val(x)   ((x).pgprot)
41
42 #define __pte(x)        ((pte_t) { (x) })
43 #define __pgd(x)        ((pgd_t) { (x) })
44 #define __pgprot(x)     ((pgprot_t) { (x) })
45
46 #else
47 /*
48  * .. while these make it easier on the compiler
49  */
50 typedef unsigned long pte_t;
51 typedef unsigned long pgd_t;
52 typedef unsigned long pgprot_t;
53
54 #define pte_val(x)      (x)
55 #define pgd_val(x)      (x)
56 #define pgprot_val(x)   (x)
57
58 #define __pte(x)        (x)
59 #define __pgd(x)        (x)
60 #define __pgprot(x)     (x)
61
62 #endif /* STRICT_MM_TYPECHECKS */
63
64 typedef struct page *pgtable_t;
65
66 extern int pfn_valid(unsigned long);
67
68 #include <asm/memory.h>
69
70 #endif /* !__ASSEMBLY__ */
71
72 #define VM_DATA_DEFAULT_FLAGS \
73         (VM_READ | VM_WRITE | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
74
75 #include <asm-generic/getorder.h>
76
77 #endif