diff options
Diffstat (limited to 'include/asm-cris/arch-v32/mmu.h')
-rw-r--r-- | include/asm-cris/arch-v32/mmu.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/include/asm-cris/arch-v32/mmu.h b/include/asm-cris/arch-v32/mmu.h new file mode 100644 index 000000000000..6bcdc3fdf7dc --- /dev/null +++ b/include/asm-cris/arch-v32/mmu.h | |||
@@ -0,0 +1,111 @@ | |||
1 | #ifndef _ASM_CRIS_ARCH_MMU_H | ||
2 | #define _ASM_CRIS_ARCH_MMU_H | ||
3 | |||
4 | /* MMU context type. */ | ||
5 | typedef struct | ||
6 | { | ||
7 | unsigned int page_id; | ||
8 | } mm_context_t; | ||
9 | |||
10 | /* Kernel memory segments. */ | ||
11 | #define KSEG_F 0xf0000000UL | ||
12 | #define KSEG_E 0xe0000000UL | ||
13 | #define KSEG_D 0xd0000000UL | ||
14 | #define KSEG_C 0xc0000000UL | ||
15 | #define KSEG_B 0xb0000000UL | ||
16 | #define KSEG_A 0xa0000000UL | ||
17 | #define KSEG_9 0x90000000UL | ||
18 | #define KSEG_8 0x80000000UL | ||
19 | #define KSEG_7 0x70000000UL | ||
20 | #define KSEG_6 0x60000000UL | ||
21 | #define KSEG_5 0x50000000UL | ||
22 | #define KSEG_4 0x40000000UL | ||
23 | #define KSEG_3 0x30000000UL | ||
24 | #define KSEG_2 0x20000000UL | ||
25 | #define KSEG_1 0x10000000UL | ||
26 | #define KSEG_0 0x00000000UL | ||
27 | |||
28 | /* | ||
29 | * CRISv32 PTE bits: | ||
30 | * | ||
31 | * Bit: 31-13 12-5 4 3 2 1 0 | ||
32 | * +-----+------+--------+-------+--------+-------+---------+ | ||
33 | * | pfn | zero | global | valid | kernel | write | execute | | ||
34 | * +-----+------+--------+-------+--------+-------+---------+ | ||
35 | */ | ||
36 | |||
37 | /* | ||
38 | * Defines for accessing the bits. Also define some synonyms for use with | ||
39 | * the software-based defined bits below. | ||
40 | */ | ||
41 | #define _PAGE_EXECUTE (1 << 0) /* Execution bit. */ | ||
42 | #define _PAGE_WE (1 << 1) /* Write bit. */ | ||
43 | #define _PAGE_SILENT_WRITE (1 << 1) /* Same as above. */ | ||
44 | #define _PAGE_KERNEL (1 << 2) /* Kernel mode page. */ | ||
45 | #define _PAGE_VALID (1 << 3) /* Page is valid. */ | ||
46 | #define _PAGE_SILENT_READ (1 << 3) /* Same as above. */ | ||
47 | #define _PAGE_GLOBAL (1 << 4) /* Global page. */ | ||
48 | |||
49 | /* | ||
50 | * The hardware doesn't care about these bits, but the kernel uses them in | ||
51 | * software. | ||
52 | */ | ||
53 | #define _PAGE_PRESENT (1 << 5) /* Page is present in memory. */ | ||
54 | #define _PAGE_FILE (1 << 6) /* 1=pagecache, 0=swap (when !present) */ | ||
55 | #define _PAGE_ACCESSED (1 << 6) /* Simulated in software using valid bit. */ | ||
56 | #define _PAGE_MODIFIED (1 << 7) /* Simulated in software using we bit. */ | ||
57 | #define _PAGE_READ (1 << 8) /* Read enabled. */ | ||
58 | #define _PAGE_WRITE (1 << 9) /* Write enabled. */ | ||
59 | |||
60 | /* Define some higher level generic page attributes. */ | ||
61 | #define __READABLE (_PAGE_READ | _PAGE_SILENT_READ | _PAGE_ACCESSED) | ||
62 | #define __WRITEABLE (_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED) | ||
63 | |||
64 | #define _PAGE_TABLE (_PAGE_PRESENT | __READABLE | __WRITEABLE) | ||
65 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED) | ||
66 | |||
67 | #define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) | ||
68 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | __READABLE | _PAGE_WRITE | \ | ||
69 | _PAGE_ACCESSED) | ||
70 | #define PAGE_SHARED_EXEC __pgprot(_PAGE_PRESENT | __READABLE | _PAGE_WRITE | \ | ||
71 | _PAGE_ACCESSED | _PAGE_EXECUTE) | ||
72 | |||
73 | #define PAGE_READONLY __pgprot(_PAGE_PRESENT | __READABLE) | ||
74 | #define PAGE_READONLY_EXEC __pgprot(_PAGE_PRESENT | __READABLE | _PAGE_EXECUTE | _PAGE_ACCESSED) | ||
75 | |||
76 | #define PAGE_COPY __pgprot(_PAGE_PRESENT | __READABLE) | ||
77 | #define PAGE_COPY_EXEC __pgprot(_PAGE_PRESENT | __READABLE | _PAGE_EXECUTE) | ||
78 | #define PAGE_KERNEL __pgprot(_PAGE_GLOBAL | _PAGE_KERNEL | \ | ||
79 | _PAGE_PRESENT | __READABLE | __WRITEABLE) | ||
80 | #define PAGE_KERNEL_EXEC __pgprot(_PAGE_GLOBAL | _PAGE_KERNEL | _PAGE_EXECUTE | \ | ||
81 | _PAGE_PRESENT | __READABLE | __WRITEABLE) | ||
82 | #define PAGE_SIGNAL_TRAMPOLINE __pgprot(_PAGE_GLOBAL | _PAGE_EXECUTE | \ | ||
83 | _PAGE_PRESENT | __READABLE) | ||
84 | |||
85 | #define _KERNPG_TABLE (_PAGE_TABLE | _PAGE_KERNEL) | ||
86 | |||
87 | /* CRISv32 can do page protection for execute. | ||
88 | * Write permissions imply read permissions. | ||
89 | * Note that the numbers are in Execute-Write-Read order! | ||
90 | */ | ||
91 | #define __P000 PAGE_NONE | ||
92 | #define __P001 PAGE_READONLY | ||
93 | #define __P010 PAGE_COPY | ||
94 | #define __P011 PAGE_COPY | ||
95 | #define __P100 PAGE_READONLY_EXEC | ||
96 | #define __P101 PAGE_READONLY_EXEC | ||
97 | #define __P110 PAGE_COPY_EXEC | ||
98 | #define __P111 PAGE_COPY_EXEC | ||
99 | |||
100 | #define __S000 PAGE_NONE | ||
101 | #define __S001 PAGE_READONLY | ||
102 | #define __S010 PAGE_SHARED | ||
103 | #define __S011 PAGE_SHARED | ||
104 | #define __S100 PAGE_READONLY_EXEC | ||
105 | #define __S101 PAGE_READONLY_EXEC | ||
106 | #define __S110 PAGE_SHARED_EXEC | ||
107 | #define __S111 PAGE_SHARED_EXEC | ||
108 | |||
109 | #define PTE_FILE_MAX_BITS 25 | ||
110 | |||
111 | #endif /* _ASM_CRIS_ARCH_MMU_H */ | ||