Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / arch / sparc / kernel / unaligned.c
blob3266ad05950d825ecc57585394ee0abfe7dae656
1 /* $Id: unaligned.c,v 1.23 2001/12/21 00:54:31 davem Exp $
2 * unaligned.c: Unaligned load/store trap handling with special
3 * cases for the kernel to do them more quickly.
5 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
6 * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
7 */
10 #include <linux/kernel.h>
11 #include <linux/sched.h>
12 #include <linux/mm.h>
13 #include <linux/module.h>
14 #include <asm/ptrace.h>
15 #include <asm/processor.h>
16 #include <asm/system.h>
17 #include <asm/uaccess.h>
18 #include <linux/smp.h>
19 #include <linux/smp_lock.h>
21 /* #define DEBUG_MNA */
23 enum direction {
24 load, /* ld, ldd, ldh, ldsh */
25 store, /* st, std, sth, stsh */
26 both, /* Swap, ldstub, etc. */
27 fpload,
28 fpstore,
29 invalid,
32 #ifdef DEBUG_MNA
33 static char *dirstrings[] = {
34 "load", "store", "both", "fpload", "fpstore", "invalid"
36 #endif
38 static inline enum direction decode_direction(unsigned int insn)
40 unsigned long tmp = (insn >> 21) & 1;
42 if(!tmp)
43 return load;
44 else {
45 if(((insn>>19)&0x3f) == 15)
46 return both;
47 else
48 return store;
52 /* 8 = double-word, 4 = word, 2 = half-word */
53 static inline int decode_access_size(unsigned int insn)
55 insn = (insn >> 19) & 3;
57 if(!insn)
58 return 4;
59 else if(insn == 3)
60 return 8;
61 else if(insn == 2)
62 return 2;
63 else {
64 printk("Impossible unaligned trap. insn=%08x\n", insn);
65 die_if_kernel("Byte sized unaligned access?!?!", current->thread.kregs);
66 return 4; /* just to keep gcc happy. */
70 /* 0x400000 = signed, 0 = unsigned */
71 static inline int decode_signedness(unsigned int insn)
73 return (insn & 0x400000);
76 static inline void maybe_flush_windows(unsigned int rs1, unsigned int rs2,
77 unsigned int rd)
79 if(rs2 >= 16 || rs1 >= 16 || rd >= 16) {
80 /* Wheee... */
81 __asm__ __volatile__("save %sp, -0x40, %sp\n\t"
82 "save %sp, -0x40, %sp\n\t"
83 "save %sp, -0x40, %sp\n\t"
84 "save %sp, -0x40, %sp\n\t"
85 "save %sp, -0x40, %sp\n\t"
86 "save %sp, -0x40, %sp\n\t"
87 "save %sp, -0x40, %sp\n\t"
88 "restore; restore; restore; restore;\n\t"
89 "restore; restore; restore;\n\t");
93 static inline int sign_extend_imm13(int imm)
95 return imm << 19 >> 19;
98 static inline unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
100 struct reg_window *win;
102 if(reg < 16)
103 return (!reg ? 0 : regs->u_regs[reg]);
105 /* Ho hum, the slightly complicated case. */
106 win = (struct reg_window *) regs->u_regs[UREG_FP];
107 return win->locals[reg - 16]; /* yes, I know what this does... */
110 static inline unsigned long safe_fetch_reg(unsigned int reg, struct pt_regs *regs)
112 struct reg_window __user *win;
113 unsigned long ret;
115 if (reg < 16)
116 return (!reg ? 0 : regs->u_regs[reg]);
118 /* Ho hum, the slightly complicated case. */
119 win = (struct reg_window __user *) regs->u_regs[UREG_FP];
121 if ((unsigned long)win & 3)
122 return -1;
124 if (get_user(ret, &win->locals[reg - 16]))
125 return -1;
127 return ret;
130 static inline unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *regs)
132 struct reg_window *win;
134 if(reg < 16)
135 return &regs->u_regs[reg];
136 win = (struct reg_window *) regs->u_regs[UREG_FP];
137 return &win->locals[reg - 16];
140 static unsigned long compute_effective_address(struct pt_regs *regs,
141 unsigned int insn)
143 unsigned int rs1 = (insn >> 14) & 0x1f;
144 unsigned int rs2 = insn & 0x1f;
145 unsigned int rd = (insn >> 25) & 0x1f;
147 if(insn & 0x2000) {
148 maybe_flush_windows(rs1, 0, rd);
149 return (fetch_reg(rs1, regs) + sign_extend_imm13(insn));
150 } else {
151 maybe_flush_windows(rs1, rs2, rd);
152 return (fetch_reg(rs1, regs) + fetch_reg(rs2, regs));
156 unsigned long safe_compute_effective_address(struct pt_regs *regs,
157 unsigned int insn)
159 unsigned int rs1 = (insn >> 14) & 0x1f;
160 unsigned int rs2 = insn & 0x1f;
161 unsigned int rd = (insn >> 25) & 0x1f;
163 if(insn & 0x2000) {
164 maybe_flush_windows(rs1, 0, rd);
165 return (safe_fetch_reg(rs1, regs) + sign_extend_imm13(insn));
166 } else {
167 maybe_flush_windows(rs1, rs2, rd);
168 return (safe_fetch_reg(rs1, regs) + safe_fetch_reg(rs2, regs));
172 /* This is just to make gcc think panic does return... */
173 static void unaligned_panic(char *str)
175 panic(str);
178 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
179 #define do_integer_load(dest_reg, size, saddr, is_signed, errh) ({ \
180 __asm__ __volatile__ ( \
181 "cmp %1, 8\n\t" \
182 "be 9f\n\t" \
183 " cmp %1, 4\n\t" \
184 "be 6f\n" \
185 "4:\t" " ldub [%2], %%l1\n" \
186 "5:\t" "ldub [%2 + 1], %%l2\n\t" \
187 "sll %%l1, 8, %%l1\n\t" \
188 "tst %3\n\t" \
189 "be 3f\n\t" \
190 " add %%l1, %%l2, %%l1\n\t" \
191 "sll %%l1, 16, %%l1\n\t" \
192 "sra %%l1, 16, %%l1\n" \
193 "3:\t" "b 0f\n\t" \
194 " st %%l1, [%0]\n" \
195 "6:\t" "ldub [%2 + 1], %%l2\n\t" \
196 "sll %%l1, 24, %%l1\n" \
197 "7:\t" "ldub [%2 + 2], %%g7\n\t" \
198 "sll %%l2, 16, %%l2\n" \
199 "8:\t" "ldub [%2 + 3], %%g1\n\t" \
200 "sll %%g7, 8, %%g7\n\t" \
201 "or %%l1, %%l2, %%l1\n\t" \
202 "or %%g7, %%g1, %%g7\n\t" \
203 "or %%l1, %%g7, %%l1\n\t" \
204 "b 0f\n\t" \
205 " st %%l1, [%0]\n" \
206 "9:\t" "ldub [%2], %%l1\n" \
207 "10:\t" "ldub [%2 + 1], %%l2\n\t" \
208 "sll %%l1, 24, %%l1\n" \
209 "11:\t" "ldub [%2 + 2], %%g7\n\t" \
210 "sll %%l2, 16, %%l2\n" \
211 "12:\t" "ldub [%2 + 3], %%g1\n\t" \
212 "sll %%g7, 8, %%g7\n\t" \
213 "or %%l1, %%l2, %%l1\n\t" \
214 "or %%g7, %%g1, %%g7\n\t" \
215 "or %%l1, %%g7, %%g7\n" \
216 "13:\t" "ldub [%2 + 4], %%l1\n\t" \
217 "st %%g7, [%0]\n" \
218 "14:\t" "ldub [%2 + 5], %%l2\n\t" \
219 "sll %%l1, 24, %%l1\n" \
220 "15:\t" "ldub [%2 + 6], %%g7\n\t" \
221 "sll %%l2, 16, %%l2\n" \
222 "16:\t" "ldub [%2 + 7], %%g1\n\t" \
223 "sll %%g7, 8, %%g7\n\t" \
224 "or %%l1, %%l2, %%l1\n\t" \
225 "or %%g7, %%g1, %%g7\n\t" \
226 "or %%l1, %%g7, %%g7\n\t" \
227 "st %%g7, [%0 + 4]\n" \
228 "0:\n\n\t" \
229 ".section __ex_table,#alloc\n\t" \
230 ".word 4b, " #errh "\n\t" \
231 ".word 5b, " #errh "\n\t" \
232 ".word 6b, " #errh "\n\t" \
233 ".word 7b, " #errh "\n\t" \
234 ".word 8b, " #errh "\n\t" \
235 ".word 9b, " #errh "\n\t" \
236 ".word 10b, " #errh "\n\t" \
237 ".word 11b, " #errh "\n\t" \
238 ".word 12b, " #errh "\n\t" \
239 ".word 13b, " #errh "\n\t" \
240 ".word 14b, " #errh "\n\t" \
241 ".word 15b, " #errh "\n\t" \
242 ".word 16b, " #errh "\n\n\t" \
243 ".previous\n\t" \
244 : : "r" (dest_reg), "r" (size), "r" (saddr), "r" (is_signed) \
245 : "l1", "l2", "g7", "g1", "cc"); \
248 #define store_common(dst_addr, size, src_val, errh) ({ \
249 __asm__ __volatile__ ( \
250 "ld [%2], %%l1\n" \
251 "cmp %1, 2\n\t" \
252 "be 2f\n\t" \
253 " cmp %1, 4\n\t" \
254 "be 1f\n\t" \
255 " srl %%l1, 24, %%l2\n\t" \
256 "srl %%l1, 16, %%g7\n" \
257 "4:\t" "stb %%l2, [%0]\n\t" \
258 "srl %%l1, 8, %%l2\n" \
259 "5:\t" "stb %%g7, [%0 + 1]\n\t" \
260 "ld [%2 + 4], %%g7\n" \
261 "6:\t" "stb %%l2, [%0 + 2]\n\t" \
262 "srl %%g7, 24, %%l2\n" \
263 "7:\t" "stb %%l1, [%0 + 3]\n\t" \
264 "srl %%g7, 16, %%l1\n" \
265 "8:\t" "stb %%l2, [%0 + 4]\n\t" \
266 "srl %%g7, 8, %%l2\n" \
267 "9:\t" "stb %%l1, [%0 + 5]\n" \
268 "10:\t" "stb %%l2, [%0 + 6]\n\t" \
269 "b 0f\n" \
270 "11:\t" " stb %%g7, [%0 + 7]\n" \
271 "1:\t" "srl %%l1, 16, %%g7\n" \
272 "12:\t" "stb %%l2, [%0]\n\t" \
273 "srl %%l1, 8, %%l2\n" \
274 "13:\t" "stb %%g7, [%0 + 1]\n" \
275 "14:\t" "stb %%l2, [%0 + 2]\n\t" \
276 "b 0f\n" \
277 "15:\t" " stb %%l1, [%0 + 3]\n" \
278 "2:\t" "srl %%l1, 8, %%l2\n" \
279 "16:\t" "stb %%l2, [%0]\n" \
280 "17:\t" "stb %%l1, [%0 + 1]\n" \
281 "0:\n\n\t" \
282 ".section __ex_table,#alloc\n\t" \
283 ".word 4b, " #errh "\n\t" \
284 ".word 5b, " #errh "\n\t" \
285 ".word 6b, " #errh "\n\t" \
286 ".word 7b, " #errh "\n\t" \
287 ".word 8b, " #errh "\n\t" \
288 ".word 9b, " #errh "\n\t" \
289 ".word 10b, " #errh "\n\t" \
290 ".word 11b, " #errh "\n\t" \
291 ".word 12b, " #errh "\n\t" \
292 ".word 13b, " #errh "\n\t" \
293 ".word 14b, " #errh "\n\t" \
294 ".word 15b, " #errh "\n\t" \
295 ".word 16b, " #errh "\n\t" \
296 ".word 17b, " #errh "\n\n\t" \
297 ".previous\n\t" \
298 : : "r" (dst_addr), "r" (size), "r" (src_val) \
299 : "l1", "l2", "g7", "g1", "cc"); \
302 #define do_integer_store(reg_num, size, dst_addr, regs, errh) ({ \
303 unsigned long *src_val; \
304 static unsigned long zero[2] = { 0, }; \
306 if (reg_num) src_val = fetch_reg_addr(reg_num, regs); \
307 else { \
308 src_val = &zero[0]; \
309 if (size == 8) \
310 zero[1] = fetch_reg(1, regs); \
312 store_common(dst_addr, size, src_val, errh); \
314 =======
315 /* una_asm.S */
316 extern int do_int_load(unsigned long *dest_reg, int size,
317 unsigned long *saddr, int is_signed);
318 extern int __do_int_store(unsigned long *dst_addr, int size,
319 unsigned long *src_val);
321 static int do_int_store(int reg_num, int size, unsigned long *dst_addr,
322 struct pt_regs *regs)
324 unsigned long zero[2] = { 0, 0 };
325 unsigned long *src_val;
327 if (reg_num)
328 src_val = fetch_reg_addr(reg_num, regs);
329 else {
330 src_val = &zero[0];
331 if (size == 8)
332 zero[1] = fetch_reg(1, regs);
334 return __do_int_store(dst_addr, size, src_val);
336 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
338 extern void smp_capture(void);
339 extern void smp_release(void);
341 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
342 #define do_atomic(srcdest_reg, mem, errh) ({ \
343 unsigned long flags, tmp; \
345 smp_capture(); \
346 local_irq_save(flags); \
347 tmp = *srcdest_reg; \
348 do_integer_load(srcdest_reg, 4, mem, 0, errh); \
349 store_common(mem, 4, &tmp, errh); \
350 local_irq_restore(flags); \
351 smp_release(); \
354 =======
355 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
356 static inline void advance(struct pt_regs *regs)
358 regs->pc = regs->npc;
359 regs->npc += 4;
362 static inline int floating_point_load_or_store_p(unsigned int insn)
364 return (insn >> 24) & 1;
367 static inline int ok_for_kernel(unsigned int insn)
369 return !floating_point_load_or_store_p(insn);
372 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
373 void kernel_mna_trap_fault(struct pt_regs *regs, unsigned int insn) __asm__ ("kernel_mna_trap_fault");
375 void kernel_mna_trap_fault(struct pt_regs *regs, unsigned int insn)
376 =======
377 static void kernel_mna_trap_fault(struct pt_regs *regs, unsigned int insn)
378 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
380 unsigned long g2 = regs->u_regs [UREG_G2];
381 unsigned long fixup = search_extables_range(regs->pc, &g2);
383 if (!fixup) {
384 unsigned long address = compute_effective_address(regs, insn);
385 if(address < PAGE_SIZE) {
386 printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference in mna handler");
387 } else
388 printk(KERN_ALERT "Unable to handle kernel paging request in mna handler");
389 printk(KERN_ALERT " at virtual address %08lx\n",address);
390 printk(KERN_ALERT "current->{mm,active_mm}->context = %08lx\n",
391 (current->mm ? current->mm->context :
392 current->active_mm->context));
393 printk(KERN_ALERT "current->{mm,active_mm}->pgd = %08lx\n",
394 (current->mm ? (unsigned long) current->mm->pgd :
395 (unsigned long) current->active_mm->pgd));
396 die_if_kernel("Oops", regs);
397 /* Not reached */
399 regs->pc = fixup;
400 regs->npc = regs->pc + 4;
401 regs->u_regs [UREG_G2] = g2;
404 asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn)
406 enum direction dir = decode_direction(insn);
407 int size = decode_access_size(insn);
409 if(!ok_for_kernel(insn) || dir == both) {
410 printk("Unsupported unaligned load/store trap for kernel at <%08lx>.\n",
411 regs->pc);
412 unaligned_panic("Wheee. Kernel does fpu/atomic unaligned load/store.");
413 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
415 __asm__ __volatile__ ("\n"
416 "kernel_unaligned_trap_fault:\n\t"
417 "mov %0, %%o0\n\t"
418 "call kernel_mna_trap_fault\n\t"
419 " mov %1, %%o1\n\t"
421 : "r" (regs), "r" (insn)
422 : "o0", "o1", "o2", "o3", "o4", "o5", "o7",
423 "g1", "g2", "g3", "g4", "g5", "g7", "cc");
424 =======
425 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
426 } else {
427 unsigned long addr = compute_effective_address(regs, insn);
428 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
429 =======
430 int err;
431 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
433 #ifdef DEBUG_MNA
434 printk("KMNA: pc=%08lx [dir=%s addr=%08lx size=%d] retpc[%08lx]\n",
435 regs->pc, dirstrings[dir], addr, size, regs->u_regs[UREG_RETPC]);
436 #endif
437 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
438 switch(dir) {
439 =======
440 switch (dir) {
441 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
442 case load:
443 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
444 do_integer_load(fetch_reg_addr(((insn>>25)&0x1f), regs),
445 size, (unsigned long *) addr,
446 decode_signedness(insn),
447 kernel_unaligned_trap_fault);
448 =======
449 err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f),
450 regs),
451 size, (unsigned long *) addr,
452 decode_signedness(insn));
453 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
454 break;
456 case store:
457 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
458 do_integer_store(((insn>>25)&0x1f), size,
459 (unsigned long *) addr, regs,
460 kernel_unaligned_trap_fault);
461 =======
462 err = do_int_store(((insn>>25)&0x1f), size,
463 (unsigned long *) addr, regs);
464 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
465 break;
466 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
467 #if 0 /* unsupported */
468 case both:
469 do_atomic(fetch_reg_addr(((insn>>25)&0x1f), regs),
470 (unsigned long *) addr,
471 kernel_unaligned_trap_fault);
472 break;
473 #endif
474 =======
475 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
476 default:
477 panic("Impossible kernel unaligned trap.");
478 /* Not reached... */
480 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
481 advance(regs);
482 =======
483 if (err)
484 kernel_mna_trap_fault(regs, insn);
485 else
486 advance(regs);
487 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
491 static inline int ok_for_user(struct pt_regs *regs, unsigned int insn,
492 enum direction dir)
494 unsigned int reg;
495 int check = (dir == load) ? VERIFY_READ : VERIFY_WRITE;
496 int size = ((insn >> 19) & 3) == 3 ? 8 : 4;
498 if ((regs->pc | regs->npc) & 3)
499 return 0;
501 /* Must access_ok() in all the necessary places. */
502 #define WINREG_ADDR(regnum) \
503 ((void __user *)(((unsigned long *)regs->u_regs[UREG_FP])+(regnum)))
505 reg = (insn >> 25) & 0x1f;
506 if (reg >= 16) {
507 if (!access_ok(check, WINREG_ADDR(reg - 16), size))
508 return -EFAULT;
510 reg = (insn >> 14) & 0x1f;
511 if (reg >= 16) {
512 if (!access_ok(check, WINREG_ADDR(reg - 16), size))
513 return -EFAULT;
515 if (!(insn & 0x2000)) {
516 reg = (insn & 0x1f);
517 if (reg >= 16) {
518 if (!access_ok(check, WINREG_ADDR(reg - 16), size))
519 return -EFAULT;
522 #undef WINREG_ADDR
523 return 0;
526 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
527 void user_mna_trap_fault(struct pt_regs *regs, unsigned int insn) __asm__ ("user_mna_trap_fault");
529 void user_mna_trap_fault(struct pt_regs *regs, unsigned int insn)
530 =======
531 static void user_mna_trap_fault(struct pt_regs *regs, unsigned int insn)
532 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
534 siginfo_t info;
536 info.si_signo = SIGBUS;
537 info.si_errno = 0;
538 info.si_code = BUS_ADRALN;
539 info.si_addr = (void __user *)safe_compute_effective_address(regs, insn);
540 info.si_trapno = 0;
541 send_sig_info(SIGBUS, &info, current);
544 asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn)
546 enum direction dir;
548 lock_kernel();
549 if(!(current->thread.flags & SPARC_FLAG_UNALIGNED) ||
550 (((insn >> 30) & 3) != 3))
551 goto kill_user;
552 dir = decode_direction(insn);
553 if(!ok_for_user(regs, insn, dir)) {
554 goto kill_user;
555 } else {
556 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
557 int size = decode_access_size(insn);
558 =======
559 int err, size = decode_access_size(insn);
560 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
561 unsigned long addr;
563 if(floating_point_load_or_store_p(insn)) {
564 printk("User FPU load/store unaligned unsupported.\n");
565 goto kill_user;
568 addr = compute_effective_address(regs, insn);
569 switch(dir) {
570 case load:
571 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
572 do_integer_load(fetch_reg_addr(((insn>>25)&0x1f), regs),
573 size, (unsigned long *) addr,
574 decode_signedness(insn),
575 user_unaligned_trap_fault);
576 =======
577 err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f),
578 regs),
579 size, (unsigned long *) addr,
580 decode_signedness(insn));
581 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
582 break;
584 case store:
585 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
586 do_integer_store(((insn>>25)&0x1f), size,
587 (unsigned long *) addr, regs,
588 user_unaligned_trap_fault);
589 =======
590 err = do_int_store(((insn>>25)&0x1f), size,
591 (unsigned long *) addr, regs);
592 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
593 break;
595 case both:
596 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
597 #if 0 /* unsupported */
598 do_atomic(fetch_reg_addr(((insn>>25)&0x1f), regs),
599 (unsigned long *) addr,
600 user_unaligned_trap_fault);
601 #else
602 =======
603 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
605 * This was supported in 2.4. However, we question
606 * the value of SWAP instruction across word boundaries.
608 printk("Unaligned SWAP unsupported.\n");
609 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
610 goto kill_user;
611 #endif
612 =======
613 err = -EFAULT;
614 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
615 break;
617 default:
618 unaligned_panic("Impossible user unaligned trap.");
619 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
621 __asm__ __volatile__ ("\n"
622 "user_unaligned_trap_fault:\n\t"
623 "mov %0, %%o0\n\t"
624 "call user_mna_trap_fault\n\t"
625 " mov %1, %%o1\n\t"
627 : "r" (regs), "r" (insn)
628 : "o0", "o1", "o2", "o3", "o4", "o5", "o7",
629 "g1", "g2", "g3", "g4", "g5", "g7", "cc");
630 =======
631 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
632 goto out;
634 <<<<<<< HEAD:arch/sparc/kernel/unaligned.c
635 advance(regs);
636 =======
637 if (err)
638 goto kill_user;
639 else
640 advance(regs);
641 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc/kernel/unaligned.c
642 goto out;
645 kill_user:
646 user_mna_trap_fault(regs, insn);
647 out:
648 unlock_kernel();