diff options
Diffstat (limited to 'arch/score/include')
89 files changed, 2962 insertions, 0 deletions
diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild new file mode 100644 index 000000000000..b367abd4620f --- /dev/null +++ b/arch/score/include/asm/Kbuild | |||
@@ -0,0 +1,3 @@ | |||
1 | include include/asm-generic/Kbuild.asm | ||
2 | |||
3 | header-y += | ||
diff --git a/arch/score/include/asm/asmmacro.h b/arch/score/include/asm/asmmacro.h new file mode 100644 index 000000000000..a04a54cea25d --- /dev/null +++ b/arch/score/include/asm/asmmacro.h | |||
@@ -0,0 +1,161 @@ | |||
1 | #ifndef _ASM_SCORE_ASMMACRO_H | ||
2 | #define _ASM_SCORE_ASMMACRO_H | ||
3 | |||
4 | #include <asm/asm-offsets.h> | ||
5 | |||
6 | #ifdef __ASSEMBLY__ | ||
7 | |||
8 | .macro SAVE_ALL | ||
9 | mfcr r30, cr0 | ||
10 | mv r31, r0 | ||
11 | nop | ||
12 | /* if UMs == 1, change stack. */ | ||
13 | slli.c r30, r30, 28 | ||
14 | bpl 1f | ||
15 | la r31, kernelsp | ||
16 | lw r31, [r31] | ||
17 | 1: | ||
18 | mv r30, r0 | ||
19 | addri r0, r31, -PT_SIZE | ||
20 | |||
21 | sw r30, [r0, PT_R0] | ||
22 | .set r1 | ||
23 | sw r1, [r0, PT_R1] | ||
24 | .set nor1 | ||
25 | sw r2, [r0, PT_R2] | ||
26 | sw r3, [r0, PT_R3] | ||
27 | sw r4, [r0, PT_R4] | ||
28 | sw r5, [r0, PT_R5] | ||
29 | sw r6, [r0, PT_R6] | ||
30 | sw r7, [r0, PT_R7] | ||
31 | |||
32 | sw r8, [r0, PT_R8] | ||
33 | sw r9, [r0, PT_R9] | ||
34 | sw r10, [r0, PT_R10] | ||
35 | sw r11, [r0, PT_R11] | ||
36 | sw r12, [r0, PT_R12] | ||
37 | sw r13, [r0, PT_R13] | ||
38 | sw r14, [r0, PT_R14] | ||
39 | sw r15, [r0, PT_R15] | ||
40 | |||
41 | sw r16, [r0, PT_R16] | ||
42 | sw r17, [r0, PT_R17] | ||
43 | sw r18, [r0, PT_R18] | ||
44 | sw r19, [r0, PT_R19] | ||
45 | sw r20, [r0, PT_R20] | ||
46 | sw r21, [r0, PT_R21] | ||
47 | sw r22, [r0, PT_R22] | ||
48 | sw r23, [r0, PT_R23] | ||
49 | |||
50 | sw r24, [r0, PT_R24] | ||
51 | sw r25, [r0, PT_R25] | ||
52 | sw r25, [r0, PT_R25] | ||
53 | sw r26, [r0, PT_R26] | ||
54 | sw r27, [r0, PT_R27] | ||
55 | |||
56 | sw r28, [r0, PT_R28] | ||
57 | sw r29, [r0, PT_R29] | ||
58 | orri r28, r0, 0x1fff | ||
59 | li r31, 0x00001fff | ||
60 | xor r28, r28, r31 | ||
61 | |||
62 | mfcehl r30, r31 | ||
63 | sw r30, [r0, PT_CEH] | ||
64 | sw r31, [r0, PT_CEL] | ||
65 | |||
66 | mfcr r31, cr0 | ||
67 | sw r31, [r0, PT_PSR] | ||
68 | |||
69 | mfcr r31, cr1 | ||
70 | sw r31, [r0, PT_CONDITION] | ||
71 | |||
72 | mfcr r31, cr2 | ||
73 | sw r31, [r0, PT_ECR] | ||
74 | |||
75 | mfcr r31, cr5 | ||
76 | srli r31, r31, 1 | ||
77 | slli r31, r31, 1 | ||
78 | sw r31, [r0, PT_EPC] | ||
79 | .endm | ||
80 | |||
81 | .macro RESTORE_ALL_AND_RET | ||
82 | mfcr r30, cr0 | ||
83 | srli r30, r30, 1 | ||
84 | slli r30, r30, 1 | ||
85 | mtcr r30, cr0 | ||
86 | nop | ||
87 | nop | ||
88 | nop | ||
89 | nop | ||
90 | nop | ||
91 | |||
92 | .set r1 | ||
93 | ldis r1, 0x00ff | ||
94 | and r30, r30, r1 | ||
95 | not r1, r1 | ||
96 | lw r31, [r0, PT_PSR] | ||
97 | and r31, r31, r1 | ||
98 | .set nor1 | ||
99 | or r31, r31, r30 | ||
100 | mtcr r31, cr0 | ||
101 | nop | ||
102 | nop | ||
103 | nop | ||
104 | nop | ||
105 | nop | ||
106 | |||
107 | lw r30, [r0, PT_CONDITION] | ||
108 | mtcr r30, cr1 | ||
109 | nop | ||
110 | nop | ||
111 | nop | ||
112 | nop | ||
113 | nop | ||
114 | |||
115 | lw r30, [r0, PT_CEH] | ||
116 | lw r31, [r0, PT_CEL] | ||
117 | mtcehl r30, r31 | ||
118 | |||
119 | .set r1 | ||
120 | lw r1, [r0, PT_R1] | ||
121 | .set nor1 | ||
122 | lw r2, [r0, PT_R2] | ||
123 | lw r3, [r0, PT_R3] | ||
124 | lw r4, [r0, PT_R4] | ||
125 | lw r5, [r0, PT_R5] | ||
126 | lw r6, [r0, PT_R6] | ||
127 | lw r7, [r0, PT_R7] | ||
128 | |||
129 | lw r8, [r0, PT_R8] | ||
130 | lw r9, [r0, PT_R9] | ||
131 | lw r10, [r0, PT_R10] | ||
132 | lw r11, [r0, PT_R11] | ||
133 | lw r12, [r0, PT_R12] | ||
134 | lw r13, [r0, PT_R13] | ||
135 | lw r14, [r0, PT_R14] | ||
136 | lw r15, [r0, PT_R15] | ||
137 | |||
138 | lw r16, [r0, PT_R16] | ||
139 | lw r17, [r0, PT_R17] | ||
140 | lw r18, [r0, PT_R18] | ||
141 | lw r19, [r0, PT_R19] | ||
142 | lw r20, [r0, PT_R20] | ||
143 | lw r21, [r0, PT_R21] | ||
144 | lw r22, [r0, PT_R22] | ||
145 | lw r23, [r0, PT_R23] | ||
146 | |||
147 | lw r24, [r0, PT_R24] | ||
148 | lw r25, [r0, PT_R25] | ||
149 | lw r26, [r0, PT_R26] | ||
150 | lw r27, [r0, PT_R27] | ||
151 | lw r28, [r0, PT_R28] | ||
152 | lw r29, [r0, PT_R29] | ||
153 | |||
154 | lw r30, [r0, PT_EPC] | ||
155 | lw r0, [r0, PT_R0] | ||
156 | mtcr r30, cr5 | ||
157 | rte | ||
158 | .endm | ||
159 | |||
160 | #endif /* __ASSEMBLY__ */ | ||
161 | #endif /* _ASM_SCORE_ASMMACRO_H */ | ||
diff --git a/arch/score/include/asm/atomic.h b/arch/score/include/asm/atomic.h new file mode 100644 index 000000000000..84eb8ddf9f3f --- /dev/null +++ b/arch/score/include/asm/atomic.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_ATOMIC_H | ||
2 | #define _ASM_SCORE_ATOMIC_H | ||
3 | |||
4 | #include <asm-generic/atomic.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_ATOMIC_H */ | ||
diff --git a/arch/score/include/asm/auxvec.h b/arch/score/include/asm/auxvec.h new file mode 100644 index 000000000000..f69151565aee --- /dev/null +++ b/arch/score/include/asm/auxvec.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef _ASM_SCORE_AUXVEC_H | ||
2 | #define _ASM_SCORE_AUXVEC_H | ||
3 | |||
4 | #endif /* _ASM_SCORE_AUXVEC_H */ | ||
diff --git a/arch/score/include/asm/bitops.h b/arch/score/include/asm/bitops.h new file mode 100644 index 000000000000..2763b050fca8 --- /dev/null +++ b/arch/score/include/asm/bitops.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _ASM_SCORE_BITOPS_H | ||
2 | #define _ASM_SCORE_BITOPS_H | ||
3 | |||
4 | #include <asm/byteorder.h> /* swab32 */ | ||
5 | #include <asm/system.h> /* save_flags */ | ||
6 | |||
7 | /* | ||
8 | * clear_bit() doesn't provide any barrier for the compiler. | ||
9 | */ | ||
10 | #define smp_mb__before_clear_bit() barrier() | ||
11 | #define smp_mb__after_clear_bit() barrier() | ||
12 | |||
13 | #include <asm-generic/bitops.h> | ||
14 | #include <asm-generic/bitops/__fls.h> | ||
15 | |||
16 | #endif /* _ASM_SCORE_BITOPS_H */ | ||
diff --git a/arch/score/include/asm/bitsperlong.h b/arch/score/include/asm/bitsperlong.h new file mode 100644 index 000000000000..86ff337aa459 --- /dev/null +++ b/arch/score/include/asm/bitsperlong.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_BITSPERLONG_H | ||
2 | #define _ASM_SCORE_BITSPERLONG_H | ||
3 | |||
4 | #include <asm-generic/bitsperlong.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_BITSPERLONG_H */ | ||
diff --git a/arch/score/include/asm/bug.h b/arch/score/include/asm/bug.h new file mode 100644 index 000000000000..bb76a330bcf1 --- /dev/null +++ b/arch/score/include/asm/bug.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_BUG_H | ||
2 | #define _ASM_SCORE_BUG_H | ||
3 | |||
4 | #include <asm-generic/bug.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_BUG_H */ | ||
diff --git a/arch/score/include/asm/bugs.h b/arch/score/include/asm/bugs.h new file mode 100644 index 000000000000..a062e1056bb3 --- /dev/null +++ b/arch/score/include/asm/bugs.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_BUGS_H | ||
2 | #define _ASM_SCORE_BUGS_H | ||
3 | |||
4 | #include <asm-generic/bugs.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_BUGS_H */ | ||
diff --git a/arch/score/include/asm/byteorder.h b/arch/score/include/asm/byteorder.h new file mode 100644 index 000000000000..88cbebc79212 --- /dev/null +++ b/arch/score/include/asm/byteorder.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_BYTEORDER_H | ||
2 | #define _ASM_SCORE_BYTEORDER_H | ||
3 | |||
4 | #include <linux/byteorder/little_endian.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_BYTEORDER_H */ | ||
diff --git a/arch/score/include/asm/cache.h b/arch/score/include/asm/cache.h new file mode 100644 index 000000000000..ae3d59f2d2c4 --- /dev/null +++ b/arch/score/include/asm/cache.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _ASM_SCORE_CACHE_H | ||
2 | #define _ASM_SCORE_CACHE_H | ||
3 | |||
4 | #define L1_CACHE_SHIFT 4 | ||
5 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | ||
6 | |||
7 | #endif /* _ASM_SCORE_CACHE_H */ | ||
diff --git a/arch/score/include/asm/cacheflush.h b/arch/score/include/asm/cacheflush.h new file mode 100644 index 000000000000..07cc8fc457cd --- /dev/null +++ b/arch/score/include/asm/cacheflush.h | |||
@@ -0,0 +1,45 @@ | |||
1 | #ifndef _ASM_SCORE_CACHEFLUSH_H | ||
2 | #define _ASM_SCORE_CACHEFLUSH_H | ||
3 | |||
4 | /* Keep includes the same across arches. */ | ||
5 | #include <linux/mm.h> | ||
6 | |||
7 | extern void flush_cache_all(void); | ||
8 | extern void flush_cache_mm(struct mm_struct *mm); | ||
9 | extern void flush_cache_range(struct vm_area_struct *vma, | ||
10 | unsigned long start, unsigned long end); | ||
11 | extern void flush_cache_page(struct vm_area_struct *vma, | ||
12 | unsigned long page, unsigned long pfn); | ||
13 | extern void flush_cache_sigtramp(unsigned long addr); | ||
14 | extern void flush_icache_all(void); | ||
15 | extern void flush_icache_range(unsigned long start, unsigned long end); | ||
16 | extern void flush_dcache_range(unsigned long start, unsigned long end); | ||
17 | |||
18 | #define flush_cache_dup_mm(mm) do {} while (0) | ||
19 | #define flush_dcache_page(page) do {} while (0) | ||
20 | #define flush_dcache_mmap_lock(mapping) do {} while (0) | ||
21 | #define flush_dcache_mmap_unlock(mapping) do {} while (0) | ||
22 | #define flush_cache_vmap(start, end) do {} while (0) | ||
23 | #define flush_cache_vunmap(start, end) do {} while (0) | ||
24 | |||
25 | static inline void flush_icache_page(struct vm_area_struct *vma, | ||
26 | struct page *page) | ||
27 | { | ||
28 | if (vma->vm_flags & VM_EXEC) { | ||
29 | void *v = page_address(page); | ||
30 | flush_icache_range((unsigned long) v, | ||
31 | (unsigned long) v + PAGE_SIZE); | ||
32 | } | ||
33 | } | ||
34 | |||
35 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | ||
36 | memcpy(dst, src, len) | ||
37 | |||
38 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | ||
39 | do { \ | ||
40 | memcpy(dst, src, len); \ | ||
41 | if ((vma->vm_flags & VM_EXEC)) \ | ||
42 | flush_cache_page(vma, vaddr, page_to_pfn(page));\ | ||
43 | } while (0) | ||
44 | |||
45 | #endif /* _ASM_SCORE_CACHEFLUSH_H */ | ||
diff --git a/arch/score/include/asm/checksum.h b/arch/score/include/asm/checksum.h new file mode 100644 index 000000000000..f909ac3144a4 --- /dev/null +++ b/arch/score/include/asm/checksum.h | |||
@@ -0,0 +1,235 @@ | |||
1 | #ifndef _ASM_SCORE_CHECKSUM_H | ||
2 | #define _ASM_SCORE_CHECKSUM_H | ||
3 | |||
4 | #include <linux/in6.h> | ||
5 | #include <asm/uaccess.h> | ||
6 | |||
7 | /* | ||
8 | * computes the checksum of a memory block at buff, length len, | ||
9 | * and adds in "sum" (32-bit) | ||
10 | * | ||
11 | * returns a 32-bit number suitable for feeding into itself | ||
12 | * or csum_tcpudp_magic | ||
13 | * | ||
14 | * this function must be called with even lengths, except | ||
15 | * for the last fragment, which may be odd | ||
16 | * | ||
17 | * it's best to have buff aligned on a 32-bit boundary | ||
18 | */ | ||
19 | unsigned int csum_partial(const void *buff, int len, __wsum sum); | ||
20 | unsigned int csum_partial_copy_from_user(const char *src, char *dst, int len, | ||
21 | unsigned int sum, int *csum_err); | ||
22 | unsigned int csum_partial_copy(const char *src, char *dst, | ||
23 | int len, unsigned int sum); | ||
24 | |||
25 | /* | ||
26 | * this is a new version of the above that records errors it finds in *errp, | ||
27 | * but continues and zeros the rest of the buffer. | ||
28 | */ | ||
29 | |||
30 | /* | ||
31 | * Copy and checksum to user | ||
32 | */ | ||
33 | #define HAVE_CSUM_COPY_USER | ||
34 | static inline | ||
35 | __wsum csum_and_copy_to_user(const void *src, void __user *dst, int len, | ||
36 | __wsum sum, int *err_ptr) | ||
37 | { | ||
38 | sum = csum_partial(src, len, sum); | ||
39 | if (copy_to_user(dst, src, len)) { | ||
40 | *err_ptr = -EFAULT; | ||
41 | return (__force __wsum) -1; /* invalid checksum */ | ||
42 | } | ||
43 | return sum; | ||
44 | } | ||
45 | |||
46 | |||
47 | #define csum_partial_copy_nocheck csum_partial_copy | ||
48 | /* | ||
49 | * Fold a partial checksum without adding pseudo headers | ||
50 | */ | ||
51 | |||
52 | static inline __sum16 csum_fold(__wsum sum) | ||
53 | { | ||
54 | /* the while loop is unnecessary really, it's always enough with two | ||
55 | iterations */ | ||
56 | __asm__ __volatile__( | ||
57 | ".set volatile\n\t" | ||
58 | ".set\tr1\n\t" | ||
59 | "slli\tr1,%0, 16\n\t" | ||
60 | "add\t%0,%0, r1\n\t" | ||
61 | "cmp.c\tr1, %0\n\t" | ||
62 | "srli\t%0, %0, 16\n\t" | ||
63 | "bleu\t1f\n\t" | ||
64 | "addi\t%0, 0x1\n\t" | ||
65 | "1:ldi\tr30, 0xffff\n\t" | ||
66 | "xor\t%0, %0, r30\n\t" | ||
67 | "slli\t%0, %0, 16\n\t" | ||
68 | "srli\t%0, %0, 16\n\t" | ||
69 | ".set\tnor1\n\t" | ||
70 | ".set optimize\n\t" | ||
71 | : "=r" (sum) | ||
72 | : "0" (sum)); | ||
73 | return sum; | ||
74 | } | ||
75 | |||
76 | /* | ||
77 | * This is a version of ip_compute_csum() optimized for IP headers, | ||
78 | * which always checksum on 4 octet boundaries. | ||
79 | * | ||
80 | * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by | ||
81 | * Arnt Gulbrandsen. | ||
82 | */ | ||
83 | static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) | ||
84 | { | ||
85 | unsigned int sum; | ||
86 | unsigned long dummy; | ||
87 | |||
88 | __asm__ __volatile__( | ||
89 | ".set volatile\n\t" | ||
90 | ".set\tnor1\n\t" | ||
91 | "lw\t%0, [%1]\n\t" | ||
92 | "subri\t%2, %2, 4\n\t" | ||
93 | "slli\t%2, %2, 2\n\t" | ||
94 | "lw\t%3, [%1, 4]\n\t" | ||
95 | "add\t%2, %2, %1\n\t" | ||
96 | "add\t%0, %0, %3\n\t" | ||
97 | "cmp.c\t%3, %0\n\t" | ||
98 | "lw\t%3, [%1, 8]\n\t" | ||
99 | "bleu\t1f\n\t" | ||
100 | "addi\t%0, 0x1\n\t" | ||
101 | "1:\n\t" | ||
102 | "add\t%0, %0, %3\n\t" | ||
103 | "cmp.c\t%3, %0\n\t" | ||
104 | "lw\t%3, [%1, 12]\n\t" | ||
105 | "bleu\t1f\n\t" | ||
106 | "addi\t%0, 0x1\n\t" | ||
107 | "1:add\t%0, %0, %3\n\t" | ||
108 | "cmp.c\t%3, %0\n\t" | ||
109 | "bleu\t1f\n\t" | ||
110 | "addi\t%0, 0x1\n" | ||
111 | |||
112 | "1:\tlw\t%3, [%1, 16]\n\t" | ||
113 | "addi\t%1, 4\n\t" | ||
114 | "add\t%0, %0, %3\n\t" | ||
115 | "cmp.c\t%3, %0\n\t" | ||
116 | "bleu\t2f\n\t" | ||
117 | "addi\t%0, 0x1\n" | ||
118 | "2:cmp.c\t%2, %1\n\t" | ||
119 | "bne\t1b\n\t" | ||
120 | |||
121 | ".set\tr1\n\t" | ||
122 | ".set optimize\n\t" | ||
123 | : "=&r" (sum), "=&r" (iph), "=&r" (ihl), "=&r" (dummy) | ||
124 | : "1" (iph), "2" (ihl)); | ||
125 | |||
126 | return csum_fold(sum); | ||
127 | } | ||
128 | |||
129 | static inline __wsum | ||
130 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, | ||
131 | unsigned short proto, __wsum sum) | ||
132 | { | ||
133 | unsigned long tmp = (ntohs(len) << 16) + proto * 256; | ||
134 | __asm__ __volatile__( | ||
135 | ".set volatile\n\t" | ||
136 | "add\t%0, %0, %2\n\t" | ||
137 | "cmp.c\t%2, %0\n\t" | ||
138 | "bleu\t1f\n\t" | ||
139 | "addi\t%0, 0x1\n\t" | ||
140 | "1:\n\t" | ||
141 | "add\t%0, %0, %3\n\t" | ||
142 | "cmp.c\t%3, %0\n\t" | ||
143 | "bleu\t1f\n\t" | ||
144 | "addi\t%0, 0x1\n\t" | ||
145 | "1:\n\t" | ||
146 | "add\t%0, %0, %4\n\t" | ||
147 | "cmp.c\t%4, %0\n\t" | ||
148 | "bleu\t1f\n\t" | ||
149 | "addi\t%0, 0x1\n\t" | ||
150 | "1:\n\t" | ||
151 | ".set optimize\n\t" | ||
152 | : "=r" (sum) | ||
153 | : "0" (daddr), "r"(saddr), | ||
154 | "r" (tmp), | ||
155 | "r" (sum)); | ||
156 | return sum; | ||
157 | } | ||
158 | |||
159 | /* | ||
160 | * computes the checksum of the TCP/UDP pseudo-header | ||
161 | * returns a 16-bit checksum, already complemented | ||
162 | */ | ||
163 | static inline __sum16 | ||
164 | csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, | ||
165 | unsigned short proto, __wsum sum) | ||
166 | { | ||
167 | return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); | ||
168 | } | ||
169 | |||
170 | /* | ||
171 | * this routine is used for miscellaneous IP-like checksums, mainly | ||
172 | * in icmp.c | ||
173 | */ | ||
174 | |||
175 | static inline unsigned short ip_compute_csum(const void *buff, int len) | ||
176 | { | ||
177 | return csum_fold(csum_partial(buff, len, 0)); | ||
178 | } | ||
179 | |||
180 | #define _HAVE_ARCH_IPV6_CSUM | ||
181 | static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr, | ||
182 | const struct in6_addr *daddr, | ||
183 | __u32 len, unsigned short proto, | ||
184 | __wsum sum) | ||
185 | { | ||
186 | __asm__ __volatile__( | ||
187 | ".set\tnoreorder\t\t\t# csum_ipv6_magic\n\t" | ||
188 | ".set\tnoat\n\t" | ||
189 | "addu\t%0, %5\t\t\t# proto (long in network byte order)\n\t" | ||
190 | "sltu\t$1, %0, %5\n\t" | ||
191 | "addu\t%0, $1\n\t" | ||
192 | "addu\t%0, %6\t\t\t# csum\n\t" | ||
193 | "sltu\t$1, %0, %6\n\t" | ||
194 | "lw\t%1, 0(%2)\t\t\t# four words source address\n\t" | ||
195 | "addu\t%0, $1\n\t" | ||
196 | "addu\t%0, %1\n\t" | ||
197 | "sltu\t$1, %0, %1\n\t" | ||
198 | "lw\t%1, 4(%2)\n\t" | ||
199 | "addu\t%0, $1\n\t" | ||
200 | "addu\t%0, %1\n\t" | ||
201 | "sltu\t$1, %0, %1\n\t" | ||
202 | "lw\t%1, 8(%2)\n\t" | ||
203 | "addu\t%0, $1\n\t" | ||
204 | "addu\t%0, %1\n\t" | ||
205 | "sltu\t$1, %0, %1\n\t" | ||
206 | "lw\t%1, 12(%2)\n\t" | ||
207 | "addu\t%0, $1\n\t" | ||
208 | "addu\t%0, %1\n\t" | ||
209 | "sltu\t$1, %0, %1\n\t" | ||
210 | "lw\t%1, 0(%3)\n\t" | ||
211 | "addu\t%0, $1\n\t" | ||
212 | "addu\t%0, %1\n\t" | ||
213 | "sltu\t$1, %0, %1\n\t" | ||
214 | "lw\t%1, 4(%3)\n\t" | ||
215 | "addu\t%0, $1\n\t" | ||
216 | "addu\t%0, %1\n\t" | ||
217 | "sltu\t$1, %0, %1\n\t" | ||
218 | "lw\t%1, 8(%3)\n\t" | ||
219 | "addu\t%0, $1\n\t" | ||
220 | "addu\t%0, %1\n\t" | ||
221 | "sltu\t$1, %0, %1\n\t" | ||
222 | "lw\t%1, 12(%3)\n\t" | ||
223 | "addu\t%0, $1\n\t" | ||
224 | "addu\t%0, %1\n\t" | ||
225 | "sltu\t$1, %0, %1\n\t" | ||
226 | "addu\t%0, $1\t\t\t# Add final carry\n\t" | ||
227 | ".set\tnoat\n\t" | ||
228 | ".set\tnoreorder" | ||
229 | : "=r" (sum), "=r" (proto) | ||
230 | : "r" (saddr), "r" (daddr), | ||
231 | "0" (htonl(len)), "1" (htonl(proto)), "r" (sum)); | ||
232 | |||
233 | return csum_fold(sum); | ||
234 | } | ||
235 | #endif /* _ASM_SCORE_CHECKSUM_H */ | ||
diff --git a/arch/score/include/asm/cputime.h b/arch/score/include/asm/cputime.h new file mode 100644 index 000000000000..1fced99f0d67 --- /dev/null +++ b/arch/score/include/asm/cputime.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_CPUTIME_H | ||
2 | #define _ASM_SCORE_CPUTIME_H | ||
3 | |||
4 | #include <asm-generic/cputime.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_CPUTIME_H */ | ||
diff --git a/arch/score/include/asm/current.h b/arch/score/include/asm/current.h new file mode 100644 index 000000000000..16eae9cbaf1a --- /dev/null +++ b/arch/score/include/asm/current.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_CURRENT_H | ||
2 | #define _ASM_SCORE_CURRENT_H | ||
3 | |||
4 | #include <asm-generic/current.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_CURRENT_H */ | ||
diff --git a/arch/score/include/asm/delay.h b/arch/score/include/asm/delay.h new file mode 100644 index 000000000000..6726ec199dc0 --- /dev/null +++ b/arch/score/include/asm/delay.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _ASM_SCORE_DELAY_H | ||
2 | #define _ASM_SCORE_DELAY_H | ||
3 | |||
4 | static inline void __delay(unsigned long loops) | ||
5 | { | ||
6 | /* 3 cycles per loop. */ | ||
7 | __asm__ __volatile__ ( | ||
8 | "1:\tsubi\t%0, 3\n\t" | ||
9 | "cmpz.c\t%0\n\t" | ||
10 | "ble\t1b\n\t" | ||
11 | : "=r" (loops) | ||
12 | : "0" (loops)); | ||
13 | } | ||
14 | |||
15 | static inline void __udelay(unsigned long usecs) | ||
16 | { | ||
17 | unsigned long loops_per_usec; | ||
18 | |||
19 | loops_per_usec = (loops_per_jiffy * HZ) / 1000000; | ||
20 | |||
21 | __delay(usecs * loops_per_usec); | ||
22 | } | ||
23 | |||
24 | #define udelay(usecs) __udelay(usecs) | ||
25 | |||
26 | #endif /* _ASM_SCORE_DELAY_H */ | ||
diff --git a/arch/score/include/asm/device.h b/arch/score/include/asm/device.h new file mode 100644 index 000000000000..2dc7cc5d5ef9 --- /dev/null +++ b/arch/score/include/asm/device.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_DEVICE_H | ||
2 | #define _ASM_SCORE_DEVICE_H | ||
3 | |||
4 | #include <asm-generic/device.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_DEVICE_H */ | ||
diff --git a/arch/score/include/asm/div64.h b/arch/score/include/asm/div64.h new file mode 100644 index 000000000000..75fae19824eb --- /dev/null +++ b/arch/score/include/asm/div64.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_DIV64_H | ||
2 | #define _ASM_SCORE_DIV64_H | ||
3 | |||
4 | #include <asm-generic/div64.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_DIV64_H */ | ||
diff --git a/arch/score/include/asm/dma-mapping.h b/arch/score/include/asm/dma-mapping.h new file mode 100644 index 000000000000..f9c0193c7a53 --- /dev/null +++ b/arch/score/include/asm/dma-mapping.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_DMA_MAPPING_H | ||
2 | #define _ASM_SCORE_DMA_MAPPING_H | ||
3 | |||
4 | #include <asm-generic/dma-mapping-broken.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_DMA_MAPPING_H */ | ||
diff --git a/arch/score/include/asm/dma.h b/arch/score/include/asm/dma.h new file mode 100644 index 000000000000..9f44185298bf --- /dev/null +++ b/arch/score/include/asm/dma.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _ASM_SCORE_DMA_H | ||
2 | #define _ASM_SCORE_DMA_H | ||
3 | |||
4 | #include <asm/io.h> | ||
5 | |||
6 | #define MAX_DMA_ADDRESS (0) | ||
7 | |||
8 | #endif /* _ASM_SCORE_DMA_H */ | ||
diff --git a/arch/score/include/asm/elf.h b/arch/score/include/asm/elf.h new file mode 100644 index 000000000000..43526d9fda93 --- /dev/null +++ b/arch/score/include/asm/elf.h | |||
@@ -0,0 +1,103 @@ | |||
1 | #ifndef _ASM_SCORE_ELF_H | ||
2 | #define _ASM_SCORE_ELF_H | ||
3 | |||
4 | #include <linux/ptrace.h> | ||
5 | |||
6 | #define EM_SCORE7 135 | ||
7 | |||
8 | /* Relocation types. */ | ||
9 | #define R_SCORE_NONE 0 | ||
10 | #define R_SCORE_HI16 1 | ||
11 | #define R_SCORE_LO16 2 | ||
12 | #define R_SCORE_BCMP 3 | ||
13 | #define R_SCORE_24 4 | ||
14 | #define R_SCORE_PC19 5 | ||
15 | #define R_SCORE16_11 6 | ||
16 | #define R_SCORE16_PC8 7 | ||
17 | #define R_SCORE_ABS32 8 | ||
18 | #define R_SCORE_ABS16 9 | ||
19 | #define R_SCORE_DUMMY2 10 | ||
20 | #define R_SCORE_GP15 11 | ||
21 | #define R_SCORE_GNU_VTINHERIT 12 | ||
22 | #define R_SCORE_GNU_VTENTRY 13 | ||
23 | #define R_SCORE_GOT15 14 | ||
24 | #define R_SCORE_GOT_LO16 15 | ||
25 | #define R_SCORE_CALL15 16 | ||
26 | #define R_SCORE_GPREL32 17 | ||
27 | #define R_SCORE_REL32 18 | ||
28 | #define R_SCORE_DUMMY_HI16 19 | ||
29 | #define R_SCORE_IMM30 20 | ||
30 | #define R_SCORE_IMM32 21 | ||
31 | |||
32 | /* ELF register definitions */ | ||
33 | typedef unsigned long elf_greg_t; | ||
34 | |||
35 | #define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t)) | ||
36 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
37 | |||
38 | /* Score does not have fp regs. */ | ||
39 | typedef double elf_fpreg_t; | ||
40 | typedef elf_fpreg_t elf_fpregset_t; | ||
41 | |||
42 | #define elf_check_arch(x) ((x)->e_machine == EM_SCORE7) | ||
43 | |||
44 | /* | ||
45 | * These are used to set parameters in the core dumps. | ||
46 | */ | ||
47 | #define ELF_CLASS ELFCLASS32 | ||
48 | |||
49 | /* | ||
50 | * These are used to set parameters in the core dumps. | ||
51 | */ | ||
52 | #define ELF_DATA ELFDATA2LSB | ||
53 | #define ELF_ARCH EM_SCORE7 | ||
54 | |||
55 | #define SET_PERSONALITY(ex) \ | ||
56 | do { \ | ||
57 | set_personality(PER_LINUX); \ | ||
58 | } while (0) | ||
59 | |||
60 | struct task_struct; | ||
61 | struct pt_regs; | ||
62 | |||
63 | #define CORE_DUMP_USE_REGSET | ||
64 | #define USE_ELF_CORE_DUMP | ||
65 | #define ELF_EXEC_PAGESIZE PAGE_SIZE | ||
66 | |||
67 | /* This yields a mask that user programs can use to figure out what | ||
68 | instruction set this cpu supports. This could be done in userspace, | ||
69 | but it's not easy, and we've already done it here. */ | ||
70 | |||
71 | #define ELF_HWCAP (0) | ||
72 | |||
73 | /* This yields a string that ld.so will use to load implementation | ||
74 | specific libraries for optimization. This is more specific in | ||
75 | intent than poking at uname or /proc/cpuinfo. | ||
76 | |||
77 | For the moment, we have only optimizations for the Intel generations, | ||
78 | but that could change... */ | ||
79 | |||
80 | #define ELF_PLATFORM (NULL) | ||
81 | |||
82 | #define ELF_PLAT_INIT(_r, load_addr) \ | ||
83 | do { \ | ||
84 | _r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0; \ | ||
85 | _r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0; \ | ||
86 | _r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0; \ | ||
87 | _r->regs[13] = _r->regs[14] = _r->regs[15] = _r->regs[16] = 0; \ | ||
88 | _r->regs[17] = _r->regs[18] = _r->regs[19] = _r->regs[20] = 0; \ | ||
89 | _r->regs[21] = _r->regs[22] = _r->regs[23] = _r->regs[24] = 0; \ | ||
90 | _r->regs[25] = _r->regs[26] = _r->regs[27] = _r->regs[28] = 0; \ | ||
91 | _r->regs[30] = _r->regs[31] = 0; \ | ||
92 | } while (0) | ||
93 | |||
94 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical | ||
95 | use of this is to invoke "./ld.so someprog" to test out a new version of | ||
96 | the loader. We need to make sure that it is out of the way of the program | ||
97 | that it will "exec", and that there is sufficient room for the brk. */ | ||
98 | |||
99 | #ifndef ELF_ET_DYN_BASE | ||
100 | #define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) | ||
101 | #endif | ||
102 | |||
103 | #endif /* _ASM_SCORE_ELF_H */ | ||
diff --git a/arch/score/include/asm/emergency-restart.h b/arch/score/include/asm/emergency-restart.h new file mode 100644 index 000000000000..ca31e9803a8a --- /dev/null +++ b/arch/score/include/asm/emergency-restart.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_EMERGENCY_RESTART_H | ||
2 | #define _ASM_SCORE_EMERGENCY_RESTART_H | ||
3 | |||
4 | #include <asm-generic/emergency-restart.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_EMERGENCY_RESTART_H */ | ||
diff --git a/arch/score/include/asm/errno.h b/arch/score/include/asm/errno.h new file mode 100644 index 000000000000..29ff39d5ab47 --- /dev/null +++ b/arch/score/include/asm/errno.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_ERRNO_H | ||
2 | #define _ASM_SCORE_ERRNO_H | ||
3 | |||
4 | #include <asm-generic/errno.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_ERRNO_H */ | ||
diff --git a/arch/score/include/asm/fcntl.h b/arch/score/include/asm/fcntl.h new file mode 100644 index 000000000000..03968a3103a4 --- /dev/null +++ b/arch/score/include/asm/fcntl.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_FCNTL_H | ||
2 | #define _ASM_SCORE_FCNTL_H | ||
3 | |||
4 | #include <asm-generic/fcntl.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_FCNTL_H */ | ||
diff --git a/arch/score/include/asm/fixmap.h b/arch/score/include/asm/fixmap.h new file mode 100644 index 000000000000..ee1676694024 --- /dev/null +++ b/arch/score/include/asm/fixmap.h | |||
@@ -0,0 +1,82 @@ | |||
1 | #ifndef _ASM_SCORE_FIXMAP_H | ||
2 | #define _ASM_SCORE_FIXMAP_H | ||
3 | |||
4 | #include <asm/page.h> | ||
5 | |||
6 | #define PHY_RAM_BASE 0x00000000 | ||
7 | #define PHY_IO_BASE 0x10000000 | ||
8 | |||
9 | #define VIRTUAL_RAM_BASE 0xa0000000 | ||
10 | #define VIRTUAL_IO_BASE 0xb0000000 | ||
11 | |||
12 | #define RAM_SPACE_SIZE 0x10000000 | ||
13 | #define IO_SPACE_SIZE 0x10000000 | ||
14 | |||
15 | /* Kernel unmapped, cached 512MB */ | ||
16 | #define KSEG1 0xa0000000 | ||
17 | |||
18 | /* | ||
19 | * Here we define all the compile-time 'special' virtual | ||
20 | * addresses. The point is to have a constant address at | ||
21 | * compile time, but to set the physical address only | ||
22 | * in the boot process. We allocate these special addresses | ||
23 | * from the end of virtual memory (0xfffff000) backwards. | ||
24 | * Also this lets us do fail-safe vmalloc(), we | ||
25 | * can guarantee that these special addresses and | ||
26 | * vmalloc()-ed addresses never overlap. | ||
27 | * | ||
28 | * these 'compile-time allocated' memory buffers are | ||
29 | * fixed-size 4k pages. (or larger if used with an increment | ||
30 | * highger than 1) use fixmap_set(idx,phys) to associate | ||
31 | * physical memory with fixmap indices. | ||
32 | * | ||
33 | * TLB entries of such buffers will not be flushed across | ||
34 | * task switches. | ||
35 | */ | ||
36 | |||
37 | /* | ||
38 | * on UP currently we will have no trace of the fixmap mechanizm, | ||
39 | * no page table allocations, etc. This might change in the | ||
40 | * future, say framebuffers for the console driver(s) could be | ||
41 | * fix-mapped? | ||
42 | */ | ||
43 | enum fixed_addresses { | ||
44 | #define FIX_N_COLOURS 8 | ||
45 | FIX_CMAP_BEGIN, | ||
46 | FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS, | ||
47 | __end_of_fixed_addresses | ||
48 | }; | ||
49 | |||
50 | /* | ||
51 | * used by vmalloc.c. | ||
52 | * | ||
53 | * Leave one empty page between vmalloc'ed areas and | ||
54 | * the start of the fixmap, and leave one page empty | ||
55 | * at the top of mem.. | ||
56 | */ | ||
57 | #define FIXADDR_TOP ((unsigned long)(long)(int)0xfefe0000) | ||
58 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) | ||
59 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | ||
60 | |||
61 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
62 | #define __virt_to_fix(x) \ | ||
63 | ((FIXADDR_TOP - ((x) & PAGE_MASK)) >> PAGE_SHIFT) | ||
64 | |||
65 | extern void __this_fixmap_does_not_exist(void); | ||
66 | |||
67 | /* | ||
68 | * 'index to address' translation. If anyone tries to use the idx | ||
69 | * directly without tranlation, we catch the bug with a NULL-deference | ||
70 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
71 | */ | ||
72 | static inline unsigned long fix_to_virt(const unsigned int idx) | ||
73 | { | ||
74 | return __fix_to_virt(idx); | ||
75 | } | ||
76 | |||
77 | static inline unsigned long virt_to_fix(const unsigned long vaddr) | ||
78 | { | ||
79 | return __virt_to_fix(vaddr); | ||
80 | } | ||
81 | |||
82 | #endif /* _ASM_SCORE_FIXMAP_H */ | ||
diff --git a/arch/score/include/asm/ftrace.h b/arch/score/include/asm/ftrace.h new file mode 100644 index 000000000000..79d6f10e1f5b --- /dev/null +++ b/arch/score/include/asm/ftrace.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef _ASM_SCORE_FTRACE_H | ||
2 | #define _ASM_SCORE_FTRACE_H | ||
3 | |||
4 | #endif /* _ASM_SCORE_FTRACE_H */ | ||
diff --git a/arch/score/include/asm/futex.h b/arch/score/include/asm/futex.h new file mode 100644 index 000000000000..1dca2420f8db --- /dev/null +++ b/arch/score/include/asm/futex.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_FUTEX_H | ||
2 | #define _ASM_SCORE_FUTEX_H | ||
3 | |||
4 | #include <asm-generic/futex.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_FUTEX_H */ | ||
diff --git a/arch/score/include/asm/hardirq.h b/arch/score/include/asm/hardirq.h new file mode 100644 index 000000000000..dc932c50d3ee --- /dev/null +++ b/arch/score/include/asm/hardirq.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_HARDIRQ_H | ||
2 | #define _ASM_SCORE_HARDIRQ_H | ||
3 | |||
4 | #include <asm-generic/hardirq.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_HARDIRQ_H */ | ||
diff --git a/arch/score/include/asm/hw_irq.h b/arch/score/include/asm/hw_irq.h new file mode 100644 index 000000000000..4caafb2b509a --- /dev/null +++ b/arch/score/include/asm/hw_irq.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef _ASM_SCORE_HW_IRQ_H | ||
2 | #define _ASM_SCORE_HW_IRQ_H | ||
3 | |||
4 | #endif /* _ASM_SCORE_HW_IRQ_H */ | ||
diff --git a/arch/score/include/asm/io.h b/arch/score/include/asm/io.h new file mode 100644 index 000000000000..fbbfd7132e3b --- /dev/null +++ b/arch/score/include/asm/io.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef _ASM_SCORE_IO_H | ||
2 | #define _ASM_SCORE_IO_H | ||
3 | |||
4 | #include <asm-generic/io.h> | ||
5 | |||
6 | #define virt_to_bus virt_to_phys | ||
7 | #define bus_to_virt phys_to_virt | ||
8 | |||
9 | #endif /* _ASM_SCORE_IO_H */ | ||
diff --git a/arch/score/include/asm/ioctl.h b/arch/score/include/asm/ioctl.h new file mode 100644 index 000000000000..a351d2194bfd --- /dev/null +++ b/arch/score/include/asm/ioctl.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_IOCTL_H | ||
2 | #define _ASM_SCORE_IOCTL_H | ||
3 | |||
4 | #include <asm-generic/ioctl.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_IOCTL_H */ | ||
diff --git a/arch/score/include/asm/ioctls.h b/arch/score/include/asm/ioctls.h new file mode 100644 index 000000000000..ed01d2b9aeab --- /dev/null +++ b/arch/score/include/asm/ioctls.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_IOCTLS_H | ||
2 | #define _ASM_SCORE_IOCTLS_H | ||
3 | |||
4 | #include <asm-generic/ioctls.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_IOCTLS_H */ | ||
diff --git a/arch/score/include/asm/ipcbuf.h b/arch/score/include/asm/ipcbuf.h new file mode 100644 index 000000000000..e082ceff1818 --- /dev/null +++ b/arch/score/include/asm/ipcbuf.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_IPCBUF_H | ||
2 | #define _ASM_SCORE_IPCBUF_H | ||
3 | |||
4 | #include <asm-generic/ipcbuf.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_IPCBUF_H */ | ||
diff --git a/arch/score/include/asm/irq.h b/arch/score/include/asm/irq.h new file mode 100644 index 000000000000..c883f3df33fa --- /dev/null +++ b/arch/score/include/asm/irq.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _ASM_SCORE_IRQ_H | ||
2 | #define _ASM_SCORE_IRQ_H | ||
3 | |||
4 | #define EXCEPTION_VECTOR_BASE_ADDR 0xa0000000 | ||
5 | #define VECTOR_ADDRESS_OFFSET_MODE4 0 | ||
6 | #define VECTOR_ADDRESS_OFFSET_MODE16 1 | ||
7 | |||
8 | #define DEBUG_VECTOR_SIZE (0x4) | ||
9 | #define DEBUG_VECTOR_BASE_ADDR ((EXCEPTION_VECTOR_BASE_ADDR) + 0x1fc) | ||
10 | |||
11 | #define GENERAL_VECTOR_SIZE (0x10) | ||
12 | #define GENERAL_VECTOR_BASE_ADDR ((EXCEPTION_VECTOR_BASE_ADDR) + 0x200) | ||
13 | |||
14 | #define NR_IRQS 64 | ||
15 | #define IRQ_VECTOR_SIZE (0x10) | ||
16 | #define IRQ_VECTOR_BASE_ADDR ((EXCEPTION_VECTOR_BASE_ADDR) + 0x210) | ||
17 | #define IRQ_VECTOR_END_ADDR ((EXCEPTION_VECTOR_BASE_ADDR) + 0x5f0) | ||
18 | |||
19 | #define irq_canonicalize(irq) (irq) | ||
20 | |||
21 | #define IRQ_TIMER (7) /* Timer IRQ number of SPCT6600 */ | ||
22 | |||
23 | extern void interrupt_exception_vector(void); | ||
24 | |||
25 | #endif /* _ASM_SCORE_IRQ_H */ | ||
diff --git a/arch/score/include/asm/irq_regs.h b/arch/score/include/asm/irq_regs.h new file mode 100644 index 000000000000..b8e881c9a69f --- /dev/null +++ b/arch/score/include/asm/irq_regs.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef _ASM_SCORE_IRQ_REGS_H | ||
2 | #define _ASM_SCORE_IRQ_REGS_H | ||
3 | |||
4 | #include <linux/thread_info.h> | ||
5 | |||
6 | static inline struct pt_regs *get_irq_regs(void) | ||
7 | { | ||
8 | return current_thread_info()->regs; | ||
9 | } | ||
10 | |||
11 | #endif /* _ASM_SCORE_IRQ_REGS_H */ | ||
diff --git a/arch/score/include/asm/irqflags.h b/arch/score/include/asm/irqflags.h new file mode 100644 index 000000000000..690a6cae7294 --- /dev/null +++ b/arch/score/include/asm/irqflags.h | |||
@@ -0,0 +1,109 @@ | |||
1 | #ifndef _ASM_SCORE_IRQFLAGS_H | ||
2 | #define _ASM_SCORE_IRQFLAGS_H | ||
3 | |||
4 | #ifndef __ASSEMBLY__ | ||
5 | |||
6 | #define raw_local_irq_save(x) \ | ||
7 | { \ | ||
8 | __asm__ __volatile__( \ | ||
9 | "mfcr r8, cr0;" \ | ||
10 | "li r9, 0xfffffffe;" \ | ||
11 | "nop;" \ | ||
12 | "mv %0, r8;" \ | ||
13 | "and r8, r8, r9;" \ | ||
14 | "mtcr r8, cr0;" \ | ||
15 | "nop;" \ | ||
16 | "nop;" \ | ||
17 | "nop;" \ | ||
18 | "nop;" \ | ||
19 | "nop;" \ | ||
20 | : "=r" (x) \ | ||
21 | : \ | ||
22 | : "r8", "r9" \ | ||
23 | ); \ | ||
24 | } | ||
25 | |||
26 | #define raw_local_irq_restore(x) \ | ||
27 | { \ | ||
28 | __asm__ __volatile__( \ | ||
29 | "mfcr r8, cr0;" \ | ||
30 | "ldi r9, 0x1;" \ | ||
31 | "and %0, %0, r9;" \ | ||
32 | "or r8, r8, %0;" \ | ||
33 | "mtcr r8, cr0;" \ | ||
34 | "nop;" \ | ||
35 | "nop;" \ | ||
36 | "nop;" \ | ||
37 | "nop;" \ | ||
38 | "nop;" \ | ||
39 | : \ | ||
40 | : "r"(x) \ | ||
41 | : "r8", "r9" \ | ||
42 | ); \ | ||
43 | } | ||
44 | |||
45 | #define raw_local_irq_enable(void) \ | ||
46 | { \ | ||
47 | __asm__ __volatile__( \ | ||
48 | "mfcr\tr8,cr0;" \ | ||
49 | "nop;" \ | ||
50 | "nop;" \ | ||
51 | "ori\tr8,0x1;" \ | ||
52 | "mtcr\tr8,cr0;" \ | ||
53 | "nop;" \ | ||
54 | "nop;" \ | ||
55 | "nop;" \ | ||
56 | "nop;" \ | ||
57 | "nop;" \ | ||
58 | : \ | ||
59 | : \ | ||
60 | : "r8"); \ | ||
61 | } | ||
62 | |||
63 | #define raw_local_irq_disable(void) \ | ||
64 | { \ | ||
65 | __asm__ __volatile__( \ | ||
66 | "mfcr\tr8,cr0;" \ | ||
67 | "nop;" \ | ||
68 | "nop;" \ | ||
69 | "srli\tr8,r8,1;" \ | ||
70 | "slli\tr8,r8,1;" \ | ||
71 | "mtcr\tr8,cr0;" \ | ||
72 | "nop;" \ | ||
73 | "nop;" \ | ||
74 | "nop;" \ | ||
75 | "nop;" \ | ||
76 | "nop;" \ | ||
77 | : \ | ||
78 | : \ | ||
79 | : "r8"); \ | ||
80 | } | ||
81 | |||
82 | #define raw_local_save_flags(x) \ | ||
83 | { \ | ||
84 | __asm__ __volatile__( \ | ||
85 | "mfcr r8, cr0;" \ | ||
86 | "nop;" \ | ||
87 | "nop;" \ | ||
88 | "mv %0, r8;" \ | ||
89 | "nop;" \ | ||
90 | "nop;" \ | ||
91 | "nop;" \ | ||
92 | "nop;" \ | ||
93 | "nop;" \ | ||
94 | "ldi r9, 0x1;" \ | ||
95 | "and %0, %0, r9;" \ | ||
96 | : "=r" (x) \ | ||
97 | : \ | ||
98 | : "r8", "r9" \ | ||
99 | ); \ | ||
100 | } | ||
101 | |||
102 | static inline int raw_irqs_disabled_flags(unsigned long flags) | ||
103 | { | ||
104 | return !(flags & 1); | ||
105 | } | ||
106 | |||
107 | #endif | ||
108 | |||
109 | #endif /* _ASM_SCORE_IRQFLAGS_H */ | ||
diff --git a/arch/score/include/asm/kdebug.h b/arch/score/include/asm/kdebug.h new file mode 100644 index 000000000000..a666e513f747 --- /dev/null +++ b/arch/score/include/asm/kdebug.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_KDEBUG_H | ||
2 | #define _ASM_SCORE_KDEBUG_H | ||
3 | |||
4 | #include <asm-generic/kdebug.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_KDEBUG_H */ | ||
diff --git a/arch/score/include/asm/kmap_types.h b/arch/score/include/asm/kmap_types.h new file mode 100644 index 000000000000..6c46eb5077d3 --- /dev/null +++ b/arch/score/include/asm/kmap_types.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_KMAP_TYPES_H | ||
2 | #define _ASM_SCORE_KMAP_TYPES_H | ||
3 | |||
4 | #include <asm-generic/kmap_types.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_KMAP_TYPES_H */ | ||
diff --git a/arch/score/include/asm/linkage.h b/arch/score/include/asm/linkage.h new file mode 100644 index 000000000000..2323a8ecf445 --- /dev/null +++ b/arch/score/include/asm/linkage.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _ASM_SCORE_LINKAGE_H | ||
2 | #define _ASM_SCORE_LINKAGE_H | ||
3 | |||
4 | #define __ALIGN .align 2 | ||
5 | #define __ALIGN_STR ".align 2" | ||
6 | |||
7 | #endif /* _ASM_SCORE_LINKAGE_H */ | ||
diff --git a/arch/score/include/asm/local.h b/arch/score/include/asm/local.h new file mode 100644 index 000000000000..7e02f13dbba8 --- /dev/null +++ b/arch/score/include/asm/local.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_LOCAL_H | ||
2 | #define _ASM_SCORE_LOCAL_H | ||
3 | |||
4 | #include <asm-generic/local.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_LOCAL_H */ | ||
diff --git a/arch/score/include/asm/mman.h b/arch/score/include/asm/mman.h new file mode 100644 index 000000000000..84d85ddfed8d --- /dev/null +++ b/arch/score/include/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_MMAN_H | ||
2 | #define _ASM_SCORE_MMAN_H | ||
3 | |||
4 | #include <asm-generic/mman.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_MMAN_H */ | ||
diff --git a/arch/score/include/asm/mmu.h b/arch/score/include/asm/mmu.h new file mode 100644 index 000000000000..676828e4c10a --- /dev/null +++ b/arch/score/include/asm/mmu.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_MMU_H | ||
2 | #define _ASM_SCORE_MMU_H | ||
3 | |||
4 | typedef unsigned long mm_context_t; | ||
5 | |||
6 | #endif /* _ASM_SCORE_MMU_H */ | ||
diff --git a/arch/score/include/asm/mmu_context.h b/arch/score/include/asm/mmu_context.h new file mode 100644 index 000000000000..2644577c96e8 --- /dev/null +++ b/arch/score/include/asm/mmu_context.h | |||
@@ -0,0 +1,113 @@ | |||
1 | #ifndef _ASM_SCORE_MMU_CONTEXT_H | ||
2 | #define _ASM_SCORE_MMU_CONTEXT_H | ||
3 | |||
4 | #include <linux/errno.h> | ||
5 | #include <linux/sched.h> | ||
6 | #include <linux/slab.h> | ||
7 | #include <asm-generic/mm_hooks.h> | ||
8 | |||
9 | #include <asm/cacheflush.h> | ||
10 | #include <asm/tlbflush.h> | ||
11 | #include <asm/scoreregs.h> | ||
12 | |||
13 | /* | ||
14 | * For the fast tlb miss handlers, we keep a per cpu array of pointers | ||
15 | * to the current pgd for each processor. Also, the proc. id is stuffed | ||
16 | * into the context register. | ||
17 | */ | ||
18 | extern unsigned long asid_cache; | ||
19 | extern unsigned long pgd_current; | ||
20 | |||
21 | #define TLBMISS_HANDLER_SETUP_PGD(pgd) (pgd_current = (unsigned long)(pgd)) | ||
22 | |||
23 | #define TLBMISS_HANDLER_SETUP() \ | ||
24 | do { \ | ||
25 | write_c0_context(0); \ | ||
26 | TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) \ | ||
27 | } while (0) | ||
28 | |||
29 | /* | ||
30 | * All unused by hardware upper bits will be considered | ||
31 | * as a software asid extension. | ||
32 | */ | ||
33 | #define ASID_VERSION_MASK 0xfffff000 | ||
34 | #define ASID_FIRST_VERSION 0x1000 | ||
35 | |||
36 | /* PEVN --------- VPN ---------- --ASID--- -NA- */ | ||
37 | /* binary: 0000 0000 0000 0000 0000 0000 0001 0000 */ | ||
38 | /* binary: 0000 0000 0000 0000 0000 1111 1111 0000 */ | ||
39 | #define ASID_INC 0x10 | ||
40 | #define ASID_MASK 0xff0 | ||
41 | |||
42 | static inline void enter_lazy_tlb(struct mm_struct *mm, | ||
43 | struct task_struct *tsk) | ||
44 | {} | ||
45 | |||
46 | static inline void | ||
47 | get_new_mmu_context(struct mm_struct *mm) | ||
48 | { | ||
49 | unsigned long asid = asid_cache + ASID_INC; | ||
50 | |||
51 | if (!(asid & ASID_MASK)) { | ||
52 | local_flush_tlb_all(); /* start new asid cycle */ | ||
53 | if (!asid) /* fix version if needed */ | ||
54 | asid = ASID_FIRST_VERSION; | ||
55 | } | ||
56 | |||
57 | mm->context = asid; | ||
58 | asid_cache = asid; | ||
59 | } | ||
60 | |||
61 | /* | ||
62 | * Initialize the context related info for a new mm_struct | ||
63 | * instance. | ||
64 | */ | ||
65 | static inline int | ||
66 | init_new_context(struct task_struct *tsk, struct mm_struct *mm) | ||
67 | { | ||
68 | mm->context = 0; | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
73 | struct task_struct *tsk) | ||
74 | { | ||
75 | unsigned long flags; | ||
76 | |||
77 | local_irq_save(flags); | ||
78 | if ((next->context ^ asid_cache) & ASID_VERSION_MASK) | ||
79 | get_new_mmu_context(next); | ||
80 | |||
81 | pevn_set(next->context); | ||
82 | TLBMISS_HANDLER_SETUP_PGD(next->pgd); | ||
83 | local_irq_restore(flags); | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | * Destroy context related info for an mm_struct that is about | ||
88 | * to be put to rest. | ||
89 | */ | ||
90 | static inline void destroy_context(struct mm_struct *mm) | ||
91 | {} | ||
92 | |||
93 | static inline void | ||
94 | deactivate_mm(struct task_struct *task, struct mm_struct *mm) | ||
95 | {} | ||
96 | |||
97 | /* | ||
98 | * After we have set current->mm to a new value, this activates | ||
99 | * the context for the new mm so we see the new mappings. | ||
100 | */ | ||
101 | static inline void | ||
102 | activate_mm(struct mm_struct *prev, struct mm_struct *next) | ||
103 | { | ||
104 | unsigned long flags; | ||
105 | |||
106 | local_irq_save(flags); | ||
107 | get_new_mmu_context(next); | ||
108 | pevn_set(next->context); | ||
109 | TLBMISS_HANDLER_SETUP_PGD(next->pgd); | ||
110 | local_irq_restore(flags); | ||
111 | } | ||
112 | |||
113 | #endif /* _ASM_SCORE_MMU_CONTEXT_H */ | ||
diff --git a/arch/score/include/asm/module.h b/arch/score/include/asm/module.h new file mode 100644 index 000000000000..f0b5dc0bd023 --- /dev/null +++ b/arch/score/include/asm/module.h | |||
@@ -0,0 +1,39 @@ | |||
1 | #ifndef _ASM_SCORE_MODULE_H | ||
2 | #define _ASM_SCORE_MODULE_H | ||
3 | |||
4 | #include <linux/list.h> | ||
5 | #include <asm/uaccess.h> | ||
6 | |||
7 | struct mod_arch_specific { | ||
8 | /* Data Bus Error exception tables */ | ||
9 | struct list_head dbe_list; | ||
10 | const struct exception_table_entry *dbe_start; | ||
11 | const struct exception_table_entry *dbe_end; | ||
12 | }; | ||
13 | |||
14 | typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */ | ||
15 | |||
16 | #define Elf_Shdr Elf32_Shdr | ||
17 | #define Elf_Sym Elf32_Sym | ||
18 | #define Elf_Ehdr Elf32_Ehdr | ||
19 | #define Elf_Addr Elf32_Addr | ||
20 | |||
21 | /* Given an address, look for it in the exception tables. */ | ||
22 | #ifdef CONFIG_MODULES | ||
23 | const struct exception_table_entry *search_module_dbetables(unsigned long addr); | ||
24 | #else | ||
25 | static inline const struct exception_table_entry | ||
26 | *search_module_dbetables(unsigned long addr) | ||
27 | { | ||
28 | return NULL; | ||
29 | } | ||
30 | #endif | ||
31 | |||
32 | #define MODULE_PROC_FAMILY "SCORE7" | ||
33 | #define MODULE_KERNEL_TYPE "32BIT " | ||
34 | #define MODULE_KERNEL_SMTC "" | ||
35 | |||
36 | #define MODULE_ARCH_VERMAGIC \ | ||
37 | MODULE_PROC_FAMILY MODULE_KERNEL_TYPE MODULE_KERNEL_SMTC | ||
38 | |||
39 | #endif /* _ASM_SCORE_MODULE_H */ | ||
diff --git a/arch/score/include/asm/msgbuf.h b/arch/score/include/asm/msgbuf.h new file mode 100644 index 000000000000..7506721e29fa --- /dev/null +++ b/arch/score/include/asm/msgbuf.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_MSGBUF_H | ||
2 | #define _ASM_SCORE_MSGBUF_H | ||
3 | |||
4 | #include <asm-generic/msgbuf.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_MSGBUF_H */ | ||
diff --git a/arch/score/include/asm/mutex.h b/arch/score/include/asm/mutex.h new file mode 100644 index 000000000000..10d48fe4db97 --- /dev/null +++ b/arch/score/include/asm/mutex.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_MUTEX_H | ||
2 | #define _ASM_SCORE_MUTEX_H | ||
3 | |||
4 | #include <asm-generic/mutex-dec.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_MUTEX_H */ | ||
diff --git a/arch/score/include/asm/page.h b/arch/score/include/asm/page.h new file mode 100644 index 000000000000..ee5821042fcc --- /dev/null +++ b/arch/score/include/asm/page.h | |||
@@ -0,0 +1,92 @@ | |||
1 | #ifndef _ASM_SCORE_PAGE_H | ||
2 | #define _ASM_SCORE_PAGE_H | ||
3 | |||
4 | #include <linux/pfn.h> | ||
5 | |||
6 | /* PAGE_SHIFT determines the page size */ | ||
7 | #define PAGE_SHIFT (12) | ||
8 | #define PAGE_SIZE (1UL << PAGE_SHIFT) | ||
9 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
10 | |||
11 | #ifdef __KERNEL__ | ||
12 | |||
13 | #ifndef __ASSEMBLY__ | ||
14 | |||
15 | #define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1))) | ||
16 | #define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1))) | ||
17 | |||
18 | /* align addr on a size boundary - adjust address up/down if needed */ | ||
19 | #define _ALIGN_UP(addr, size) (((addr)+((size)-1))&(~((size)-1))) | ||
20 | #define _ALIGN_DOWN(addr, size) ((addr)&(~((size)-1))) | ||
21 | |||
22 | /* align addr on a size boundary - adjust address up if needed */ | ||
23 | #define _ALIGN(addr, size) _ALIGN_UP(addr, size) | ||
24 | |||
25 | /* | ||
26 | * PAGE_OFFSET -- the first address of the first page of memory. When not | ||
27 | * using MMU this corresponds to the first free page in physical memory (aligned | ||
28 | * on a page boundary). | ||
29 | */ | ||
30 | #define PAGE_OFFSET (0xA0000000UL) | ||
31 | |||
32 | #define clear_page(pgaddr) memset((pgaddr), 0, PAGE_SIZE) | ||
33 | #define copy_page(to, from) memcpy((to), (from), PAGE_SIZE) | ||
34 | |||
35 | #define clear_user_page(pgaddr, vaddr, page) memset((pgaddr), 0, PAGE_SIZE) | ||
36 | #define copy_user_page(vto, vfrom, vaddr, topg) \ | ||
37 | memcpy((vto), (vfrom), PAGE_SIZE) | ||
38 | |||
39 | /* | ||
40 | * These are used to make use of C type-checking.. | ||
41 | */ | ||
42 | |||
43 | typedef struct { unsigned long pte; } pte_t; /* page table entry */ | ||
44 | typedef struct { unsigned long pgd; } pgd_t; /* PGD table entry */ | ||
45 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
46 | typedef struct page *pgtable_t; | ||
47 | |||
48 | #define pte_val(x) ((x).pte) | ||
49 | #define pgd_val(x) ((x).pgd) | ||
50 | #define pgprot_val(x) ((x).pgprot) | ||
51 | |||
52 | #define __pte(x) ((pte_t) { (x) }) | ||
53 | #define __pgd(x) ((pgd_t) { (x) }) | ||
54 | #define __pgprot(x) ((pgprot_t) { (x) }) | ||
55 | |||
56 | extern unsigned long max_low_pfn; | ||
57 | extern unsigned long min_low_pfn; | ||
58 | extern unsigned long max_pfn; | ||
59 | |||
60 | #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) | ||
61 | #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) | ||
62 | |||
63 | #define phys_to_pfn(phys) (PFN_DOWN(phys)) | ||
64 | #define pfn_to_phys(pfn) (PFN_PHYS(pfn)) | ||
65 | |||
66 | #define virt_to_pfn(vaddr) (phys_to_pfn((__pa(vaddr)))) | ||
67 | #define pfn_to_virt(pfn) __va(pfn_to_phys((pfn))) | ||
68 | |||
69 | #define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr))) | ||
70 | #define page_to_virt(page) (pfn_to_virt(page_to_pfn(page))) | ||
71 | |||
72 | #define page_to_phys(page) (pfn_to_phys(page_to_pfn(page))) | ||
73 | #define page_to_bus(page) (page_to_phys(page)) | ||
74 | #define phys_to_page(paddr) (pfn_to_page(phys_to_pfn(paddr))) | ||
75 | |||
76 | #define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_mapnr) | ||
77 | |||
78 | #define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT) | ||
79 | |||
80 | #endif /* __ASSEMBLY__ */ | ||
81 | |||
82 | #define virt_addr_valid(vaddr) (pfn_valid(virt_to_pfn(vaddr))) | ||
83 | |||
84 | #endif /* __KERNEL__ */ | ||
85 | |||
86 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
87 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
88 | |||
89 | #include <asm-generic/memory_model.h> | ||
90 | #include <asm-generic/getorder.h> | ||
91 | |||
92 | #endif /* _ASM_SCORE_PAGE_H */ | ||
diff --git a/arch/score/include/asm/param.h b/arch/score/include/asm/param.h new file mode 100644 index 000000000000..916b8690b6aa --- /dev/null +++ b/arch/score/include/asm/param.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_PARAM_H | ||
2 | #define _ASM_SCORE_PARAM_H | ||
3 | |||
4 | #include <asm-generic/param.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_PARAM_H */ | ||
diff --git a/arch/score/include/asm/pci.h b/arch/score/include/asm/pci.h new file mode 100644 index 000000000000..3f3cfd82549c --- /dev/null +++ b/arch/score/include/asm/pci.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef _ASM_SCORE_PCI_H | ||
2 | #define _ASM_SCORE_PCI_H | ||
3 | |||
4 | #endif /* _ASM_SCORE_PCI_H */ | ||
diff --git a/arch/score/include/asm/percpu.h b/arch/score/include/asm/percpu.h new file mode 100644 index 000000000000..e7bd4e05b475 --- /dev/null +++ b/arch/score/include/asm/percpu.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_PERCPU_H | ||
2 | #define _ASM_SCORE_PERCPU_H | ||
3 | |||
4 | #include <asm-generic/percpu.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_PERCPU_H */ | ||
diff --git a/arch/score/include/asm/pgalloc.h b/arch/score/include/asm/pgalloc.h new file mode 100644 index 000000000000..059a61b7071b --- /dev/null +++ b/arch/score/include/asm/pgalloc.h | |||
@@ -0,0 +1,83 @@ | |||
1 | #ifndef _ASM_SCORE_PGALLOC_H | ||
2 | #define _ASM_SCORE_PGALLOC_H | ||
3 | |||
4 | #include <linux/mm.h> | ||
5 | |||
6 | static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, | ||
7 | pte_t *pte) | ||
8 | { | ||
9 | set_pmd(pmd, __pmd((unsigned long)pte)); | ||
10 | } | ||
11 | |||
12 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | ||
13 | pgtable_t pte) | ||
14 | { | ||
15 | set_pmd(pmd, __pmd((unsigned long)page_address(pte))); | ||
16 | } | ||
17 | |||
18 | #define pmd_pgtable(pmd) pmd_page(pmd) | ||
19 | |||
20 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) | ||
21 | { | ||
22 | pgd_t *ret, *init; | ||
23 | |||
24 | ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ORDER); | ||
25 | if (ret) { | ||
26 | init = pgd_offset(&init_mm, 0UL); | ||
27 | pgd_init((unsigned long)ret); | ||
28 | memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, | ||
29 | (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); | ||
30 | } | ||
31 | |||
32 | return ret; | ||
33 | } | ||
34 | |||
35 | static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) | ||
36 | { | ||
37 | free_pages((unsigned long)pgd, PGD_ORDER); | ||
38 | } | ||
39 | |||
40 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | ||
41 | unsigned long address) | ||
42 | { | ||
43 | pte_t *pte; | ||
44 | |||
45 | pte = (pte_t *) __get_free_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, | ||
46 | PTE_ORDER); | ||
47 | |||
48 | return pte; | ||
49 | } | ||
50 | |||
51 | static inline struct page *pte_alloc_one(struct mm_struct *mm, | ||
52 | unsigned long address) | ||
53 | { | ||
54 | struct page *pte; | ||
55 | |||
56 | pte = alloc_pages(GFP_KERNEL | __GFP_REPEAT, PTE_ORDER); | ||
57 | if (pte) { | ||
58 | clear_highpage(pte); | ||
59 | pgtable_page_ctor(pte); | ||
60 | } | ||
61 | return pte; | ||
62 | } | ||
63 | |||
64 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | ||
65 | { | ||
66 | free_pages((unsigned long)pte, PTE_ORDER); | ||
67 | } | ||
68 | |||
69 | static inline void pte_free(struct mm_struct *mm, pgtable_t pte) | ||
70 | { | ||
71 | pgtable_page_dtor(pte); | ||
72 | __free_pages(pte, PTE_ORDER); | ||
73 | } | ||
74 | |||
75 | #define __pte_free_tlb(tlb, pte, buf) \ | ||
76 | do { \ | ||
77 | pgtable_page_dtor(pte); \ | ||
78 | tlb_remove_page((tlb), pte); \ | ||
79 | } while (0) | ||
80 | |||
81 | #define check_pgt_cache() do {} while (0) | ||
82 | |||
83 | #endif /* _ASM_SCORE_PGALLOC_H */ | ||
diff --git a/arch/score/include/asm/pgtable-bits.h b/arch/score/include/asm/pgtable-bits.h new file mode 100644 index 000000000000..7d65a96a82e5 --- /dev/null +++ b/arch/score/include/asm/pgtable-bits.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _ASM_SCORE_PGTABLE_BITS_H | ||
2 | #define _ASM_SCORE_PGTABLE_BITS_H | ||
3 | |||
4 | #define _PAGE_ACCESSED (1<<5) /* implemented in software */ | ||
5 | #define _PAGE_READ (1<<6) /* implemented in software */ | ||
6 | #define _PAGE_WRITE (1<<7) /* implemented in software */ | ||
7 | #define _PAGE_PRESENT (1<<9) /* implemented in software */ | ||
8 | #define _PAGE_MODIFIED (1<<10) /* implemented in software */ | ||
9 | #define _PAGE_FILE (1<<10) | ||
10 | |||
11 | #define _PAGE_GLOBAL (1<<0) | ||
12 | #define _PAGE_VALID (1<<1) | ||
13 | #define _PAGE_SILENT_READ (1<<1) /* synonym */ | ||
14 | #define _PAGE_DIRTY (1<<2) /* Write bit */ | ||
15 | #define _PAGE_SILENT_WRITE (1<<2) | ||
16 | #define _PAGE_CACHE (1<<3) /* cache */ | ||
17 | #define _CACHE_MASK (1<<3) | ||
18 | #define _PAGE_BUFFERABLE (1<<4) /*Fallow Spec. */ | ||
19 | |||
20 | #define __READABLE (_PAGE_READ | _PAGE_SILENT_READ | _PAGE_ACCESSED) | ||
21 | #define __WRITEABLE (_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED) | ||
22 | #define _PAGE_CHG_MASK \ | ||
23 | (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED | _PAGE_CACHE) | ||
24 | |||
25 | #endif /* _ASM_SCORE_PGTABLE_BITS_H */ | ||
diff --git a/arch/score/include/asm/pgtable.h b/arch/score/include/asm/pgtable.h new file mode 100644 index 000000000000..674934b40170 --- /dev/null +++ b/arch/score/include/asm/pgtable.h | |||
@@ -0,0 +1,287 @@ | |||
1 | #ifndef _ASM_SCORE_PGTABLE_H | ||
2 | #define _ASM_SCORE_PGTABLE_H | ||
3 | |||
4 | #include <linux/const.h> | ||
5 | #include <asm-generic/pgtable-nopmd.h> | ||
6 | |||
7 | #include <asm/fixmap.h> | ||
8 | #include <asm/setup.h> | ||
9 | #include <asm/pgtable-bits.h> | ||
10 | |||
11 | extern void load_pgd(unsigned long pg_dir); | ||
12 | extern pte_t invalid_pte_table[PAGE_SIZE/sizeof(pte_t)]; | ||
13 | |||
14 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | ||
15 | #define PGDIR_SHIFT 22 | ||
16 | #define PGDIR_SIZE (_AC(1, UL) << PGDIR_SHIFT) | ||
17 | #define PGDIR_MASK (~(PGDIR_SIZE - 1)) | ||
18 | |||
19 | /* | ||
20 | * Entries per page directory level: we use two-level, so | ||
21 | * we don't really have any PUD/PMD directory physically. | ||
22 | */ | ||
23 | #define PGD_ORDER 0 | ||
24 | #define PTE_ORDER 0 | ||
25 | |||
26 | #define PTRS_PER_PGD 1024 | ||
27 | #define PTRS_PER_PTE 1024 | ||
28 | |||
29 | #define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE) | ||
30 | #define FIRST_USER_ADDRESS 0 | ||
31 | |||
32 | #define VMALLOC_START (0xc0000000UL) | ||
33 | |||
34 | #define PKMAP_BASE (0xfd000000UL) | ||
35 | |||
36 | #define VMALLOC_END (FIXADDR_START - 2*PAGE_SIZE) | ||
37 | |||
38 | #define pte_ERROR(e) \ | ||
39 | printk(KERN_ERR "%s:%d: bad pte %08lx.\n", \ | ||
40 | __FILE__, __LINE__, pte_val(e)) | ||
41 | #define pgd_ERROR(e) \ | ||
42 | printk(KERN_ERR "%s:%d: bad pgd %08lx.\n", \ | ||
43 | __FILE__, __LINE__, pgd_val(e)) | ||
44 | |||
45 | /* | ||
46 | * Empty pgd/pmd entries point to the invalid_pte_table. | ||
47 | */ | ||
48 | static inline int pmd_none(pmd_t pmd) | ||
49 | { | ||
50 | return pmd_val(pmd) == (unsigned long) invalid_pte_table; | ||
51 | } | ||
52 | |||
53 | #define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK) | ||
54 | |||
55 | static inline int pmd_present(pmd_t pmd) | ||
56 | { | ||
57 | return pmd_val(pmd) != (unsigned long) invalid_pte_table; | ||
58 | } | ||
59 | |||
60 | static inline void pmd_clear(pmd_t *pmdp) | ||
61 | { | ||
62 | pmd_val(*pmdp) = ((unsigned long) invalid_pte_table); | ||
63 | } | ||
64 | |||
65 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | ||
66 | #define pte_pfn(x) ((unsigned long)((x).pte >> PAGE_SHIFT)) | ||
67 | #define pfn_pte(pfn, prot) \ | ||
68 | __pte(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot)) | ||
69 | |||
70 | #define __pgd_offset(address) pgd_index(address) | ||
71 | #define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) | ||
72 | #define __pmd_offset(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) | ||
73 | |||
74 | /* to find an entry in a kernel page-table-directory */ | ||
75 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) | ||
76 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | ||
77 | |||
78 | /* to find an entry in a page-table-directory */ | ||
79 | #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) | ||
80 | |||
81 | /* Find an entry in the third-level page table.. */ | ||
82 | #define __pte_offset(address) \ | ||
83 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | ||
84 | #define pte_offset(dir, address) \ | ||
85 | ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) | ||
86 | #define pte_offset_kernel(dir, address) \ | ||
87 | ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) | ||
88 | |||
89 | #define pte_offset_map(dir, address) \ | ||
90 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) | ||
91 | #define pte_offset_map_nested(dir, address) \ | ||
92 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) | ||
93 | #define pte_unmap(pte) ((void)(pte)) | ||
94 | #define pte_unmap_nested(pte) ((void)(pte)) | ||
95 | |||
96 | /* | ||
97 | * Bits 9(_PAGE_PRESENT) and 10(_PAGE_FILE)are taken, | ||
98 | * split up 30 bits of offset into this range: | ||
99 | */ | ||
100 | #define PTE_FILE_MAX_BITS 30 | ||
101 | #define pte_to_pgoff(_pte) \ | ||
102 | (((_pte).pte & 0x1ff) | (((_pte).pte >> 11) << 9)) | ||
103 | #define pgoff_to_pte(off) \ | ||
104 | ((pte_t) {((off) & 0x1ff) | (((off) >> 9) << 11) | _PAGE_FILE}) | ||
105 | #define __pte_to_swp_entry(pte) \ | ||
106 | ((swp_entry_t) { pte_val(pte)}) | ||
107 | #define __swp_entry_to_pte(x) ((pte_t) {(x).val}) | ||
108 | |||
109 | #define pmd_phys(pmd) __pa((void *)pmd_val(pmd)) | ||
110 | #define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) | ||
111 | #define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot) | ||
112 | static inline pte_t pte_mkspecial(pte_t pte) { return pte; } | ||
113 | |||
114 | #define set_pte(pteptr, pteval) (*(pteptr) = pteval) | ||
115 | #define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval) | ||
116 | #define pte_clear(mm, addr, xp) \ | ||
117 | do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) | ||
118 | |||
119 | #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ | ||
120 | remap_pfn_range(vma, vaddr, pfn, size, prot) | ||
121 | |||
122 | /* | ||
123 | * The "pgd_xxx()" functions here are trivial for a folded two-level | ||
124 | * setup: the pgd is never bad, and a pmd always exists (as it's folded | ||
125 | * into the pgd entry) | ||
126 | */ | ||
127 | #define pgd_present(pgd) (1) | ||
128 | #define pgd_none(pgd) (0) | ||
129 | #define pgd_bad(pgd) (0) | ||
130 | #define pgd_clear(pgdp) do { } while (0) | ||
131 | |||
132 | #define kern_addr_valid(addr) (1) | ||
133 | #define pmd_page_vaddr(pmd) pmd_val(pmd) | ||
134 | |||
135 | #define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL)) | ||
136 | #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) | ||
137 | |||
138 | #define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_CACHE) | ||
139 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \ | ||
140 | _PAGE_CACHE) | ||
141 | #define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_CACHE) | ||
142 | #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_CACHE) | ||
143 | #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \ | ||
144 | _PAGE_GLOBAL | _PAGE_CACHE) | ||
145 | #define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE | \ | ||
146 | __WRITEABLE | _PAGE_GLOBAL & ~_PAGE_CACHE) | ||
147 | |||
148 | #define __P000 PAGE_NONE | ||
149 | #define __P001 PAGE_READONLY | ||
150 | #define __P010 PAGE_COPY | ||
151 | #define __P011 PAGE_COPY | ||
152 | #define __P100 PAGE_READONLY | ||
153 | #define __P101 PAGE_READONLY | ||
154 | #define __P110 PAGE_COPY | ||
155 | #define __P111 PAGE_COPY | ||
156 | |||
157 | #define __S000 PAGE_NONE | ||
158 | #define __S001 PAGE_READONLY | ||
159 | #define __S010 PAGE_SHARED | ||
160 | #define __S011 PAGE_SHARED | ||
161 | #define __S100 PAGE_READONLY | ||
162 | #define __S101 PAGE_READONLY | ||
163 | #define __S110 PAGE_SHARED | ||
164 | #define __S111 PAGE_SHARED | ||
165 | |||
166 | #define pgprot_noncached pgprot_noncached | ||
167 | |||
168 | static inline pgprot_t pgprot_noncached(pgprot_t _prot) | ||
169 | { | ||
170 | unsigned long prot = pgprot_val(_prot); | ||
171 | |||
172 | prot = (prot & ~_CACHE_MASK); | ||
173 | |||
174 | return __pgprot(prot); | ||
175 | } | ||
176 | |||
177 | #define __swp_type(x) ((x).val & 0x1f) | ||
178 | #define __swp_offset(x) ((x).val >> 11) | ||
179 | #define __swp_entry(type, offset) ((swp_entry_t){(type) | ((offset) << 11)}) | ||
180 | |||
181 | extern unsigned long empty_zero_page; | ||
182 | extern unsigned long zero_page_mask; | ||
183 | |||
184 | #define ZERO_PAGE(vaddr) \ | ||
185 | (virt_to_page((void *)(empty_zero_page + \ | ||
186 | (((unsigned long)(vaddr)) & zero_page_mask)))) | ||
187 | |||
188 | #define pgtable_cache_init() do {} while (0) | ||
189 | |||
190 | #define arch_enter_lazy_cpu_mode() do {} while (0) | ||
191 | |||
192 | static inline int pte_write(pte_t pte) | ||
193 | { | ||
194 | return pte_val(pte) & _PAGE_WRITE; | ||
195 | } | ||
196 | |||
197 | static inline int pte_dirty(pte_t pte) | ||
198 | { | ||
199 | return pte_val(pte) & _PAGE_MODIFIED; | ||
200 | } | ||
201 | |||
202 | static inline int pte_young(pte_t pte) | ||
203 | { | ||
204 | return pte_val(pte) & _PAGE_ACCESSED; | ||
205 | } | ||
206 | |||
207 | static inline int pte_file(pte_t pte) | ||
208 | { | ||
209 | return pte_val(pte) & _PAGE_FILE; | ||
210 | } | ||
211 | |||
212 | #define pte_special(pte) (0) | ||
213 | |||
214 | static inline pte_t pte_wrprotect(pte_t pte) | ||
215 | { | ||
216 | pte_val(pte) &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE); | ||
217 | return pte; | ||
218 | } | ||
219 | |||
220 | static inline pte_t pte_mkclean(pte_t pte) | ||
221 | { | ||
222 | pte_val(pte) &= ~(_PAGE_MODIFIED|_PAGE_SILENT_WRITE); | ||
223 | return pte; | ||
224 | } | ||
225 | |||
226 | static inline pte_t pte_mkold(pte_t pte) | ||
227 | { | ||
228 | pte_val(pte) &= ~(_PAGE_ACCESSED|_PAGE_SILENT_READ); | ||
229 | return pte; | ||
230 | } | ||
231 | |||
232 | static inline pte_t pte_mkwrite(pte_t pte) | ||
233 | { | ||
234 | pte_val(pte) |= _PAGE_WRITE; | ||
235 | if (pte_val(pte) & _PAGE_MODIFIED) | ||
236 | pte_val(pte) |= _PAGE_SILENT_WRITE; | ||
237 | return pte; | ||
238 | } | ||
239 | |||
240 | static inline pte_t pte_mkdirty(pte_t pte) | ||
241 | { | ||
242 | pte_val(pte) |= _PAGE_MODIFIED; | ||
243 | if (pte_val(pte) & _PAGE_WRITE) | ||
244 | pte_val(pte) |= _PAGE_SILENT_WRITE; | ||
245 | return pte; | ||
246 | } | ||
247 | |||
248 | static inline pte_t pte_mkyoung(pte_t pte) | ||
249 | { | ||
250 | pte_val(pte) |= _PAGE_ACCESSED; | ||
251 | if (pte_val(pte) & _PAGE_READ) | ||
252 | pte_val(pte) |= _PAGE_SILENT_READ; | ||
253 | return pte; | ||
254 | } | ||
255 | |||
256 | #define set_pmd(pmdptr, pmdval) \ | ||
257 | do { *(pmdptr) = (pmdval); } while (0) | ||
258 | #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) | ||
259 | |||
260 | extern unsigned long pgd_current; | ||
261 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | ||
262 | extern void paging_init(void); | ||
263 | |||
264 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
265 | { | ||
266 | return __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot)); | ||
267 | } | ||
268 | |||
269 | extern void __update_tlb(struct vm_area_struct *vma, | ||
270 | unsigned long address, pte_t pte); | ||
271 | extern void __update_cache(struct vm_area_struct *vma, | ||
272 | unsigned long address, pte_t pte); | ||
273 | |||
274 | static inline void update_mmu_cache(struct vm_area_struct *vma, | ||
275 | unsigned long address, pte_t pte) | ||
276 | { | ||
277 | __update_tlb(vma, address, pte); | ||
278 | __update_cache(vma, address, pte); | ||
279 | } | ||
280 | |||
281 | #ifndef __ASSEMBLY__ | ||
282 | #include <asm-generic/pgtable.h> | ||
283 | |||
284 | void setup_memory(void); | ||
285 | #endif /* __ASSEMBLY__ */ | ||
286 | |||
287 | #endif /* _ASM_SCORE_PGTABLE_H */ | ||
diff --git a/arch/score/include/asm/poll.h b/arch/score/include/asm/poll.h new file mode 100644 index 000000000000..18532db02861 --- /dev/null +++ b/arch/score/include/asm/poll.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_POLL_H | ||
2 | #define _ASM_SCORE_POLL_H | ||
3 | |||
4 | #include <asm-generic/poll.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_POLL_H */ | ||
diff --git a/arch/score/include/asm/posix_types.h b/arch/score/include/asm/posix_types.h new file mode 100644 index 000000000000..b88acf80048a --- /dev/null +++ b/arch/score/include/asm/posix_types.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_POSIX_TYPES_H | ||
2 | #define _ASM_SCORE_POSIX_TYPES_H | ||
3 | |||
4 | #include <asm-generic/posix_types.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_POSIX_TYPES_H */ | ||
diff --git a/arch/score/include/asm/processor.h b/arch/score/include/asm/processor.h new file mode 100644 index 000000000000..7e22f216d771 --- /dev/null +++ b/arch/score/include/asm/processor.h | |||
@@ -0,0 +1,106 @@ | |||
1 | #ifndef _ASM_SCORE_PROCESSOR_H | ||
2 | #define _ASM_SCORE_PROCESSOR_H | ||
3 | |||
4 | #include <linux/cpumask.h> | ||
5 | #include <linux/threads.h> | ||
6 | |||
7 | #include <asm/segment.h> | ||
8 | |||
9 | struct task_struct; | ||
10 | |||
11 | /* | ||
12 | * System setup and hardware flags.. | ||
13 | */ | ||
14 | extern void (*cpu_wait)(void); | ||
15 | |||
16 | extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | ||
17 | extern unsigned long thread_saved_pc(struct task_struct *tsk); | ||
18 | extern void start_thread(struct pt_regs *regs, | ||
19 | unsigned long pc, unsigned long sp); | ||
20 | extern unsigned long get_wchan(struct task_struct *p); | ||
21 | |||
22 | /* | ||
23 | * Return current * instruction pointer ("program counter"). | ||
24 | */ | ||
25 | #define current_text_addr() ({ __label__ _l; _l: &&_l; }) | ||
26 | |||
27 | #define cpu_relax() barrier() | ||
28 | #define release_thread(thread) do {} while (0) | ||
29 | #define prepare_to_copy(tsk) do {} while (0) | ||
30 | |||
31 | /* | ||
32 | * User space process size: 2GB. This is hardcoded into a few places, | ||
33 | * so don't change it unless you know what you are doing. | ||
34 | */ | ||
35 | #define TASK_SIZE 0x7fff8000UL | ||
36 | |||
37 | /* | ||
38 | * This decides where the kernel will search for a free chunk of vm | ||
39 | * space during mmap's. | ||
40 | */ | ||
41 | #define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE)) | ||
42 | |||
43 | #ifdef __KERNEL__ | ||
44 | #define STACK_TOP TASK_SIZE | ||
45 | #define STACK_TOP_MAX TASK_SIZE | ||
46 | #endif | ||
47 | |||
48 | /* | ||
49 | * If you change thread_struct remember to change the #defines below too! | ||
50 | */ | ||
51 | struct thread_struct { | ||
52 | unsigned long reg0, reg2, reg3; | ||
53 | unsigned long reg12, reg13, reg14, reg15, reg16; | ||
54 | unsigned long reg17, reg18, reg19, reg20, reg21; | ||
55 | |||
56 | unsigned long cp0_psr; | ||
57 | unsigned long cp0_ema; /* Last user fault */ | ||
58 | unsigned long cp0_badvaddr; /* Last user fault */ | ||
59 | unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */ | ||
60 | unsigned long error_code; | ||
61 | unsigned long trap_no; | ||
62 | |||
63 | unsigned long mflags; | ||
64 | unsigned long reg29; | ||
65 | |||
66 | unsigned long single_step; | ||
67 | unsigned long ss_nextcnt; | ||
68 | |||
69 | unsigned long insn1_type; | ||
70 | unsigned long addr1; | ||
71 | unsigned long insn1; | ||
72 | |||
73 | unsigned long insn2_type; | ||
74 | unsigned long addr2; | ||
75 | unsigned long insn2; | ||
76 | |||
77 | mm_segment_t current_ds; | ||
78 | }; | ||
79 | |||
80 | #define INIT_THREAD { \ | ||
81 | .reg0 = 0, \ | ||
82 | .reg2 = 0, \ | ||
83 | .reg3 = 0, \ | ||
84 | .reg12 = 0, \ | ||
85 | .reg13 = 0, \ | ||
86 | .reg14 = 0, \ | ||
87 | .reg15 = 0, \ | ||
88 | .reg16 = 0, \ | ||
89 | .reg17 = 0, \ | ||
90 | .reg18 = 0, \ | ||
91 | .reg19 = 0, \ | ||
92 | .reg20 = 0, \ | ||
93 | .reg21 = 0, \ | ||
94 | .cp0_psr = 0, \ | ||
95 | .error_code = 0, \ | ||
96 | .trap_no = 0, \ | ||
97 | } | ||
98 | |||
99 | #define kstk_tos(tsk) \ | ||
100 | ((unsigned long)task_stack_page(tsk) + THREAD_SIZE - 32) | ||
101 | #define task_pt_regs(tsk) ((struct pt_regs *)kstk_tos(tsk) - 1) | ||
102 | |||
103 | #define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc) | ||
104 | #define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29]) | ||
105 | |||
106 | #endif /* _ASM_SCORE_PROCESSOR_H */ | ||
diff --git a/arch/score/include/asm/ptrace.h b/arch/score/include/asm/ptrace.h new file mode 100644 index 000000000000..d40e691f23e2 --- /dev/null +++ b/arch/score/include/asm/ptrace.h | |||
@@ -0,0 +1,97 @@ | |||
1 | #ifndef _ASM_SCORE_PTRACE_H | ||
2 | #define _ASM_SCORE_PTRACE_H | ||
3 | |||
4 | #define PTRACE_GETREGS 12 | ||
5 | #define PTRACE_SETREGS 13 | ||
6 | |||
7 | #define PC 32 | ||
8 | #define CONDITION 33 | ||
9 | #define ECR 34 | ||
10 | #define EMA 35 | ||
11 | #define CEH 36 | ||
12 | #define CEL 37 | ||
13 | #define COUNTER 38 | ||
14 | #define LDCR 39 | ||
15 | #define STCR 40 | ||
16 | #define PSR 41 | ||
17 | |||
18 | #define SINGLESTEP16_INSN 0x7006 | ||
19 | #define SINGLESTEP32_INSN 0x840C8000 | ||
20 | #define BREAKPOINT16_INSN 0x7002 /* work on SPG300 */ | ||
21 | #define BREAKPOINT32_INSN 0x84048000 /* work on SPG300 */ | ||
22 | |||
23 | /* Define instruction mask */ | ||
24 | #define INSN32_MASK 0x80008000 | ||
25 | |||
26 | #define J32 0x88008000 /* 1_00010_0000000000_1_000000000000000 */ | ||
27 | #define J32M 0xFC008000 /* 1_11111_0000000000_1_000000000000000 */ | ||
28 | |||
29 | #define B32 0x90008000 /* 1_00100_0000000000_1_000000000000000 */ | ||
30 | #define B32M 0xFC008000 | ||
31 | #define BL32 0x90008001 /* 1_00100_0000000000_1_000000000000001 */ | ||
32 | #define BL32M B32 | ||
33 | #define BR32 0x80008008 /* 1_00000_0000000000_1_00000000_000100_0 */ | ||
34 | #define BR32M 0xFFE0807E | ||
35 | #define BRL32 0x80008009 /* 1_00000_0000000000_1_00000000_000100_1 */ | ||
36 | #define BRL32M BR32M | ||
37 | |||
38 | #define B32_SET (J32 | B32 | BL32 | BR32 | BRL32) | ||
39 | |||
40 | #define J16 0x3000 /* 0_011_....... */ | ||
41 | #define J16M 0xF000 | ||
42 | #define B16 0x4000 /* 0_100_....... */ | ||
43 | #define B16M 0xF000 | ||
44 | #define BR16 0x0004 /* 0_000.......0100 */ | ||
45 | #define BR16M 0xF00F | ||
46 | #define B16_SET (J16 | B16 | BR16) | ||
47 | |||
48 | |||
49 | /* | ||
50 | * This struct defines the way the registers are stored on the stack during a | ||
51 | * system call/exception. As usual the registers k0/k1 aren't being saved. | ||
52 | */ | ||
53 | struct pt_regs { | ||
54 | unsigned long pad0[6]; /* stack arguments */ | ||
55 | unsigned long orig_r4; | ||
56 | unsigned long orig_r7; | ||
57 | long is_syscall; | ||
58 | |||
59 | unsigned long regs[32]; | ||
60 | |||
61 | unsigned long cel; | ||
62 | unsigned long ceh; | ||
63 | |||
64 | unsigned long sr0; /* cnt */ | ||
65 | unsigned long sr1; /* lcr */ | ||
66 | unsigned long sr2; /* scr */ | ||
67 | |||
68 | unsigned long cp0_epc; | ||
69 | unsigned long cp0_ema; | ||
70 | unsigned long cp0_psr; | ||
71 | unsigned long cp0_ecr; | ||
72 | unsigned long cp0_condition; | ||
73 | }; | ||
74 | |||
75 | #ifdef __KERNEL__ | ||
76 | |||
77 | struct task_struct; | ||
78 | |||
79 | /* | ||
80 | * Does the process account for user or for system time? | ||
81 | */ | ||
82 | #define user_mode(regs) ((regs->cp0_psr & 8) == 8) | ||
83 | |||
84 | #define instruction_pointer(regs) ((unsigned long)(regs)->cp0_epc) | ||
85 | #define profile_pc(regs) instruction_pointer(regs) | ||
86 | |||
87 | extern void do_syscall_trace(struct pt_regs *regs, int entryexit); | ||
88 | extern int read_tsk_long(struct task_struct *, unsigned long, unsigned long *); | ||
89 | extern int read_tsk_short(struct task_struct *, unsigned long, | ||
90 | unsigned short *); | ||
91 | |||
92 | #define arch_has_single_step() (1) | ||
93 | extern void user_enable_single_step(struct task_struct *); | ||
94 | extern void user_disable_single_step(struct task_struct *); | ||
95 | #endif /* __KERNEL__ */ | ||
96 | |||
97 | #endif /* _ASM_SCORE_PTRACE_H */ | ||
diff --git a/arch/score/include/asm/resource.h b/arch/score/include/asm/resource.h new file mode 100644 index 000000000000..9ce22bc7b475 --- /dev/null +++ b/arch/score/include/asm/resource.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_RESOURCE_H | ||
2 | #define _ASM_SCORE_RESOURCE_H | ||
3 | |||
4 | #include <asm-generic/resource.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_RESOURCE_H */ | ||
diff --git a/arch/score/include/asm/scatterlist.h b/arch/score/include/asm/scatterlist.h new file mode 100644 index 000000000000..9f533b8362c7 --- /dev/null +++ b/arch/score/include/asm/scatterlist.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SCATTERLIST_H | ||
2 | #define _ASM_SCORE_SCATTERLIST_H | ||
3 | |||
4 | #include <asm-generic/scatterlist.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SCATTERLIST_H */ | ||
diff --git a/arch/score/include/asm/scoreregs.h b/arch/score/include/asm/scoreregs.h new file mode 100644 index 000000000000..d0ad29204518 --- /dev/null +++ b/arch/score/include/asm/scoreregs.h | |||
@@ -0,0 +1,51 @@ | |||
1 | #ifndef _ASM_SCORE_SCOREREGS_H | ||
2 | #define _ASM_SCORE_SCOREREGS_H | ||
3 | |||
4 | #include <linux/linkage.h> | ||
5 | |||
6 | /* TIMER register */ | ||
7 | #define TIME0BASE 0x96080000 | ||
8 | #define P_TIMER0_CTRL (TIME0BASE + 0x00) | ||
9 | #define P_TIMER0_CPP_CTRL (TIME0BASE + 0x04) | ||
10 | #define P_TIMER0_PRELOAD (TIME0BASE + 0x08) | ||
11 | #define P_TIMER0_CPP_REG (TIME0BASE + 0x0C) | ||
12 | #define P_TIMER0_UPCNT (TIME0BASE + 0x10) | ||
13 | |||
14 | /* Timer Controller Register */ | ||
15 | /* bit 0 Timer enable */ | ||
16 | #define TMR_DISABLE 0x0000 | ||
17 | #define TMR_ENABLE 0x0001 | ||
18 | |||
19 | /* bit 1 Interrupt enable */ | ||
20 | #define TMR_IE_DISABLE 0x0000 | ||
21 | #define TMR_IE_ENABLE 0x0002 | ||
22 | |||
23 | /* bit 2 Output enable */ | ||
24 | #define TMR_OE_DISABLE 0x0004 | ||
25 | #define TMR_OE_ENABLE 0x0000 | ||
26 | |||
27 | /* bit4 Up/Down counting selection */ | ||
28 | #define TMR_UD_DOWN 0x0000 | ||
29 | #define TMR_UD_UP 0x0010 | ||
30 | |||
31 | /* bit5 Up/Down counting control selection */ | ||
32 | #define TMR_UDS_UD 0x0000 | ||
33 | #define TMR_UDS_EXTUD 0x0020 | ||
34 | |||
35 | /* bit6 Time output mode */ | ||
36 | #define TMR_OM_TOGGLE 0x0000 | ||
37 | #define TMR_OM_PILSE 0x0040 | ||
38 | |||
39 | /* bit 8..9 External input active edge selection */ | ||
40 | #define TMR_ES_PE 0x0000 | ||
41 | #define TMR_ES_NE 0x0100 | ||
42 | #define TMR_ES_BOTH 0x0200 | ||
43 | |||
44 | /* bit 10..11 Operating mode */ | ||
45 | #define TMR_M_FREE 0x0000 /* free running timer mode */ | ||
46 | #define TMR_M_PERIODIC 0x0400 /* periodic timer mode */ | ||
47 | #define TMR_M_FC 0x0800 /* free running counter mode */ | ||
48 | #define TMR_M_PC 0x0c00 /* periodic counter mode */ | ||
49 | |||
50 | #define SYSTEM_CLOCK (27*1000000/4) /* 27 MHz */ | ||
51 | #endif /* _ASM_SCORE_SCOREREGS_H */ | ||
diff --git a/arch/score/include/asm/sections.h b/arch/score/include/asm/sections.h new file mode 100644 index 000000000000..9441d23af005 --- /dev/null +++ b/arch/score/include/asm/sections.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SECTIONS_H | ||
2 | #define _ASM_SCORE_SECTIONS_H | ||
3 | |||
4 | #include <asm-generic/sections.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SECTIONS_H */ | ||
diff --git a/arch/score/include/asm/segment.h b/arch/score/include/asm/segment.h new file mode 100644 index 000000000000..e16cf6afb495 --- /dev/null +++ b/arch/score/include/asm/segment.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef _ASM_SCORE_SEGMENT_H | ||
2 | #define _ASM_SCORE_SEGMENT_H | ||
3 | |||
4 | #ifndef __ASSEMBLY__ | ||
5 | |||
6 | typedef struct { | ||
7 | unsigned long seg; | ||
8 | } mm_segment_t; | ||
9 | |||
10 | #define KERNEL_DS ((mm_segment_t){0}) | ||
11 | #define USER_DS KERNEL_DS | ||
12 | |||
13 | # define get_ds() (KERNEL_DS) | ||
14 | # define get_fs() (current_thread_info()->addr_limit) | ||
15 | # define set_fs(x) \ | ||
16 | do { current_thread_info()->addr_limit = (x); } while (0) | ||
17 | |||
18 | # define segment_eq(a, b) ((a).seg == (b).seg) | ||
19 | |||
20 | # endif /* __ASSEMBLY__ */ | ||
21 | #endif /* _ASM_SCORE_SEGMENT_H */ | ||
diff --git a/arch/score/include/asm/sembuf.h b/arch/score/include/asm/sembuf.h new file mode 100644 index 000000000000..dae5e835ce9e --- /dev/null +++ b/arch/score/include/asm/sembuf.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SEMBUF_H | ||
2 | #define _ASM_SCORE_SEMBUF_H | ||
3 | |||
4 | #include <asm-generic/sembuf.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SEMBUF_H */ | ||
diff --git a/arch/score/include/asm/setup.h b/arch/score/include/asm/setup.h new file mode 100644 index 000000000000..3cb944dc68dc --- /dev/null +++ b/arch/score/include/asm/setup.h | |||
@@ -0,0 +1,41 @@ | |||
1 | #ifndef _ASM_SCORE_SETUP_H | ||
2 | #define _ASM_SCORE_SETUP_H | ||
3 | |||
4 | #define COMMAND_LINE_SIZE 256 | ||
5 | #define MEMORY_START 0 | ||
6 | #define MEMORY_SIZE 0x2000000 | ||
7 | |||
8 | #ifdef __KERNEL__ | ||
9 | |||
10 | extern void pagetable_init(void); | ||
11 | extern void pgd_init(unsigned long page); | ||
12 | |||
13 | extern void setup_early_printk(void); | ||
14 | extern void cpu_cache_init(void); | ||
15 | extern void tlb_init(void); | ||
16 | |||
17 | extern void handle_nmi(void); | ||
18 | extern void handle_adelinsn(void); | ||
19 | extern void handle_adedata(void); | ||
20 | extern void handle_ibe(void); | ||
21 | extern void handle_pel(void); | ||
22 | extern void handle_sys(void); | ||
23 | extern void handle_ccu(void); | ||
24 | extern void handle_ri(void); | ||
25 | extern void handle_tr(void); | ||
26 | extern void handle_ades(void); | ||
27 | extern void handle_cee(void); | ||
28 | extern void handle_cpe(void); | ||
29 | extern void handle_dve(void); | ||
30 | extern void handle_dbe(void); | ||
31 | extern void handle_reserved(void); | ||
32 | extern void handle_tlb_refill(void); | ||
33 | extern void handle_tlb_invaild(void); | ||
34 | extern void handle_mod(void); | ||
35 | extern void debug_exception_vector(void); | ||
36 | extern void general_exception_vector(void); | ||
37 | extern void interrupt_exception_vector(void); | ||
38 | |||
39 | #endif /* __KERNEL__ */ | ||
40 | |||
41 | #endif /* _ASM_SCORE_SETUP_H */ | ||
diff --git a/arch/score/include/asm/shmbuf.h b/arch/score/include/asm/shmbuf.h new file mode 100644 index 000000000000..c85b2429ba21 --- /dev/null +++ b/arch/score/include/asm/shmbuf.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SHMBUF_H | ||
2 | #define _ASM_SCORE_SHMBUF_H | ||
3 | |||
4 | #include <asm-generic/shmbuf.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SHMBUF_H */ | ||
diff --git a/arch/score/include/asm/shmparam.h b/arch/score/include/asm/shmparam.h new file mode 100644 index 000000000000..1d60813141b6 --- /dev/null +++ b/arch/score/include/asm/shmparam.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SHMPARAM_H | ||
2 | #define _ASM_SCORE_SHMPARAM_H | ||
3 | |||
4 | #include <asm-generic/shmparam.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SHMPARAM_H */ | ||
diff --git a/arch/score/include/asm/sigcontext.h b/arch/score/include/asm/sigcontext.h new file mode 100644 index 000000000000..5ffda39ddb90 --- /dev/null +++ b/arch/score/include/asm/sigcontext.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _ASM_SCORE_SIGCONTEXT_H | ||
2 | #define _ASM_SCORE_SIGCONTEXT_H | ||
3 | |||
4 | /* | ||
5 | * Keep this struct definition in sync with the sigcontext fragment | ||
6 | * in arch/score/tools/offset.c | ||
7 | */ | ||
8 | struct sigcontext { | ||
9 | unsigned int sc_regmask; | ||
10 | unsigned int sc_psr; | ||
11 | unsigned int sc_condition; | ||
12 | unsigned long sc_pc; | ||
13 | unsigned long sc_regs[32]; | ||
14 | unsigned int sc_ssflags; | ||
15 | unsigned int sc_mdceh; | ||
16 | unsigned int sc_mdcel; | ||
17 | unsigned int sc_ecr; | ||
18 | unsigned long sc_ema; | ||
19 | unsigned long sc_sigset[4]; | ||
20 | }; | ||
21 | |||
22 | #endif /* _ASM_SCORE_SIGCONTEXT_H */ | ||
diff --git a/arch/score/include/asm/siginfo.h b/arch/score/include/asm/siginfo.h new file mode 100644 index 000000000000..87ca35607a28 --- /dev/null +++ b/arch/score/include/asm/siginfo.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SIGINFO_H | ||
2 | #define _ASM_SCORE_SIGINFO_H | ||
3 | |||
4 | #include <asm-generic/siginfo.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SIGINFO_H */ | ||
diff --git a/arch/score/include/asm/signal.h b/arch/score/include/asm/signal.h new file mode 100644 index 000000000000..2605bc06b64f --- /dev/null +++ b/arch/score/include/asm/signal.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SIGNAL_H | ||
2 | #define _ASM_SCORE_SIGNAL_H | ||
3 | |||
4 | #include <asm-generic/signal.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SIGNAL_H */ | ||
diff --git a/arch/score/include/asm/socket.h b/arch/score/include/asm/socket.h new file mode 100644 index 000000000000..612a70e385ba --- /dev/null +++ b/arch/score/include/asm/socket.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SOCKET_H | ||
2 | #define _ASM_SCORE_SOCKET_H | ||
3 | |||
4 | #include <asm-generic/socket.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SOCKET_H */ | ||
diff --git a/arch/score/include/asm/sockios.h b/arch/score/include/asm/sockios.h new file mode 100644 index 000000000000..ba8256480189 --- /dev/null +++ b/arch/score/include/asm/sockios.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SOCKIOS_H | ||
2 | #define _ASM_SCORE_SOCKIOS_H | ||
3 | |||
4 | #include <asm-generic/sockios.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SOCKIOS_H */ | ||
diff --git a/arch/score/include/asm/stat.h b/arch/score/include/asm/stat.h new file mode 100644 index 000000000000..5037055500a2 --- /dev/null +++ b/arch/score/include/asm/stat.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_STAT_H | ||
2 | #define _ASM_SCORE_STAT_H | ||
3 | |||
4 | #include <asm-generic/stat.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_STAT_H */ | ||
diff --git a/arch/score/include/asm/statfs.h b/arch/score/include/asm/statfs.h new file mode 100644 index 000000000000..36e41004e996 --- /dev/null +++ b/arch/score/include/asm/statfs.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_STATFS_H | ||
2 | #define _ASM_SCORE_STATFS_H | ||
3 | |||
4 | #include <asm-generic/statfs.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_STATFS_H */ | ||
diff --git a/arch/score/include/asm/string.h b/arch/score/include/asm/string.h new file mode 100644 index 000000000000..8a6bf5063aa5 --- /dev/null +++ b/arch/score/include/asm/string.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _ASM_SCORE_STRING_H | ||
2 | #define _ASM_SCORE_STRING_H | ||
3 | |||
4 | extern void *memset(void *__s, int __c, size_t __count); | ||
5 | extern void *memcpy(void *__to, __const__ void *__from, size_t __n); | ||
6 | extern void *memmove(void *__dest, __const__ void *__src, size_t __n); | ||
7 | |||
8 | #endif /* _ASM_SCORE_STRING_H */ | ||
diff --git a/arch/score/include/asm/swab.h b/arch/score/include/asm/swab.h new file mode 100644 index 000000000000..fadc3cc6d8a2 --- /dev/null +++ b/arch/score/include/asm/swab.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SWAB_H | ||
2 | #define _ASM_SCORE_SWAB_H | ||
3 | |||
4 | #include <asm-generic/swab.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SWAB_H */ | ||
diff --git a/arch/score/include/asm/syscalls.h b/arch/score/include/asm/syscalls.h new file mode 100644 index 000000000000..1dd5e0d6b0c3 --- /dev/null +++ b/arch/score/include/asm/syscalls.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef _ASM_SCORE_SYSCALLS_H | ||
2 | #define _ASM_SCORE_SYSCALLS_H | ||
3 | |||
4 | asmlinkage long score_clone(struct pt_regs *regs); | ||
5 | asmlinkage long score_execve(struct pt_regs *regs); | ||
6 | asmlinkage long score_sigaltstack(struct pt_regs *regs); | ||
7 | asmlinkage long score_rt_sigreturn(struct pt_regs *regs); | ||
8 | |||
9 | #include <asm-generic/syscalls.h> | ||
10 | |||
11 | #endif /* _ASM_SCORE_SYSCALLS_H */ | ||
diff --git a/arch/score/include/asm/system.h b/arch/score/include/asm/system.h new file mode 100644 index 000000000000..589d5c7e171c --- /dev/null +++ b/arch/score/include/asm/system.h | |||
@@ -0,0 +1,90 @@ | |||
1 | #ifndef _ASM_SCORE_SYSTEM_H | ||
2 | #define _ASM_SCORE_SYSTEM_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/irqflags.h> | ||
6 | |||
7 | struct pt_regs; | ||
8 | struct task_struct; | ||
9 | |||
10 | extern void *resume(void *last, void *next, void *next_ti); | ||
11 | |||
12 | #define switch_to(prev, next, last) \ | ||
13 | do { \ | ||
14 | (last) = resume(prev, next, task_thread_info(next)); \ | ||
15 | } while (0) | ||
16 | |||
17 | #define finish_arch_switch(prev) do {} while (0) | ||
18 | |||
19 | typedef void (*vi_handler_t)(void); | ||
20 | extern unsigned long arch_align_stack(unsigned long sp); | ||
21 | |||
22 | #define mb() barrier() | ||
23 | #define rmb() barrier() | ||
24 | #define wmb() barrier() | ||
25 | #define smp_mb() barrier() | ||
26 | #define smp_rmb() barrier() | ||
27 | #define smp_wmb() barrier() | ||
28 | |||
29 | #define read_barrier_depends() do {} while (0) | ||
30 | #define smp_read_barrier_depends() do {} while (0) | ||
31 | |||
32 | #define set_mb(var, value) do {var = value; wmb(); } while (0) | ||
33 | |||
34 | #define __HAVE_ARCH_CMPXCHG 1 | ||
35 | |||
36 | #include <asm-generic/cmpxchg-local.h> | ||
37 | |||
38 | #ifndef __ASSEMBLY__ | ||
39 | |||
40 | struct __xchg_dummy { unsigned long a[100]; }; | ||
41 | #define __xg(x) ((struct __xchg_dummy *)(x)) | ||
42 | |||
43 | static inline | ||
44 | unsigned long __xchg(volatile unsigned long *m, unsigned long val) | ||
45 | { | ||
46 | unsigned long retval; | ||
47 | unsigned long flags; | ||
48 | |||
49 | local_irq_save(flags); | ||
50 | retval = *m; | ||
51 | *m = val; | ||
52 | local_irq_restore(flags); | ||
53 | return retval; | ||
54 | } | ||
55 | |||
56 | #define xchg(ptr, v) \ | ||
57 | ((__typeof__(*(ptr))) __xchg((unsigned long *)(ptr), \ | ||
58 | (unsigned long)(v))) | ||
59 | |||
60 | static inline unsigned long __cmpxchg(volatile unsigned long *m, | ||
61 | unsigned long old, unsigned long new) | ||
62 | { | ||
63 | unsigned long retval; | ||
64 | unsigned long flags; | ||
65 | |||
66 | local_irq_save(flags); | ||
67 | retval = *m; | ||
68 | if (retval == old) | ||
69 | *m = new; | ||
70 | local_irq_restore(flags); | ||
71 | return retval; | ||
72 | } | ||
73 | |||
74 | #define cmpxchg(ptr, o, n) \ | ||
75 | ((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \ | ||
76 | (unsigned long)(o), \ | ||
77 | (unsigned long)(n))) | ||
78 | |||
79 | extern void __die(const char *, struct pt_regs *, const char *, | ||
80 | const char *, unsigned long) __attribute__((noreturn)); | ||
81 | extern void __die_if_kernel(const char *, struct pt_regs *, const char *, | ||
82 | const char *, unsigned long); | ||
83 | |||
84 | #define die(msg, regs) \ | ||
85 | __die(msg, regs, __FILE__ ":", __func__, __LINE__) | ||
86 | #define die_if_kernel(msg, regs) \ | ||
87 | __die_if_kernel(msg, regs, __FILE__ ":", __func__, __LINE__) | ||
88 | |||
89 | #endif /* !__ASSEMBLY__ */ | ||
90 | #endif /* _ASM_SCORE_SYSTEM_H */ | ||
diff --git a/arch/score/include/asm/termbits.h b/arch/score/include/asm/termbits.h new file mode 100644 index 000000000000..9a95c1412437 --- /dev/null +++ b/arch/score/include/asm/termbits.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_TERMBITS_H | ||
2 | #define _ASM_SCORE_TERMBITS_H | ||
3 | |||
4 | #include <asm-generic/termbits.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_TERMBITS_H */ | ||
diff --git a/arch/score/include/asm/termios.h b/arch/score/include/asm/termios.h new file mode 100644 index 000000000000..40984e811ad6 --- /dev/null +++ b/arch/score/include/asm/termios.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_TERMIOS_H | ||
2 | #define _ASM_SCORE_TERMIOS_H | ||
3 | |||
4 | #include <asm-generic/termios.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_TERMIOS_H */ | ||
diff --git a/arch/score/include/asm/thread_info.h b/arch/score/include/asm/thread_info.h new file mode 100644 index 000000000000..3a1122885528 --- /dev/null +++ b/arch/score/include/asm/thread_info.h | |||
@@ -0,0 +1,105 @@ | |||
1 | #ifndef _ASM_SCORE_THREAD_INFO_H | ||
2 | #define _ASM_SCORE_THREAD_INFO_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #define KU_MASK 0x08 | ||
7 | #define KU_USER 0x08 | ||
8 | #define KU_KERN 0x00 | ||
9 | |||
10 | #ifndef __ASSEMBLY__ | ||
11 | |||
12 | #include <asm/processor.h> | ||
13 | |||
14 | /* | ||
15 | * low level task data that entry.S needs immediate access to | ||
16 | * - this struct should fit entirely inside of one cache line | ||
17 | * - this struct shares the supervisor stack pages | ||
18 | * - if the contents of this structure are changed, the assembly constants | ||
19 | * must also be changed | ||
20 | */ | ||
21 | struct thread_info { | ||
22 | struct task_struct *task; /* main task structure */ | ||
23 | struct exec_domain *exec_domain; /* execution domain */ | ||
24 | unsigned long flags; /* low level flags */ | ||
25 | unsigned long tp_value; /* thread pointer */ | ||
26 | __u32 cpu; /* current CPU */ | ||
27 | |||
28 | /* 0 => preemptable, < 0 => BUG */ | ||
29 | int preempt_count; | ||
30 | |||
31 | /* | ||
32 | * thread address space: | ||
33 | * 0-0xBFFFFFFF for user-thead | ||
34 | * 0-0xFFFFFFFF for kernel-thread | ||
35 | */ | ||
36 | mm_segment_t addr_limit; | ||
37 | struct restart_block restart_block; | ||
38 | struct pt_regs *regs; | ||
39 | }; | ||
40 | |||
41 | /* | ||
42 | * macros/functions for gaining access to the thread information structure | ||
43 | * | ||
44 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
45 | */ | ||
46 | #define INIT_THREAD_INFO(tsk) \ | ||
47 | { \ | ||
48 | .task = &tsk, \ | ||
49 | .exec_domain = &default_exec_domain, \ | ||
50 | .cpu = 0, \ | ||
51 | .preempt_count = 1, \ | ||
52 | .addr_limit = KERNEL_DS, \ | ||
53 | .restart_block = { \ | ||
54 | .fn = do_no_restart_syscall, \ | ||
55 | }, \ | ||
56 | } | ||
57 | |||
58 | #define init_thread_info (init_thread_union.thread_info) | ||
59 | #define init_stack (init_thread_union.stack) | ||
60 | |||
61 | /* How to get the thread information struct from C. */ | ||
62 | register struct thread_info *__current_thread_info __asm__("r28"); | ||
63 | #define current_thread_info() __current_thread_info | ||
64 | |||
65 | /* thread information allocation */ | ||
66 | #define THREAD_SIZE_ORDER (1) | ||
67 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) | ||
68 | #define THREAD_MASK (THREAD_SIZE - 1UL) | ||
69 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
70 | |||
71 | #define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL) | ||
72 | #define free_thread_info(info) kfree(info) | ||
73 | |||
74 | #endif /* !__ASSEMBLY__ */ | ||
75 | |||
76 | #define PREEMPT_ACTIVE 0x10000000 | ||
77 | |||
78 | /* | ||
79 | * thread information flags | ||
80 | * - these are process state flags that various assembly files may need to | ||
81 | * access | ||
82 | * - pending work-to-be-done flags are in LSW | ||
83 | * - other flags in MSW | ||
84 | */ | ||
85 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
86 | #define TIF_SIGPENDING 1 /* signal pending */ | ||
87 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | ||
88 | #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */ | ||
89 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ | ||
90 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling | ||
91 | TIF_NEED_RESCHED */ | ||
92 | #define TIF_MEMDIE 18 | ||
93 | |||
94 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | ||
95 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | ||
96 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | ||
97 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | ||
98 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
99 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
100 | |||
101 | #define _TIF_WORK_MASK (0x0000ffff) | ||
102 | |||
103 | #endif /* __KERNEL__ */ | ||
104 | |||
105 | #endif /* _ASM_SCORE_THREAD_INFO_H */ | ||
diff --git a/arch/score/include/asm/timex.h b/arch/score/include/asm/timex.h new file mode 100644 index 000000000000..a524ae0c5e7b --- /dev/null +++ b/arch/score/include/asm/timex.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _ASM_SCORE_TIMEX_H | ||
2 | #define _ASM_SCORE_TIMEX_H | ||
3 | |||
4 | #define CLOCK_TICK_RATE 27000000 /* Timer input freq. */ | ||
5 | |||
6 | #include <asm-generic/timex.h> | ||
7 | |||
8 | #endif /* _ASM_SCORE_TIMEX_H */ | ||
diff --git a/arch/score/include/asm/tlb.h b/arch/score/include/asm/tlb.h new file mode 100644 index 000000000000..46882ed524e6 --- /dev/null +++ b/arch/score/include/asm/tlb.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef _ASM_SCORE_TLB_H | ||
2 | #define _ASM_SCORE_TLB_H | ||
3 | |||
4 | /* | ||
5 | * SCORE doesn't need any special per-pte or per-vma handling, except | ||
6 | * we need to flush cache for area to be unmapped. | ||
7 | */ | ||
8 | #define tlb_start_vma(tlb, vma) do {} while (0) | ||
9 | #define tlb_end_vma(tlb, vma) do {} while (0) | ||
10 | #define __tlb_remove_tlb_entry(tlb, ptep, address) do {} while (0) | ||
11 | #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) | ||
12 | |||
13 | extern void score7_FTLB_refill_Handler(void); | ||
14 | |||
15 | #include <asm-generic/tlb.h> | ||
16 | |||
17 | #endif /* _ASM_SCORE_TLB_H */ | ||
diff --git a/arch/score/include/asm/tlbflush.h b/arch/score/include/asm/tlbflush.h new file mode 100644 index 000000000000..9cce978367d5 --- /dev/null +++ b/arch/score/include/asm/tlbflush.h | |||
@@ -0,0 +1,142 @@ | |||
1 | #ifndef _ASM_SCORE_TLBFLUSH_H | ||
2 | #define _ASM_SCORE_TLBFLUSH_H | ||
3 | |||
4 | #include <linux/mm.h> | ||
5 | |||
6 | /* | ||
7 | * TLB flushing: | ||
8 | * | ||
9 | * - flush_tlb_all() flushes all processes TLB entries | ||
10 | * - flush_tlb_mm(mm) flushes the specified mm context TLB entries | ||
11 | * - flush_tlb_page(vma, vmaddr) flushes one page | ||
12 | * - flush_tlb_range(vma, start, end) flushes a range of pages | ||
13 | * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages | ||
14 | */ | ||
15 | extern void local_flush_tlb_all(void); | ||
16 | extern void local_flush_tlb_mm(struct mm_struct *mm); | ||
17 | extern void local_flush_tlb_range(struct vm_area_struct *vma, | ||
18 | unsigned long start, unsigned long end); | ||
19 | extern void local_flush_tlb_kernel_range(unsigned long start, | ||
20 | unsigned long end); | ||
21 | extern void local_flush_tlb_page(struct vm_area_struct *vma, | ||
22 | unsigned long page); | ||
23 | extern void local_flush_tlb_one(unsigned long vaddr); | ||
24 | |||
25 | #define flush_tlb_all() local_flush_tlb_all() | ||
26 | #define flush_tlb_mm(mm) local_flush_tlb_mm(mm) | ||
27 | #define flush_tlb_range(vma, vmaddr, end) \ | ||
28 | local_flush_tlb_range(vma, vmaddr, end) | ||
29 | #define flush_tlb_kernel_range(vmaddr, end) \ | ||
30 | local_flush_tlb_kernel_range(vmaddr, end) | ||
31 | #define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page) | ||
32 | #define flush_tlb_one(vaddr) local_flush_tlb_one(vaddr) | ||
33 | |||
34 | #ifndef __ASSEMBLY__ | ||
35 | |||
36 | static inline unsigned long pevn_get(void) | ||
37 | { | ||
38 | unsigned long val; | ||
39 | |||
40 | __asm__ __volatile__( | ||
41 | "mfcr %0, cr11\n" | ||
42 | "nop\nnop\n" | ||
43 | : "=r" (val)); | ||
44 | |||
45 | return val; | ||
46 | } | ||
47 | |||
48 | static inline void pevn_set(unsigned long val) | ||
49 | { | ||
50 | __asm__ __volatile__( | ||
51 | "mtcr %0, cr11\n" | ||
52 | "nop\nnop\nnop\nnop\nnop\n" | ||
53 | : : "r" (val)); | ||
54 | } | ||
55 | |||
56 | static inline void pectx_set(unsigned long val) | ||
57 | { | ||
58 | __asm__ __volatile__( | ||
59 | "mtcr %0, cr12\n" | ||
60 | "nop\nnop\nnop\nnop\nnop\n" | ||
61 | : : "r" (val)); | ||
62 | } | ||
63 | |||
64 | static inline unsigned long pectx_get(void) | ||
65 | { | ||
66 | unsigned long val; | ||
67 | __asm__ __volatile__( | ||
68 | "mfcr %0, cr12\n" | ||
69 | "nop\nnop\n" | ||
70 | : "=r" (val)); | ||
71 | return val; | ||
72 | } | ||
73 | static inline unsigned long tlblock_get(void) | ||
74 | { | ||
75 | unsigned long val; | ||
76 | |||
77 | __asm__ __volatile__( | ||
78 | "mfcr %0, cr7\n" | ||
79 | "nop\nnop\n" | ||
80 | : "=r" (val)); | ||
81 | return val; | ||
82 | } | ||
83 | static inline void tlblock_set(unsigned long val) | ||
84 | { | ||
85 | __asm__ __volatile__( | ||
86 | "mtcr %0, cr7\n" | ||
87 | "nop\nnop\nnop\nnop\nnop\n" | ||
88 | : : "r" (val)); | ||
89 | } | ||
90 | |||
91 | static inline void tlbpt_set(unsigned long val) | ||
92 | { | ||
93 | __asm__ __volatile__( | ||
94 | "mtcr %0, cr8\n" | ||
95 | "nop\nnop\nnop\nnop\nnop\n" | ||
96 | : : "r" (val)); | ||
97 | } | ||
98 | |||
99 | static inline long tlbpt_get(void) | ||
100 | { | ||
101 | long val; | ||
102 | |||
103 | __asm__ __volatile__( | ||
104 | "mfcr %0, cr8\n" | ||
105 | "nop\nnop\n" | ||
106 | : "=r" (val)); | ||
107 | |||
108 | return val; | ||
109 | } | ||
110 | |||
111 | static inline void peaddr_set(unsigned long val) | ||
112 | { | ||
113 | __asm__ __volatile__( | ||
114 | "mtcr %0, cr9\n" | ||
115 | "nop\nnop\nnop\nnop\nnop\n" | ||
116 | : : "r" (val)); | ||
117 | } | ||
118 | |||
119 | /* TLB operations. */ | ||
120 | static inline void tlb_probe(void) | ||
121 | { | ||
122 | __asm__ __volatile__("stlb;nop;nop;nop;nop;nop"); | ||
123 | } | ||
124 | |||
125 | static inline void tlb_read(void) | ||
126 | { | ||
127 | __asm__ __volatile__("mftlb;nop;nop;nop;nop;nop"); | ||
128 | } | ||
129 | |||
130 | static inline void tlb_write_indexed(void) | ||
131 | { | ||
132 | __asm__ __volatile__("mtptlb;nop;nop;nop;nop;nop"); | ||
133 | } | ||
134 | |||
135 | static inline void tlb_write_random(void) | ||
136 | { | ||
137 | __asm__ __volatile__("mtrtlb;nop;nop;nop;nop;nop"); | ||
138 | } | ||
139 | |||
140 | #endif /* Not __ASSEMBLY__ */ | ||
141 | |||
142 | #endif /* _ASM_SCORE_TLBFLUSH_H */ | ||
diff --git a/arch/score/include/asm/topology.h b/arch/score/include/asm/topology.h new file mode 100644 index 000000000000..425fba381f88 --- /dev/null +++ b/arch/score/include/asm/topology.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_TOPOLOGY_H | ||
2 | #define _ASM_SCORE_TOPOLOGY_H | ||
3 | |||
4 | #include <asm-generic/topology.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_TOPOLOGY_H */ | ||
diff --git a/arch/score/include/asm/types.h b/arch/score/include/asm/types.h new file mode 100644 index 000000000000..2140032778ee --- /dev/null +++ b/arch/score/include/asm/types.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_TYPES_H | ||
2 | #define _ASM_SCORE_TYPES_H | ||
3 | |||
4 | #include <asm-generic/types.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_TYPES_H */ | ||
diff --git a/arch/score/include/asm/uaccess.h b/arch/score/include/asm/uaccess.h new file mode 100644 index 000000000000..ab66ddde777b --- /dev/null +++ b/arch/score/include/asm/uaccess.h | |||
@@ -0,0 +1,424 @@ | |||
1 | #ifndef __SCORE_UACCESS_H | ||
2 | #define __SCORE_UACCESS_H | ||
3 | |||
4 | #include <linux/kernel.h> | ||
5 | #include <linux/errno.h> | ||
6 | #include <linux/thread_info.h> | ||
7 | |||
8 | #define VERIFY_READ 0 | ||
9 | #define VERIFY_WRITE 1 | ||
10 | |||
11 | #define get_ds() (KERNEL_DS) | ||
12 | #define get_fs() (current_thread_info()->addr_limit) | ||
13 | #define segment_eq(a, b) ((a).seg == (b).seg) | ||
14 | |||
15 | /* | ||
16 | * Is a address valid? This does a straighforward calculation rather | ||
17 | * than tests. | ||
18 | * | ||
19 | * Address valid if: | ||
20 | * - "addr" doesn't have any high-bits set | ||
21 | * - AND "size" doesn't have any high-bits set | ||
22 | * - AND "addr+size" doesn't have any high-bits set | ||
23 | * - OR we are in kernel mode. | ||
24 | * | ||
25 | * __ua_size() is a trick to avoid runtime checking of positive constant | ||
26 | * sizes; for those we already know at compile time that the size is ok. | ||
27 | */ | ||
28 | #define __ua_size(size) \ | ||
29 | ((__builtin_constant_p(size) && (signed long) (size) > 0) ? 0 : (size)) | ||
30 | |||
31 | /* | ||
32 | * access_ok: - Checks if a user space pointer is valid | ||
33 | * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that | ||
34 | * %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe | ||
35 | * to write to a block, it is always safe to read from it. | ||
36 | * @addr: User space pointer to start of block to check | ||
37 | * @size: Size of block to check | ||
38 | * | ||
39 | * Context: User context only. This function may sleep. | ||
40 | * | ||
41 | * Checks if a pointer to a block of memory in user space is valid. | ||
42 | * | ||
43 | * Returns true (nonzero) if the memory block may be valid, false (zero) | ||
44 | * if it is definitely invalid. | ||
45 | * | ||
46 | * Note that, depending on architecture, this function probably just | ||
47 | * checks that the pointer is in the user space range - after calling | ||
48 | * this function, memory access functions may still return -EFAULT. | ||
49 | */ | ||
50 | |||
51 | #define __access_ok(addr, size) \ | ||
52 | (((long)((get_fs().seg) & \ | ||
53 | ((addr) | ((addr) + (size)) | \ | ||
54 | __ua_size(size)))) == 0) | ||
55 | |||
56 | #define access_ok(type, addr, size) \ | ||
57 | likely(__access_ok((unsigned long)(addr), (size))) | ||
58 | |||
59 | /* | ||
60 | * put_user: - Write a simple value into user space. | ||
61 | * @x: Value to copy to user space. | ||
62 | * @ptr: Destination address, in user space. | ||
63 | * | ||
64 | * Context: User context only. This function may sleep. | ||
65 | * | ||
66 | * This macro copies a single simple value from kernel space to user | ||
67 | * space. It supports simple types like char and int, but not larger | ||
68 | * data types like structures or arrays. | ||
69 | * | ||
70 | * @ptr must have pointer-to-simple-variable type, and @x must be assignable | ||
71 | * to the result of dereferencing @ptr. | ||
72 | * | ||
73 | * Returns zero on success, or -EFAULT on error. | ||
74 | */ | ||
75 | #define put_user(x, ptr) __put_user_check((x), (ptr), sizeof(*(ptr))) | ||
76 | |||
77 | /* | ||
78 | * get_user: - Get a simple variable from user space. | ||
79 | * @x: Variable to store result. | ||
80 | * @ptr: Source address, in user space. | ||
81 | * | ||
82 | * Context: User context only. This function may sleep. | ||
83 | * | ||
84 | * This macro copies a single simple variable from user space to kernel | ||
85 | * space. It supports simple types like char and int, but not larger | ||
86 | * data types like structures or arrays. | ||
87 | * | ||
88 | * @ptr must have pointer-to-simple-variable type, and the result of | ||
89 | * dereferencing @ptr must be assignable to @x without a cast. | ||
90 | * | ||
91 | * Returns zero on success, or -EFAULT on error. | ||
92 | * On error, the variable @x is set to zero. | ||
93 | */ | ||
94 | #define get_user(x, ptr) __get_user_check((x), (ptr), sizeof(*(ptr))) | ||
95 | |||
96 | /* | ||
97 | * __put_user: - Write a simple value into user space, with less checking. | ||
98 | * @x: Value to copy to user space. | ||
99 | * @ptr: Destination address, in user space. | ||
100 | * | ||
101 | * Context: User context only. This function may sleep. | ||
102 | * | ||
103 | * This macro copies a single simple value from kernel space to user | ||
104 | * space. It supports simple types like char and int, but not larger | ||
105 | * data types like structures or arrays. | ||
106 | * | ||
107 | * @ptr must have pointer-to-simple-variable type, and @x must be assignable | ||
108 | * to the result of dereferencing @ptr. | ||
109 | * | ||
110 | * Caller must check the pointer with access_ok() before calling this | ||
111 | * function. | ||
112 | * | ||
113 | * Returns zero on success, or -EFAULT on error. | ||
114 | */ | ||
115 | #define __put_user(x, ptr) __put_user_nocheck((x), (ptr), sizeof(*(ptr))) | ||
116 | |||
117 | /* | ||
118 | * __get_user: - Get a simple variable from user space, with less checking. | ||
119 | * @x: Variable to store result. | ||
120 | * @ptr: Source address, in user space. | ||
121 | * | ||
122 | * Context: User context only. This function may sleep. | ||
123 | * | ||
124 | * This macro copies a single simple variable from user space to kernel | ||
125 | * space. It supports simple types like char and int, but not larger | ||
126 | * data types like structures or arrays. | ||
127 | * | ||
128 | * @ptr must have pointer-to-simple-variable type, and the result of | ||
129 | * dereferencing @ptr must be assignable to @x without a cast. | ||
130 | * | ||
131 | * Caller must check the pointer with access_ok() before calling this | ||
132 | * function. | ||
133 | * | ||
134 | * Returns zero on success, or -EFAULT on error. | ||
135 | * On error, the variable @x is set to zero. | ||
136 | */ | ||
137 | #define __get_user(x, ptr) __get_user_nocheck((x), (ptr), sizeof(*(ptr))) | ||
138 | |||
139 | struct __large_struct { unsigned long buf[100]; }; | ||
140 | #define __m(x) (*(struct __large_struct __user *)(x)) | ||
141 | |||
142 | /* | ||
143 | * Yuck. We need two variants, one for 64bit operation and one | ||
144 | * for 32 bit mode and old iron. | ||
145 | */ | ||
146 | extern void __get_user_unknown(void); | ||
147 | |||
148 | #define __get_user_common(val, size, ptr) \ | ||
149 | do { \ | ||
150 | switch (size) { \ | ||
151 | case 1: \ | ||
152 | __get_user_asm(val, "lb", ptr); \ | ||
153 | break; \ | ||
154 | case 2: \ | ||
155 | __get_user_asm(val, "lh", ptr); \ | ||
156 | break; \ | ||
157 | case 4: \ | ||
158 | __get_user_asm(val, "lw", ptr); \ | ||
159 | break; \ | ||
160 | case 8: \ | ||
161 | if ((copy_from_user((void *)&val, ptr, 8)) == 0) \ | ||
162 | __gu_err = 0; \ | ||
163 | else \ | ||
164 | __gu_err = -EFAULT; \ | ||
165 | break; \ | ||
166 | default: \ | ||
167 | __get_user_unknown(); \ | ||
168 | break; \ | ||
169 | } \ | ||
170 | } while (0) | ||
171 | |||
172 | #define __get_user_nocheck(x, ptr, size) \ | ||
173 | ({ \ | ||
174 | long __gu_err = 0; \ | ||
175 | __get_user_common((x), size, ptr); \ | ||
176 | __gu_err; \ | ||
177 | }) | ||
178 | |||
179 | #define __get_user_check(x, ptr, size) \ | ||
180 | ({ \ | ||
181 | long __gu_err = -EFAULT; \ | ||
182 | const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ | ||
183 | \ | ||
184 | if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \ | ||
185 | __get_user_common((x), size, __gu_ptr); \ | ||
186 | \ | ||
187 | __gu_err; \ | ||
188 | }) | ||
189 | |||
190 | #define __get_user_asm(val, insn, addr) \ | ||
191 | { \ | ||
192 | long __gu_tmp; \ | ||
193 | \ | ||
194 | __asm__ __volatile__( \ | ||
195 | "1:" insn " %1, %3\n" \ | ||
196 | "2:\n" \ | ||
197 | ".section .fixup,\"ax\"\n" \ | ||
198 | "3:li %0, %4\n" \ | ||
199 | "j 2b\n" \ | ||
200 | ".previous\n" \ | ||
201 | ".section __ex_table,\"a\"\n" \ | ||
202 | ".word 1b, 3b\n" \ | ||
203 | ".previous\n" \ | ||
204 | : "=r" (__gu_err), "=r" (__gu_tmp) \ | ||
205 | : "0" (0), "o" (__m(addr)), "i" (-EFAULT)); \ | ||
206 | \ | ||
207 | (val) = (__typeof__(*(addr))) __gu_tmp; \ | ||
208 | } | ||
209 | |||
210 | /* | ||
211 | * Yuck. We need two variants, one for 64bit operation and one | ||
212 | * for 32 bit mode and old iron. | ||
213 | */ | ||
214 | #define __put_user_nocheck(val, ptr, size) \ | ||
215 | ({ \ | ||
216 | __typeof__(*(ptr)) __pu_val; \ | ||
217 | long __pu_err = 0; \ | ||
218 | \ | ||
219 | __pu_val = (val); \ | ||
220 | switch (size) { \ | ||
221 | case 1: \ | ||
222 | __put_user_asm("sb", ptr); \ | ||
223 | break; \ | ||
224 | case 2: \ | ||
225 | __put_user_asm("sh", ptr); \ | ||
226 | break; \ | ||
227 | case 4: \ | ||
228 | __put_user_asm("sw", ptr); \ | ||
229 | break; \ | ||
230 | case 8: \ | ||
231 | if ((__copy_to_user((void *)ptr, &__pu_val, 8)) == 0) \ | ||
232 | __pu_err = 0; \ | ||
233 | else \ | ||
234 | __pu_err = -EFAULT; \ | ||
235 | break; \ | ||
236 | default: \ | ||
237 | __put_user_unknown(); \ | ||
238 | break; \ | ||
239 | } \ | ||
240 | __pu_err; \ | ||
241 | }) | ||
242 | |||
243 | |||
244 | #define __put_user_check(val, ptr, size) \ | ||
245 | ({ \ | ||
246 | __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ | ||
247 | __typeof__(*(ptr)) __pu_val = (val); \ | ||
248 | long __pu_err = -EFAULT; \ | ||
249 | \ | ||
250 | if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) { \ | ||
251 | switch (size) { \ | ||
252 | case 1: \ | ||
253 | __put_user_asm("sb", __pu_addr); \ | ||
254 | break; \ | ||
255 | case 2: \ | ||
256 | __put_user_asm("sh", __pu_addr); \ | ||
257 | break; \ | ||
258 | case 4: \ | ||
259 | __put_user_asm("sw", __pu_addr); \ | ||
260 | break; \ | ||
261 | case 8: \ | ||
262 | if ((__copy_to_user((void *)__pu_addr, &__pu_val, 8)) == 0)\ | ||
263 | __pu_err = 0; \ | ||
264 | else \ | ||
265 | __pu_err = -EFAULT; \ | ||
266 | break; \ | ||
267 | default: \ | ||
268 | __put_user_unknown(); \ | ||
269 | break; \ | ||
270 | } \ | ||
271 | } \ | ||
272 | __pu_err; \ | ||
273 | }) | ||
274 | |||
275 | #define __put_user_asm(insn, ptr) \ | ||
276 | __asm__ __volatile__( \ | ||
277 | "1:" insn " %2, %3\n" \ | ||
278 | "2:\n" \ | ||
279 | ".section .fixup,\"ax\"\n" \ | ||
280 | "3:li %0, %4\n" \ | ||
281 | "j 2b\n" \ | ||
282 | ".previous\n" \ | ||
283 | ".section __ex_table,\"a\"\n" \ | ||
284 | ".word 1b, 3b\n" \ | ||
285 | ".previous\n" \ | ||
286 | : "=r" (__pu_err) \ | ||
287 | : "0" (0), "r" (__pu_val), "o" (__m(ptr)), \ | ||
288 | "i" (-EFAULT)); | ||
289 | |||
290 | extern void __put_user_unknown(void); | ||
291 | extern int __copy_tofrom_user(void *to, const void *from, unsigned long len); | ||
292 | |||
293 | static inline unsigned long | ||
294 | copy_from_user(void *to, const void *from, unsigned long len) | ||
295 | { | ||
296 | unsigned long over; | ||
297 | |||
298 | if (access_ok(VERIFY_READ, from, len)) | ||
299 | return __copy_tofrom_user(to, from, len); | ||
300 | |||
301 | if ((unsigned long)from < TASK_SIZE) { | ||
302 | over = (unsigned long)from + len - TASK_SIZE; | ||
303 | return __copy_tofrom_user(to, from, len - over) + over; | ||
304 | } | ||
305 | return len; | ||
306 | } | ||
307 | |||
308 | static inline unsigned long | ||
309 | copy_to_user(void *to, const void *from, unsigned long len) | ||
310 | { | ||
311 | unsigned long over; | ||
312 | |||
313 | if (access_ok(VERIFY_WRITE, to, len)) | ||
314 | return __copy_tofrom_user(to, from, len); | ||
315 | |||
316 | if ((unsigned long)to < TASK_SIZE) { | ||
317 | over = (unsigned long)to + len - TASK_SIZE; | ||
318 | return __copy_tofrom_user(to, from, len - over) + over; | ||
319 | } | ||
320 | return len; | ||
321 | } | ||
322 | |||
323 | #define __copy_from_user(to, from, len) \ | ||
324 | __copy_tofrom_user((to), (from), (len)) | ||
325 | |||
326 | #define __copy_to_user(to, from, len) \ | ||
327 | __copy_tofrom_user((to), (from), (len)) | ||
328 | |||
329 | static inline unsigned long | ||
330 | __copy_to_user_inatomic(void *to, const void *from, unsigned long len) | ||
331 | { | ||
332 | return __copy_to_user(to, from, len); | ||
333 | } | ||
334 | |||
335 | static inline unsigned long | ||
336 | __copy_from_user_inatomic(void *to, const void *from, unsigned long len) | ||
337 | { | ||
338 | return __copy_from_user(to, from, len); | ||
339 | } | ||
340 | |||
341 | #define __copy_in_user(to, from, len) __copy_from_user(to, from, len) | ||
342 | |||
343 | static inline unsigned long | ||
344 | copy_in_user(void *to, const void *from, unsigned long len) | ||
345 | { | ||
346 | if (access_ok(VERIFY_READ, from, len) && | ||
347 | access_ok(VERFITY_WRITE, to, len)) | ||
348 | return copy_from_user(to, from, len); | ||
349 | } | ||
350 | |||
351 | /* | ||
352 | * __clear_user: - Zero a block of memory in user space, with less checking. | ||
353 | * @to: Destination address, in user space. | ||
354 | * @n: Number of bytes to zero. | ||
355 | * | ||
356 | * Zero a block of memory in user space. Caller must check | ||
357 | * the specified block with access_ok() before calling this function. | ||
358 | * | ||
359 | * Returns number of bytes that could not be cleared. | ||
360 | * On success, this will be zero. | ||
361 | */ | ||
362 | extern unsigned long __clear_user(void __user *src, unsigned long size); | ||
363 | |||
364 | static inline unsigned long clear_user(char *src, unsigned long size) | ||
365 | { | ||
366 | if (access_ok(VERIFY_WRITE, src, size)) | ||
367 | return __clear_user(src, size); | ||
368 | |||
369 | return -EFAULT; | ||
370 | } | ||
371 | /* | ||
372 | * __strncpy_from_user: - Copy a NUL terminated string from userspace, with less checking. | ||
373 | * @dst: Destination address, in kernel space. This buffer must be at | ||
374 | * least @count bytes long. | ||
375 | * @src: Source address, in user space. | ||
376 | * @count: Maximum number of bytes to copy, including the trailing NUL. | ||
377 | * | ||
378 | * Copies a NUL-terminated string from userspace to kernel space. | ||
379 | * Caller must check the specified block with access_ok() before calling | ||
380 | * this function. | ||
381 | * | ||
382 | * On success, returns the length of the string (not including the trailing | ||
383 | * NUL). | ||
384 | * | ||
385 | * If access to userspace fails, returns -EFAULT (some data may have been | ||
386 | * copied). | ||
387 | * | ||
388 | * If @count is smaller than the length of the string, copies @count bytes | ||
389 | * and returns @count. | ||
390 | */ | ||
391 | extern int __strncpy_from_user(char *dst, const char *src, long len); | ||
392 | |||
393 | static inline int strncpy_from_user(char *dst, const char *src, long len) | ||
394 | { | ||
395 | if (access_ok(VERIFY_READ, src, 1)) | ||
396 | return __strncpy_from_user(dst, src, len); | ||
397 | |||
398 | return -EFAULT; | ||
399 | } | ||
400 | |||
401 | extern int __strlen_user(const char *src); | ||
402 | static inline long strlen_user(const char __user *src) | ||
403 | { | ||
404 | return __strlen_user(src); | ||
405 | } | ||
406 | |||
407 | extern int __strnlen_user(const char *str, long len); | ||
408 | static inline long strnlen_user(const char __user *str, long len) | ||
409 | { | ||
410 | if (!access_ok(VERIFY_READ, str, 0)) | ||
411 | return 0; | ||
412 | else | ||
413 | return __strnlen_user(str, len); | ||
414 | } | ||
415 | |||
416 | struct exception_table_entry { | ||
417 | unsigned long insn; | ||
418 | unsigned long fixup; | ||
419 | }; | ||
420 | |||
421 | extern int fixup_exception(struct pt_regs *regs); | ||
422 | |||
423 | #endif /* __SCORE_UACCESS_H */ | ||
424 | |||
diff --git a/arch/score/include/asm/ucontext.h b/arch/score/include/asm/ucontext.h new file mode 100644 index 000000000000..9bc07b9f30fb --- /dev/null +++ b/arch/score/include/asm/ucontext.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/ucontext.h> | |||
diff --git a/arch/score/include/asm/unaligned.h b/arch/score/include/asm/unaligned.h new file mode 100644 index 000000000000..2fc06de51c62 --- /dev/null +++ b/arch/score/include/asm/unaligned.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_UNALIGNED_H | ||
2 | #define _ASM_SCORE_UNALIGNED_H | ||
3 | |||
4 | #include <asm-generic/unaligned.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_UNALIGNED_H */ | ||
diff --git a/arch/score/include/asm/unistd.h b/arch/score/include/asm/unistd.h new file mode 100644 index 000000000000..4aa957364d4d --- /dev/null +++ b/arch/score/include/asm/unistd.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #if !defined(_ASM_SCORE_UNISTD_H) || defined(__SYSCALL) | ||
2 | #define _ASM_SCORE_UNISTD_H | ||
3 | |||
4 | #define __ARCH_HAVE_MMU | ||
5 | |||
6 | #define __ARCH_WANT_SYSCALL_NO_AT | ||
7 | #define __ARCH_WANT_SYSCALL_NO_FLAGS | ||
8 | #define __ARCH_WANT_SYSCALL_OFF_T | ||
9 | #define __ARCH_WANT_SYSCALL_DEPRECATED | ||
10 | |||
11 | #include <asm-generic/unistd.h> | ||
12 | |||
13 | #endif /* _ASM_SCORE_UNISTD_H */ | ||
diff --git a/arch/score/include/asm/user.h b/arch/score/include/asm/user.h new file mode 100644 index 000000000000..7bfb8e2c8054 --- /dev/null +++ b/arch/score/include/asm/user.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef _ASM_SCORE_USER_H | ||
2 | #define _ASM_SCORE_USER_H | ||
3 | |||
4 | struct user_regs_struct { | ||
5 | unsigned long regs[32]; | ||
6 | |||
7 | unsigned long cel; | ||
8 | unsigned long ceh; | ||
9 | |||
10 | unsigned long sr0; /* cnt */ | ||
11 | unsigned long sr1; /* lcr */ | ||
12 | unsigned long sr2; /* scr */ | ||
13 | |||
14 | unsigned long cp0_epc; | ||
15 | unsigned long cp0_ema; | ||
16 | unsigned long cp0_psr; | ||
17 | unsigned long cp0_ecr; | ||
18 | unsigned long cp0_condition; | ||
19 | }; | ||
20 | |||
21 | #endif /* _ASM_SCORE_USER_H */ | ||