diff options
Diffstat (limited to 'arch/sparc64/kernel')
-rw-r--r-- | arch/sparc64/kernel/head.S | 7 | ||||
-rw-r--r-- | arch/sparc64/kernel/ptrace.c | 14 | ||||
-rw-r--r-- | arch/sparc64/kernel/setup.c | 21 | ||||
-rw-r--r-- | arch/sparc64/kernel/sys32.S | 170 | ||||
-rw-r--r-- | arch/sparc64/kernel/traps.c | 60 | ||||
-rw-r--r-- | arch/sparc64/kernel/una_asm.S | 65 | ||||
-rw-r--r-- | arch/sparc64/kernel/unaligned.c | 45 |
7 files changed, 187 insertions, 195 deletions
diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S index ecc748fb9ad7..89406f9649a9 100644 --- a/arch/sparc64/kernel/head.S +++ b/arch/sparc64/kernel/head.S | |||
@@ -540,8 +540,11 @@ bootup_user_stack_end: | |||
540 | prom_tba: .xword 0 | 540 | prom_tba: .xword 0 |
541 | tlb_type: .word 0 /* Must NOT end up in BSS */ | 541 | tlb_type: .word 0 /* Must NOT end up in BSS */ |
542 | .section ".fixup",#alloc,#execinstr | 542 | .section ".fixup",#alloc,#execinstr |
543 | .globl __ret_efault | 543 | |
544 | .globl __ret_efault, __retl_efault | ||
544 | __ret_efault: | 545 | __ret_efault: |
545 | ret | 546 | ret |
546 | restore %g0, -EFAULT, %o0 | 547 | restore %g0, -EFAULT, %o0 |
547 | 548 | __retl_efault: | |
549 | retl | ||
550 | mov -EFAULT, %o0 | ||
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c index 5efbff90d668..774ecbb8a031 100644 --- a/arch/sparc64/kernel/ptrace.c +++ b/arch/sparc64/kernel/ptrace.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <asm/visasm.h> | 31 | #include <asm/visasm.h> |
32 | #include <asm/spitfire.h> | 32 | #include <asm/spitfire.h> |
33 | #include <asm/page.h> | 33 | #include <asm/page.h> |
34 | #include <asm/cpudata.h> | ||
34 | 35 | ||
35 | /* Returning from ptrace is a bit tricky because the syscall return | 36 | /* Returning from ptrace is a bit tricky because the syscall return |
36 | * low level code assumes any value returned which is negative and | 37 | * low level code assumes any value returned which is negative and |
@@ -132,12 +133,16 @@ void flush_ptrace_access(struct vm_area_struct *vma, struct page *page, | |||
132 | if ((uaddr ^ (unsigned long) kaddr) & (1UL << 13)) { | 133 | if ((uaddr ^ (unsigned long) kaddr) & (1UL << 13)) { |
133 | unsigned long start = __pa(kaddr); | 134 | unsigned long start = __pa(kaddr); |
134 | unsigned long end = start + len; | 135 | unsigned long end = start + len; |
136 | unsigned long dcache_line_size; | ||
137 | |||
138 | dcache_line_size = local_cpu_data().dcache_line_size; | ||
135 | 139 | ||
136 | if (tlb_type == spitfire) { | 140 | if (tlb_type == spitfire) { |
137 | for (; start < end; start += 32) | 141 | for (; start < end; start += dcache_line_size) |
138 | spitfire_put_dcache_tag(start & 0x3fe0, 0x0); | 142 | spitfire_put_dcache_tag(start & 0x3fe0, 0x0); |
139 | } else { | 143 | } else { |
140 | for (; start < end; start += 32) | 144 | start &= ~(dcache_line_size - 1); |
145 | for (; start < end; start += dcache_line_size) | ||
141 | __asm__ __volatile__( | 146 | __asm__ __volatile__( |
142 | "stxa %%g0, [%0] %1\n\t" | 147 | "stxa %%g0, [%0] %1\n\t" |
143 | "membar #Sync" | 148 | "membar #Sync" |
@@ -150,8 +155,11 @@ void flush_ptrace_access(struct vm_area_struct *vma, struct page *page, | |||
150 | if (write && tlb_type == spitfire) { | 155 | if (write && tlb_type == spitfire) { |
151 | unsigned long start = (unsigned long) kaddr; | 156 | unsigned long start = (unsigned long) kaddr; |
152 | unsigned long end = start + len; | 157 | unsigned long end = start + len; |
158 | unsigned long icache_line_size; | ||
159 | |||
160 | icache_line_size = local_cpu_data().icache_line_size; | ||
153 | 161 | ||
154 | for (; start < end; start += 32) | 162 | for (; start < end; start += icache_line_size) |
155 | flushi(start); | 163 | flushi(start); |
156 | } | 164 | } |
157 | } | 165 | } |
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c index 8e8baf2354df..4c9c8f241748 100644 --- a/arch/sparc64/kernel/setup.c +++ b/arch/sparc64/kernel/setup.c | |||
@@ -464,8 +464,6 @@ static void __init boot_flags_init(char *commands) | |||
464 | } | 464 | } |
465 | } | 465 | } |
466 | 466 | ||
467 | extern int prom_probe_memory(void); | ||
468 | extern unsigned long start, end; | ||
469 | extern void panic_setup(char *, int *); | 467 | extern void panic_setup(char *, int *); |
470 | 468 | ||
471 | extern unsigned short root_flags; | 469 | extern unsigned short root_flags; |
@@ -492,12 +490,8 @@ void register_prom_callbacks(void) | |||
492 | "' linux-.soft2 to .soft2"); | 490 | "' linux-.soft2 to .soft2"); |
493 | } | 491 | } |
494 | 492 | ||
495 | extern void paging_init(void); | ||
496 | |||
497 | void __init setup_arch(char **cmdline_p) | 493 | void __init setup_arch(char **cmdline_p) |
498 | { | 494 | { |
499 | int i; | ||
500 | |||
501 | /* Initialize PROM console and command line. */ | 495 | /* Initialize PROM console and command line. */ |
502 | *cmdline_p = prom_getbootargs(); | 496 | *cmdline_p = prom_getbootargs(); |
503 | strcpy(saved_command_line, *cmdline_p); | 497 | strcpy(saved_command_line, *cmdline_p); |
@@ -516,21 +510,6 @@ void __init setup_arch(char **cmdline_p) | |||
516 | boot_flags_init(*cmdline_p); | 510 | boot_flags_init(*cmdline_p); |
517 | 511 | ||
518 | idprom_init(); | 512 | idprom_init(); |
519 | (void) prom_probe_memory(); | ||
520 | |||
521 | phys_base = 0xffffffffffffffffUL; | ||
522 | for (i = 0; sp_banks[i].num_bytes != 0; i++) { | ||
523 | unsigned long top; | ||
524 | |||
525 | if (sp_banks[i].base_addr < phys_base) | ||
526 | phys_base = sp_banks[i].base_addr; | ||
527 | top = sp_banks[i].base_addr + | ||
528 | sp_banks[i].num_bytes; | ||
529 | } | ||
530 | pfn_base = phys_base >> PAGE_SHIFT; | ||
531 | |||
532 | kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL; | ||
533 | kern_size = (unsigned long)&_end - (unsigned long)KERNBASE; | ||
534 | 513 | ||
535 | if (!root_flags) | 514 | if (!root_flags) |
536 | root_mountflags &= ~MS_RDONLY; | 515 | root_mountflags &= ~MS_RDONLY; |
diff --git a/arch/sparc64/kernel/sys32.S b/arch/sparc64/kernel/sys32.S index 5f9e4fae612e..9cd272ac3ac1 100644 --- a/arch/sparc64/kernel/sys32.S +++ b/arch/sparc64/kernel/sys32.S | |||
@@ -157,173 +157,199 @@ sys32_socketcall: /* %o0=call, %o1=args */ | |||
157 | or %g2, %lo(__socketcall_table_begin), %g2 | 157 | or %g2, %lo(__socketcall_table_begin), %g2 |
158 | jmpl %g2 + %o0, %g0 | 158 | jmpl %g2 + %o0, %g0 |
159 | nop | 159 | nop |
160 | do_einval: | ||
161 | retl | ||
162 | mov -EINVAL, %o0 | ||
160 | 163 | ||
161 | /* Each entry is exactly 32 bytes. */ | ||
162 | .align 32 | 164 | .align 32 |
163 | __socketcall_table_begin: | 165 | __socketcall_table_begin: |
166 | |||
167 | /* Each entry is exactly 32 bytes. */ | ||
164 | do_sys_socket: /* sys_socket(int, int, int) */ | 168 | do_sys_socket: /* sys_socket(int, int, int) */ |
165 | ldswa [%o1 + 0x0] %asi, %o0 | 169 | 1: ldswa [%o1 + 0x0] %asi, %o0 |
166 | sethi %hi(sys_socket), %g1 | 170 | sethi %hi(sys_socket), %g1 |
167 | ldswa [%o1 + 0x8] %asi, %o2 | 171 | 2: ldswa [%o1 + 0x8] %asi, %o2 |
168 | jmpl %g1 + %lo(sys_socket), %g0 | 172 | jmpl %g1 + %lo(sys_socket), %g0 |
169 | ldswa [%o1 + 0x4] %asi, %o1 | 173 | 3: ldswa [%o1 + 0x4] %asi, %o1 |
170 | nop | 174 | nop |
171 | nop | 175 | nop |
172 | nop | 176 | nop |
173 | do_sys_bind: /* sys_bind(int fd, struct sockaddr *, int) */ | 177 | do_sys_bind: /* sys_bind(int fd, struct sockaddr *, int) */ |
174 | ldswa [%o1 + 0x0] %asi, %o0 | 178 | 4: ldswa [%o1 + 0x0] %asi, %o0 |
175 | sethi %hi(sys_bind), %g1 | 179 | sethi %hi(sys_bind), %g1 |
176 | ldswa [%o1 + 0x8] %asi, %o2 | 180 | 5: ldswa [%o1 + 0x8] %asi, %o2 |
177 | jmpl %g1 + %lo(sys_bind), %g0 | 181 | jmpl %g1 + %lo(sys_bind), %g0 |
178 | lduwa [%o1 + 0x4] %asi, %o1 | 182 | 6: lduwa [%o1 + 0x4] %asi, %o1 |
179 | nop | 183 | nop |
180 | nop | 184 | nop |
181 | nop | 185 | nop |
182 | do_sys_connect: /* sys_connect(int, struct sockaddr *, int) */ | 186 | do_sys_connect: /* sys_connect(int, struct sockaddr *, int) */ |
183 | ldswa [%o1 + 0x0] %asi, %o0 | 187 | 7: ldswa [%o1 + 0x0] %asi, %o0 |
184 | sethi %hi(sys_connect), %g1 | 188 | sethi %hi(sys_connect), %g1 |
185 | ldswa [%o1 + 0x8] %asi, %o2 | 189 | 8: ldswa [%o1 + 0x8] %asi, %o2 |
186 | jmpl %g1 + %lo(sys_connect), %g0 | 190 | jmpl %g1 + %lo(sys_connect), %g0 |
187 | lduwa [%o1 + 0x4] %asi, %o1 | 191 | 9: lduwa [%o1 + 0x4] %asi, %o1 |
188 | nop | 192 | nop |
189 | nop | 193 | nop |
190 | nop | 194 | nop |
191 | do_sys_listen: /* sys_listen(int, int) */ | 195 | do_sys_listen: /* sys_listen(int, int) */ |
192 | ldswa [%o1 + 0x0] %asi, %o0 | 196 | 10: ldswa [%o1 + 0x0] %asi, %o0 |
193 | sethi %hi(sys_listen), %g1 | 197 | sethi %hi(sys_listen), %g1 |
194 | jmpl %g1 + %lo(sys_listen), %g0 | 198 | jmpl %g1 + %lo(sys_listen), %g0 |
195 | ldswa [%o1 + 0x4] %asi, %o1 | 199 | 11: ldswa [%o1 + 0x4] %asi, %o1 |
196 | nop | 200 | nop |
197 | nop | 201 | nop |
198 | nop | 202 | nop |
199 | nop | 203 | nop |
200 | do_sys_accept: /* sys_accept(int, struct sockaddr *, int *) */ | 204 | do_sys_accept: /* sys_accept(int, struct sockaddr *, int *) */ |
201 | ldswa [%o1 + 0x0] %asi, %o0 | 205 | 12: ldswa [%o1 + 0x0] %asi, %o0 |
202 | sethi %hi(sys_accept), %g1 | 206 | sethi %hi(sys_accept), %g1 |
203 | lduwa [%o1 + 0x8] %asi, %o2 | 207 | 13: lduwa [%o1 + 0x8] %asi, %o2 |
204 | jmpl %g1 + %lo(sys_accept), %g0 | 208 | jmpl %g1 + %lo(sys_accept), %g0 |
205 | lduwa [%o1 + 0x4] %asi, %o1 | 209 | 14: lduwa [%o1 + 0x4] %asi, %o1 |
206 | nop | 210 | nop |
207 | nop | 211 | nop |
208 | nop | 212 | nop |
209 | do_sys_getsockname: /* sys_getsockname(int, struct sockaddr *, int *) */ | 213 | do_sys_getsockname: /* sys_getsockname(int, struct sockaddr *, int *) */ |
210 | ldswa [%o1 + 0x0] %asi, %o0 | 214 | 15: ldswa [%o1 + 0x0] %asi, %o0 |
211 | sethi %hi(sys_getsockname), %g1 | 215 | sethi %hi(sys_getsockname), %g1 |
212 | lduwa [%o1 + 0x8] %asi, %o2 | 216 | 16: lduwa [%o1 + 0x8] %asi, %o2 |
213 | jmpl %g1 + %lo(sys_getsockname), %g0 | 217 | jmpl %g1 + %lo(sys_getsockname), %g0 |
214 | lduwa [%o1 + 0x4] %asi, %o1 | 218 | 17: lduwa [%o1 + 0x4] %asi, %o1 |
215 | nop | 219 | nop |
216 | nop | 220 | nop |
217 | nop | 221 | nop |
218 | do_sys_getpeername: /* sys_getpeername(int, struct sockaddr *, int *) */ | 222 | do_sys_getpeername: /* sys_getpeername(int, struct sockaddr *, int *) */ |
219 | ldswa [%o1 + 0x0] %asi, %o0 | 223 | 18: ldswa [%o1 + 0x0] %asi, %o0 |
220 | sethi %hi(sys_getpeername), %g1 | 224 | sethi %hi(sys_getpeername), %g1 |
221 | lduwa [%o1 + 0x8] %asi, %o2 | 225 | 19: lduwa [%o1 + 0x8] %asi, %o2 |
222 | jmpl %g1 + %lo(sys_getpeername), %g0 | 226 | jmpl %g1 + %lo(sys_getpeername), %g0 |
223 | lduwa [%o1 + 0x4] %asi, %o1 | 227 | 20: lduwa [%o1 + 0x4] %asi, %o1 |
224 | nop | 228 | nop |
225 | nop | 229 | nop |
226 | nop | 230 | nop |
227 | do_sys_socketpair: /* sys_socketpair(int, int, int, int *) */ | 231 | do_sys_socketpair: /* sys_socketpair(int, int, int, int *) */ |
228 | ldswa [%o1 + 0x0] %asi, %o0 | 232 | 21: ldswa [%o1 + 0x0] %asi, %o0 |
229 | sethi %hi(sys_socketpair), %g1 | 233 | sethi %hi(sys_socketpair), %g1 |
230 | ldswa [%o1 + 0x8] %asi, %o2 | 234 | 22: ldswa [%o1 + 0x8] %asi, %o2 |
231 | lduwa [%o1 + 0xc] %asi, %o3 | 235 | 23: lduwa [%o1 + 0xc] %asi, %o3 |
232 | jmpl %g1 + %lo(sys_socketpair), %g0 | 236 | jmpl %g1 + %lo(sys_socketpair), %g0 |
233 | ldswa [%o1 + 0x4] %asi, %o1 | 237 | 24: ldswa [%o1 + 0x4] %asi, %o1 |
234 | nop | 238 | nop |
235 | nop | 239 | nop |
236 | do_sys_send: /* sys_send(int, void *, size_t, unsigned int) */ | 240 | do_sys_send: /* sys_send(int, void *, size_t, unsigned int) */ |
237 | ldswa [%o1 + 0x0] %asi, %o0 | 241 | 25: ldswa [%o1 + 0x0] %asi, %o0 |
238 | sethi %hi(sys_send), %g1 | 242 | sethi %hi(sys_send), %g1 |
239 | lduwa [%o1 + 0x8] %asi, %o2 | 243 | 26: lduwa [%o1 + 0x8] %asi, %o2 |
240 | lduwa [%o1 + 0xc] %asi, %o3 | 244 | 27: lduwa [%o1 + 0xc] %asi, %o3 |
241 | jmpl %g1 + %lo(sys_send), %g0 | 245 | jmpl %g1 + %lo(sys_send), %g0 |
242 | lduwa [%o1 + 0x4] %asi, %o1 | 246 | 28: lduwa [%o1 + 0x4] %asi, %o1 |
243 | nop | 247 | nop |
244 | nop | 248 | nop |
245 | do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */ | 249 | do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */ |
246 | ldswa [%o1 + 0x0] %asi, %o0 | 250 | 29: ldswa [%o1 + 0x0] %asi, %o0 |
247 | sethi %hi(sys_recv), %g1 | 251 | sethi %hi(sys_recv), %g1 |
248 | lduwa [%o1 + 0x8] %asi, %o2 | 252 | 30: lduwa [%o1 + 0x8] %asi, %o2 |
249 | lduwa [%o1 + 0xc] %asi, %o3 | 253 | 31: lduwa [%o1 + 0xc] %asi, %o3 |
250 | jmpl %g1 + %lo(sys_recv), %g0 | 254 | jmpl %g1 + %lo(sys_recv), %g0 |
251 | lduwa [%o1 + 0x4] %asi, %o1 | 255 | 32: lduwa [%o1 + 0x4] %asi, %o1 |
252 | nop | 256 | nop |
253 | nop | 257 | nop |
254 | do_sys_sendto: /* sys_sendto(int, u32, compat_size_t, unsigned int, u32, int) */ | 258 | do_sys_sendto: /* sys_sendto(int, u32, compat_size_t, unsigned int, u32, int) */ |
255 | ldswa [%o1 + 0x0] %asi, %o0 | 259 | 33: ldswa [%o1 + 0x0] %asi, %o0 |
256 | sethi %hi(sys_sendto), %g1 | 260 | sethi %hi(sys_sendto), %g1 |
257 | lduwa [%o1 + 0x8] %asi, %o2 | 261 | 34: lduwa [%o1 + 0x8] %asi, %o2 |
258 | lduwa [%o1 + 0xc] %asi, %o3 | 262 | 35: lduwa [%o1 + 0xc] %asi, %o3 |
259 | lduwa [%o1 + 0x10] %asi, %o4 | 263 | 36: lduwa [%o1 + 0x10] %asi, %o4 |
260 | ldswa [%o1 + 0x14] %asi, %o5 | 264 | 37: ldswa [%o1 + 0x14] %asi, %o5 |
261 | jmpl %g1 + %lo(sys_sendto), %g0 | 265 | jmpl %g1 + %lo(sys_sendto), %g0 |
262 | lduwa [%o1 + 0x4] %asi, %o1 | 266 | 38: lduwa [%o1 + 0x4] %asi, %o1 |
263 | do_sys_recvfrom: /* sys_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */ | 267 | do_sys_recvfrom: /* sys_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */ |
264 | ldswa [%o1 + 0x0] %asi, %o0 | 268 | 39: ldswa [%o1 + 0x0] %asi, %o0 |
265 | sethi %hi(sys_recvfrom), %g1 | 269 | sethi %hi(sys_recvfrom), %g1 |
266 | lduwa [%o1 + 0x8] %asi, %o2 | 270 | 40: lduwa [%o1 + 0x8] %asi, %o2 |
267 | lduwa [%o1 + 0xc] %asi, %o3 | 271 | 41: lduwa [%o1 + 0xc] %asi, %o3 |
268 | lduwa [%o1 + 0x10] %asi, %o4 | 272 | 42: lduwa [%o1 + 0x10] %asi, %o4 |
269 | lduwa [%o1 + 0x14] %asi, %o5 | 273 | 43: lduwa [%o1 + 0x14] %asi, %o5 |
270 | jmpl %g1 + %lo(sys_recvfrom), %g0 | 274 | jmpl %g1 + %lo(sys_recvfrom), %g0 |
271 | lduwa [%o1 + 0x4] %asi, %o1 | 275 | 44: lduwa [%o1 + 0x4] %asi, %o1 |
272 | do_sys_shutdown: /* sys_shutdown(int, int) */ | 276 | do_sys_shutdown: /* sys_shutdown(int, int) */ |
273 | ldswa [%o1 + 0x0] %asi, %o0 | 277 | 45: ldswa [%o1 + 0x0] %asi, %o0 |
274 | sethi %hi(sys_shutdown), %g1 | 278 | sethi %hi(sys_shutdown), %g1 |
275 | jmpl %g1 + %lo(sys_shutdown), %g0 | 279 | jmpl %g1 + %lo(sys_shutdown), %g0 |
276 | ldswa [%o1 + 0x4] %asi, %o1 | 280 | 46: ldswa [%o1 + 0x4] %asi, %o1 |
277 | nop | 281 | nop |
278 | nop | 282 | nop |
279 | nop | 283 | nop |
280 | nop | 284 | nop |
281 | do_sys_setsockopt: /* compat_sys_setsockopt(int, int, int, char *, int) */ | 285 | do_sys_setsockopt: /* compat_sys_setsockopt(int, int, int, char *, int) */ |
282 | ldswa [%o1 + 0x0] %asi, %o0 | 286 | 47: ldswa [%o1 + 0x0] %asi, %o0 |
283 | sethi %hi(compat_sys_setsockopt), %g1 | 287 | sethi %hi(compat_sys_setsockopt), %g1 |
284 | ldswa [%o1 + 0x8] %asi, %o2 | 288 | 48: ldswa [%o1 + 0x8] %asi, %o2 |
285 | lduwa [%o1 + 0xc] %asi, %o3 | 289 | 49: lduwa [%o1 + 0xc] %asi, %o3 |
286 | ldswa [%o1 + 0x10] %asi, %o4 | 290 | 50: ldswa [%o1 + 0x10] %asi, %o4 |
287 | jmpl %g1 + %lo(compat_sys_setsockopt), %g0 | 291 | jmpl %g1 + %lo(compat_sys_setsockopt), %g0 |
288 | ldswa [%o1 + 0x4] %asi, %o1 | 292 | 51: ldswa [%o1 + 0x4] %asi, %o1 |
289 | nop | 293 | nop |
290 | do_sys_getsockopt: /* compat_sys_getsockopt(int, int, int, u32, u32) */ | 294 | do_sys_getsockopt: /* compat_sys_getsockopt(int, int, int, u32, u32) */ |
291 | ldswa [%o1 + 0x0] %asi, %o0 | 295 | 52: ldswa [%o1 + 0x0] %asi, %o0 |
292 | sethi %hi(compat_sys_getsockopt), %g1 | 296 | sethi %hi(compat_sys_getsockopt), %g1 |
293 | ldswa [%o1 + 0x8] %asi, %o2 | 297 | 53: ldswa [%o1 + 0x8] %asi, %o2 |
294 | lduwa [%o1 + 0xc] %asi, %o3 | 298 | 54: lduwa [%o1 + 0xc] %asi, %o3 |
295 | lduwa [%o1 + 0x10] %asi, %o4 | 299 | 55: lduwa [%o1 + 0x10] %asi, %o4 |
296 | jmpl %g1 + %lo(compat_sys_getsockopt), %g0 | 300 | jmpl %g1 + %lo(compat_sys_getsockopt), %g0 |
297 | ldswa [%o1 + 0x4] %asi, %o1 | 301 | 56: ldswa [%o1 + 0x4] %asi, %o1 |
298 | nop | 302 | nop |
299 | do_sys_sendmsg: /* compat_sys_sendmsg(int, struct compat_msghdr *, unsigned int) */ | 303 | do_sys_sendmsg: /* compat_sys_sendmsg(int, struct compat_msghdr *, unsigned int) */ |
300 | ldswa [%o1 + 0x0] %asi, %o0 | 304 | 57: ldswa [%o1 + 0x0] %asi, %o0 |
301 | sethi %hi(compat_sys_sendmsg), %g1 | 305 | sethi %hi(compat_sys_sendmsg), %g1 |
302 | lduwa [%o1 + 0x8] %asi, %o2 | 306 | 58: lduwa [%o1 + 0x8] %asi, %o2 |
303 | jmpl %g1 + %lo(compat_sys_sendmsg), %g0 | 307 | jmpl %g1 + %lo(compat_sys_sendmsg), %g0 |
304 | lduwa [%o1 + 0x4] %asi, %o1 | 308 | 59: lduwa [%o1 + 0x4] %asi, %o1 |
305 | nop | 309 | nop |
306 | nop | 310 | nop |
307 | nop | 311 | nop |
308 | do_sys_recvmsg: /* compat_sys_recvmsg(int, struct compat_msghdr *, unsigned int) */ | 312 | do_sys_recvmsg: /* compat_sys_recvmsg(int, struct compat_msghdr *, unsigned int) */ |
309 | ldswa [%o1 + 0x0] %asi, %o0 | 313 | 60: ldswa [%o1 + 0x0] %asi, %o0 |
310 | sethi %hi(compat_sys_recvmsg), %g1 | 314 | sethi %hi(compat_sys_recvmsg), %g1 |
311 | lduwa [%o1 + 0x8] %asi, %o2 | 315 | 61: lduwa [%o1 + 0x8] %asi, %o2 |
312 | jmpl %g1 + %lo(compat_sys_recvmsg), %g0 | 316 | jmpl %g1 + %lo(compat_sys_recvmsg), %g0 |
313 | lduwa [%o1 + 0x4] %asi, %o1 | 317 | 62: lduwa [%o1 + 0x4] %asi, %o1 |
314 | nop | 318 | nop |
315 | nop | 319 | nop |
316 | nop | 320 | nop |
317 | __socketcall_table_end: | ||
318 | |||
319 | do_einval: | ||
320 | retl | ||
321 | mov -EINVAL, %o0 | ||
322 | do_efault: | ||
323 | retl | ||
324 | mov -EFAULT, %o0 | ||
325 | 321 | ||
326 | .section __ex_table | 322 | .section __ex_table |
327 | .align 4 | 323 | .align 4 |
328 | .word __socketcall_table_begin, 0, __socketcall_table_end, do_efault | 324 | .word 1b, __retl_efault, 2b, __retl_efault |
325 | .word 3b, __retl_efault, 4b, __retl_efault | ||
326 | .word 5b, __retl_efault, 6b, __retl_efault | ||
327 | .word 7b, __retl_efault, 8b, __retl_efault | ||
328 | .word 9b, __retl_efault, 10b, __retl_efault | ||
329 | .word 11b, __retl_efault, 12b, __retl_efault | ||
330 | .word 13b, __retl_efault, 14b, __retl_efault | ||
331 | .word 15b, __retl_efault, 16b, __retl_efault | ||
332 | .word 17b, __retl_efault, 18b, __retl_efault | ||
333 | .word 19b, __retl_efault, 20b, __retl_efault | ||
334 | .word 21b, __retl_efault, 22b, __retl_efault | ||
335 | .word 23b, __retl_efault, 24b, __retl_efault | ||
336 | .word 25b, __retl_efault, 26b, __retl_efault | ||
337 | .word 27b, __retl_efault, 28b, __retl_efault | ||
338 | .word 29b, __retl_efault, 30b, __retl_efault | ||
339 | .word 31b, __retl_efault, 32b, __retl_efault | ||
340 | .word 33b, __retl_efault, 34b, __retl_efault | ||
341 | .word 35b, __retl_efault, 36b, __retl_efault | ||
342 | .word 37b, __retl_efault, 38b, __retl_efault | ||
343 | .word 39b, __retl_efault, 40b, __retl_efault | ||
344 | .word 41b, __retl_efault, 42b, __retl_efault | ||
345 | .word 43b, __retl_efault, 44b, __retl_efault | ||
346 | .word 45b, __retl_efault, 46b, __retl_efault | ||
347 | .word 47b, __retl_efault, 48b, __retl_efault | ||
348 | .word 49b, __retl_efault, 50b, __retl_efault | ||
349 | .word 51b, __retl_efault, 52b, __retl_efault | ||
350 | .word 53b, __retl_efault, 54b, __retl_efault | ||
351 | .word 55b, __retl_efault, 56b, __retl_efault | ||
352 | .word 57b, __retl_efault, 58b, __retl_efault | ||
353 | .word 59b, __retl_efault, 60b, __retl_efault | ||
354 | .word 61b, __retl_efault, 62b, __retl_efault | ||
329 | .previous | 355 | .previous |
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index f8e7005fede9..5570e7bb22bb 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c | |||
@@ -189,19 +189,18 @@ void spitfire_data_access_exception(struct pt_regs *regs, unsigned long sfsr, un | |||
189 | 189 | ||
190 | if (regs->tstate & TSTATE_PRIV) { | 190 | if (regs->tstate & TSTATE_PRIV) { |
191 | /* Test if this comes from uaccess places. */ | 191 | /* Test if this comes from uaccess places. */ |
192 | unsigned long fixup; | 192 | const struct exception_table_entry *entry; |
193 | unsigned long g2 = regs->u_regs[UREG_G2]; | ||
194 | 193 | ||
195 | if ((fixup = search_extables_range(regs->tpc, &g2))) { | 194 | entry = search_exception_tables(regs->tpc); |
196 | /* Ouch, somebody is trying ugly VM hole tricks on us... */ | 195 | if (entry) { |
196 | /* Ouch, somebody is trying VM hole tricks on us... */ | ||
197 | #ifdef DEBUG_EXCEPTIONS | 197 | #ifdef DEBUG_EXCEPTIONS |
198 | printk("Exception: PC<%016lx> faddr<UNKNOWN>\n", regs->tpc); | 198 | printk("Exception: PC<%016lx> faddr<UNKNOWN>\n", regs->tpc); |
199 | printk("EX_TABLE: insn<%016lx> fixup<%016lx> " | 199 | printk("EX_TABLE: insn<%016lx> fixup<%016lx>\n", |
200 | "g2<%016lx>\n", regs->tpc, fixup, g2); | 200 | regs->tpc, entry->fixup); |
201 | #endif | 201 | #endif |
202 | regs->tpc = fixup; | 202 | regs->tpc = entry->fixup; |
203 | regs->tnpc = regs->tpc + 4; | 203 | regs->tnpc = regs->tpc + 4; |
204 | regs->u_regs[UREG_G2] = g2; | ||
205 | return; | 204 | return; |
206 | } | 205 | } |
207 | /* Shit... */ | 206 | /* Shit... */ |
@@ -758,26 +757,12 @@ void __init cheetah_ecache_flush_init(void) | |||
758 | ecache_flush_size = (2 * largest_size); | 757 | ecache_flush_size = (2 * largest_size); |
759 | ecache_flush_linesize = smallest_linesize; | 758 | ecache_flush_linesize = smallest_linesize; |
760 | 759 | ||
761 | /* Discover a physically contiguous chunk of physical | 760 | ecache_flush_physbase = find_ecache_flush_span(ecache_flush_size); |
762 | * memory in 'sp_banks' of size ecache_flush_size calculated | ||
763 | * above. Store the physical base of this area at | ||
764 | * ecache_flush_physbase. | ||
765 | */ | ||
766 | for (node = 0; ; node++) { | ||
767 | if (sp_banks[node].num_bytes == 0) | ||
768 | break; | ||
769 | if (sp_banks[node].num_bytes >= ecache_flush_size) { | ||
770 | ecache_flush_physbase = sp_banks[node].base_addr; | ||
771 | break; | ||
772 | } | ||
773 | } | ||
774 | 761 | ||
775 | /* Note: Zero would be a valid value of ecache_flush_physbase so | 762 | if (ecache_flush_physbase == ~0UL) { |
776 | * don't use that as the success test. :-) | ||
777 | */ | ||
778 | if (sp_banks[node].num_bytes == 0) { | ||
779 | prom_printf("cheetah_ecache_flush_init: Cannot find %d byte " | 763 | prom_printf("cheetah_ecache_flush_init: Cannot find %d byte " |
780 | "contiguous physical memory.\n", ecache_flush_size); | 764 | "contiguous physical memory.\n", |
765 | ecache_flush_size); | ||
781 | prom_halt(); | 766 | prom_halt(); |
782 | } | 767 | } |
783 | 768 | ||
@@ -1346,16 +1331,12 @@ static int cheetah_fix_ce(unsigned long physaddr) | |||
1346 | /* Return non-zero if PADDR is a valid physical memory address. */ | 1331 | /* Return non-zero if PADDR is a valid physical memory address. */ |
1347 | static int cheetah_check_main_memory(unsigned long paddr) | 1332 | static int cheetah_check_main_memory(unsigned long paddr) |
1348 | { | 1333 | { |
1349 | int i; | 1334 | unsigned long vaddr = PAGE_OFFSET + paddr; |
1350 | 1335 | ||
1351 | for (i = 0; ; i++) { | 1336 | if (vaddr > (unsigned long) high_memory) |
1352 | if (sp_banks[i].num_bytes == 0) | 1337 | return 0; |
1353 | break; | 1338 | |
1354 | if (paddr >= sp_banks[i].base_addr && | 1339 | return kern_addr_valid(vaddr); |
1355 | paddr < (sp_banks[i].base_addr + sp_banks[i].num_bytes)) | ||
1356 | return 1; | ||
1357 | } | ||
1358 | return 0; | ||
1359 | } | 1340 | } |
1360 | 1341 | ||
1361 | void cheetah_cee_handler(struct pt_regs *regs, unsigned long afsr, unsigned long afar) | 1342 | void cheetah_cee_handler(struct pt_regs *regs, unsigned long afsr, unsigned long afar) |
@@ -1610,10 +1591,10 @@ void cheetah_deferred_handler(struct pt_regs *regs, unsigned long afsr, unsigned | |||
1610 | /* OK, usermode access. */ | 1591 | /* OK, usermode access. */ |
1611 | recoverable = 1; | 1592 | recoverable = 1; |
1612 | } else { | 1593 | } else { |
1613 | unsigned long g2 = regs->u_regs[UREG_G2]; | 1594 | const struct exception_table_entry *entry; |
1614 | unsigned long fixup = search_extables_range(regs->tpc, &g2); | ||
1615 | 1595 | ||
1616 | if (fixup != 0UL) { | 1596 | entry = search_exception_tables(regs->tpc); |
1597 | if (entry) { | ||
1617 | /* OK, kernel access to userspace. */ | 1598 | /* OK, kernel access to userspace. */ |
1618 | recoverable = 1; | 1599 | recoverable = 1; |
1619 | 1600 | ||
@@ -1632,9 +1613,8 @@ void cheetah_deferred_handler(struct pt_regs *regs, unsigned long afsr, unsigned | |||
1632 | * recoverable condition. | 1613 | * recoverable condition. |
1633 | */ | 1614 | */ |
1634 | if (recoverable) { | 1615 | if (recoverable) { |
1635 | regs->tpc = fixup; | 1616 | regs->tpc = entry->fixup; |
1636 | regs->tnpc = regs->tpc + 4; | 1617 | regs->tnpc = regs->tpc + 4; |
1637 | regs->u_regs[UREG_G2] = g2; | ||
1638 | } | 1618 | } |
1639 | } | 1619 | } |
1640 | } | 1620 | } |
diff --git a/arch/sparc64/kernel/una_asm.S b/arch/sparc64/kernel/una_asm.S index da48400bcc95..1f5b5b708ce7 100644 --- a/arch/sparc64/kernel/una_asm.S +++ b/arch/sparc64/kernel/una_asm.S | |||
@@ -6,13 +6,6 @@ | |||
6 | 6 | ||
7 | .text | 7 | .text |
8 | 8 | ||
9 | kernel_unaligned_trap_fault: | ||
10 | call kernel_mna_trap_fault | ||
11 | nop | ||
12 | retl | ||
13 | nop | ||
14 | .size kern_unaligned_trap_fault, .-kern_unaligned_trap_fault | ||
15 | |||
16 | .globl __do_int_store | 9 | .globl __do_int_store |
17 | __do_int_store: | 10 | __do_int_store: |
18 | rd %asi, %o4 | 11 | rd %asi, %o4 |
@@ -51,24 +44,24 @@ __do_int_store: | |||
51 | 0: | 44 | 0: |
52 | wr %o4, 0x0, %asi | 45 | wr %o4, 0x0, %asi |
53 | retl | 46 | retl |
54 | nop | 47 | mov 0, %o0 |
55 | .size __do_int_store, .-__do_int_store | 48 | .size __do_int_store, .-__do_int_store |
56 | 49 | ||
57 | .section __ex_table | 50 | .section __ex_table |
58 | .word 4b, kernel_unaligned_trap_fault | 51 | .word 4b, __retl_efault |
59 | .word 5b, kernel_unaligned_trap_fault | 52 | .word 5b, __retl_efault |
60 | .word 6b, kernel_unaligned_trap_fault | 53 | .word 6b, __retl_efault |
61 | .word 7b, kernel_unaligned_trap_fault | 54 | .word 7b, __retl_efault |
62 | .word 8b, kernel_unaligned_trap_fault | 55 | .word 8b, __retl_efault |
63 | .word 9b, kernel_unaligned_trap_fault | 56 | .word 9b, __retl_efault |
64 | .word 10b, kernel_unaligned_trap_fault | 57 | .word 10b, __retl_efault |
65 | .word 11b, kernel_unaligned_trap_fault | 58 | .word 11b, __retl_efault |
66 | .word 12b, kernel_unaligned_trap_fault | 59 | .word 12b, __retl_efault |
67 | .word 13b, kernel_unaligned_trap_fault | 60 | .word 13b, __retl_efault |
68 | .word 14b, kernel_unaligned_trap_fault | 61 | .word 14b, __retl_efault |
69 | .word 15b, kernel_unaligned_trap_fault | 62 | .word 15b, __retl_efault |
70 | .word 16b, kernel_unaligned_trap_fault | 63 | .word 16b, __retl_efault |
71 | .word 17b, kernel_unaligned_trap_fault | 64 | .word 17b, __retl_efault |
72 | .previous | 65 | .previous |
73 | 66 | ||
74 | .globl do_int_load | 67 | .globl do_int_load |
@@ -133,21 +126,21 @@ do_int_load: | |||
133 | 0: | 126 | 0: |
134 | wr %o5, 0x0, %asi | 127 | wr %o5, 0x0, %asi |
135 | retl | 128 | retl |
136 | nop | 129 | mov 0, %o0 |
137 | .size __do_int_load, .-__do_int_load | 130 | .size __do_int_load, .-__do_int_load |
138 | 131 | ||
139 | .section __ex_table | 132 | .section __ex_table |
140 | .word 4b, kernel_unaligned_trap_fault | 133 | .word 4b, __retl_efault |
141 | .word 5b, kernel_unaligned_trap_fault | 134 | .word 5b, __retl_efault |
142 | .word 6b, kernel_unaligned_trap_fault | 135 | .word 6b, __retl_efault |
143 | .word 7b, kernel_unaligned_trap_fault | 136 | .word 7b, __retl_efault |
144 | .word 8b, kernel_unaligned_trap_fault | 137 | .word 8b, __retl_efault |
145 | .word 9b, kernel_unaligned_trap_fault | 138 | .word 9b, __retl_efault |
146 | .word 10b, kernel_unaligned_trap_fault | 139 | .word 10b, __retl_efault |
147 | .word 11b, kernel_unaligned_trap_fault | 140 | .word 11b, __retl_efault |
148 | .word 12b, kernel_unaligned_trap_fault | 141 | .word 12b, __retl_efault |
149 | .word 13b, kernel_unaligned_trap_fault | 142 | .word 13b, __retl_efault |
150 | .word 14b, kernel_unaligned_trap_fault | 143 | .word 14b, __retl_efault |
151 | .word 15b, kernel_unaligned_trap_fault | 144 | .word 15b, __retl_efault |
152 | .word 16b, kernel_unaligned_trap_fault | 145 | .word 16b, __retl_efault |
153 | .previous | 146 | .previous |
diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc64/kernel/unaligned.c index 02af08ffec8f..70faf630603b 100644 --- a/arch/sparc64/kernel/unaligned.c +++ b/arch/sparc64/kernel/unaligned.c | |||
@@ -180,14 +180,14 @@ static void __attribute_used__ unaligned_panic(char *str, struct pt_regs *regs) | |||
180 | die_if_kernel(str, regs); | 180 | die_if_kernel(str, regs); |
181 | } | 181 | } |
182 | 182 | ||
183 | extern void do_int_load(unsigned long *dest_reg, int size, | 183 | extern int do_int_load(unsigned long *dest_reg, int size, |
184 | unsigned long *saddr, int is_signed, int asi); | 184 | unsigned long *saddr, int is_signed, int asi); |
185 | 185 | ||
186 | extern void __do_int_store(unsigned long *dst_addr, int size, | 186 | extern int __do_int_store(unsigned long *dst_addr, int size, |
187 | unsigned long src_val, int asi); | 187 | unsigned long src_val, int asi); |
188 | 188 | ||
189 | static inline void do_int_store(int reg_num, int size, unsigned long *dst_addr, | 189 | static inline int do_int_store(int reg_num, int size, unsigned long *dst_addr, |
190 | struct pt_regs *regs, int asi, int orig_asi) | 190 | struct pt_regs *regs, int asi, int orig_asi) |
191 | { | 191 | { |
192 | unsigned long zero = 0; | 192 | unsigned long zero = 0; |
193 | unsigned long *src_val_p = &zero; | 193 | unsigned long *src_val_p = &zero; |
@@ -219,7 +219,7 @@ static inline void do_int_store(int reg_num, int size, unsigned long *dst_addr, | |||
219 | break; | 219 | break; |
220 | }; | 220 | }; |
221 | } | 221 | } |
222 | __do_int_store(dst_addr, size, src_val, asi); | 222 | return __do_int_store(dst_addr, size, src_val, asi); |
223 | } | 223 | } |
224 | 224 | ||
225 | static inline void advance(struct pt_regs *regs) | 225 | static inline void advance(struct pt_regs *regs) |
@@ -242,14 +242,14 @@ static inline int ok_for_kernel(unsigned int insn) | |||
242 | return !floating_point_load_or_store_p(insn); | 242 | return !floating_point_load_or_store_p(insn); |
243 | } | 243 | } |
244 | 244 | ||
245 | void kernel_mna_trap_fault(void) | 245 | static void kernel_mna_trap_fault(void) |
246 | { | 246 | { |
247 | struct pt_regs *regs = current_thread_info()->kern_una_regs; | 247 | struct pt_regs *regs = current_thread_info()->kern_una_regs; |
248 | unsigned int insn = current_thread_info()->kern_una_insn; | 248 | unsigned int insn = current_thread_info()->kern_una_insn; |
249 | unsigned long g2 = regs->u_regs[UREG_G2]; | 249 | const struct exception_table_entry *entry; |
250 | unsigned long fixup = search_extables_range(regs->tpc, &g2); | ||
251 | 250 | ||
252 | if (!fixup) { | 251 | entry = search_exception_tables(regs->tpc); |
252 | if (!entry) { | ||
253 | unsigned long address; | 253 | unsigned long address; |
254 | 254 | ||
255 | address = compute_effective_address(regs, insn, | 255 | address = compute_effective_address(regs, insn, |
@@ -270,9 +270,8 @@ void kernel_mna_trap_fault(void) | |||
270 | die_if_kernel("Oops", regs); | 270 | die_if_kernel("Oops", regs); |
271 | /* Not reached */ | 271 | /* Not reached */ |
272 | } | 272 | } |
273 | regs->tpc = fixup; | 273 | regs->tpc = entry->fixup; |
274 | regs->tnpc = regs->tpc + 4; | 274 | regs->tnpc = regs->tpc + 4; |
275 | regs->u_regs [UREG_G2] = g2; | ||
276 | 275 | ||
277 | regs->tstate &= ~TSTATE_ASI; | 276 | regs->tstate &= ~TSTATE_ASI; |
278 | regs->tstate |= (ASI_AIUS << 24UL); | 277 | regs->tstate |= (ASI_AIUS << 24UL); |
@@ -295,7 +294,7 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u | |||
295 | kernel_mna_trap_fault(); | 294 | kernel_mna_trap_fault(); |
296 | } else { | 295 | } else { |
297 | unsigned long addr, *reg_addr; | 296 | unsigned long addr, *reg_addr; |
298 | int orig_asi, asi; | 297 | int orig_asi, asi, err; |
299 | 298 | ||
300 | addr = compute_effective_address(regs, insn, | 299 | addr = compute_effective_address(regs, insn, |
301 | ((insn >> 25) & 0x1f)); | 300 | ((insn >> 25) & 0x1f)); |
@@ -320,9 +319,10 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u | |||
320 | switch (dir) { | 319 | switch (dir) { |
321 | case load: | 320 | case load: |
322 | reg_addr = fetch_reg_addr(((insn>>25)&0x1f), regs); | 321 | reg_addr = fetch_reg_addr(((insn>>25)&0x1f), regs); |
323 | do_int_load(reg_addr, size, (unsigned long *) addr, | 322 | err = do_int_load(reg_addr, size, |
324 | decode_signedness(insn), asi); | 323 | (unsigned long *) addr, |
325 | if (unlikely(asi != orig_asi)) { | 324 | decode_signedness(insn), asi); |
325 | if (likely(!err) && unlikely(asi != orig_asi)) { | ||
326 | unsigned long val_in = *reg_addr; | 326 | unsigned long val_in = *reg_addr; |
327 | switch (size) { | 327 | switch (size) { |
328 | case 2: | 328 | case 2: |
@@ -344,16 +344,19 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, u | |||
344 | break; | 344 | break; |
345 | 345 | ||
346 | case store: | 346 | case store: |
347 | do_int_store(((insn>>25)&0x1f), size, | 347 | err = do_int_store(((insn>>25)&0x1f), size, |
348 | (unsigned long *) addr, regs, | 348 | (unsigned long *) addr, regs, |
349 | asi, orig_asi); | 349 | asi, orig_asi); |
350 | break; | 350 | break; |
351 | 351 | ||
352 | default: | 352 | default: |
353 | panic("Impossible kernel unaligned trap."); | 353 | panic("Impossible kernel unaligned trap."); |
354 | /* Not reached... */ | 354 | /* Not reached... */ |
355 | } | 355 | } |
356 | advance(regs); | 356 | if (unlikely(err)) |
357 | kernel_mna_trap_fault(); | ||
358 | else | ||
359 | advance(regs); | ||
357 | } | 360 | } |
358 | } | 361 | } |
359 | 362 | ||