2 * arch/alpha/kernel/traps.c
4 * (C) Copyright 1994 Linus Torvalds
8 * This file initializes the trap entry points
12 #include <linux/sched.h>
13 #include <linux/tty.h>
14 #include <linux/delay.h>
15 #include <linux/smp_lock.h>
16 #include <linux/module.h>
17 #include <linux/init.h>
18 #include <linux/kallsyms.h>
20 #include <asm/gentrap.h>
21 #include <asm/uaccess.h>
22 #include <asm/unaligned.h>
23 #include <asm/sysinfo.h>
24 #include <asm/hwrpb.h>
25 #include <asm/mmu_context.h>
29 /* Work-around for some SRMs which mishandle opDEC faults. */
36 __asm__
__volatile__ (
37 /* Load the address of... */
39 /* A stub instruction fault handler. Just add 4 to the
45 /* Install the instruction fault handler. */
47 " call_pal %[wrent]\n"
48 /* With that in place, the fault from the round-to-minf fp
49 insn will arrive either at the "lda 4" insn (bad) or one
50 past that (good). This places the correct fixup in %0. */
52 " cvttq/svm $f31,$f31\n"
54 : [fix
] "=r" (opDEC_fix
)
55 : [rti
] "n" (PAL_rti
), [wrent
] "n" (PAL_wrent
)
56 : "$0", "$1", "$16", "$17", "$22", "$23", "$24", "$25");
59 printk("opDEC fixup enabled.\n");
63 dik_show_regs(struct pt_regs
*regs
, unsigned long *r9_15
)
65 printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx %s\n",
66 regs
->pc
, regs
->r26
, regs
->ps
, print_tainted());
67 print_symbol("pc is at %s\n", regs
->pc
);
68 print_symbol("ra is at %s\n", regs
->r26
);
69 printk("v0 = %016lx t0 = %016lx t1 = %016lx\n",
70 regs
->r0
, regs
->r1
, regs
->r2
);
71 printk("t2 = %016lx t3 = %016lx t4 = %016lx\n",
72 regs
->r3
, regs
->r4
, regs
->r5
);
73 printk("t5 = %016lx t6 = %016lx t7 = %016lx\n",
74 regs
->r6
, regs
->r7
, regs
->r8
);
77 printk("s0 = %016lx s1 = %016lx s2 = %016lx\n",
78 r9_15
[9], r9_15
[10], r9_15
[11]);
79 printk("s3 = %016lx s4 = %016lx s5 = %016lx\n",
80 r9_15
[12], r9_15
[13], r9_15
[14]);
81 printk("s6 = %016lx\n", r9_15
[15]);
84 printk("a0 = %016lx a1 = %016lx a2 = %016lx\n",
85 regs
->r16
, regs
->r17
, regs
->r18
);
86 printk("a3 = %016lx a4 = %016lx a5 = %016lx\n",
87 regs
->r19
, regs
->r20
, regs
->r21
);
88 printk("t8 = %016lx t9 = %016lx t10= %016lx\n",
89 regs
->r22
, regs
->r23
, regs
->r24
);
90 printk("t11= %016lx pv = %016lx at = %016lx\n",
91 regs
->r25
, regs
->r27
, regs
->r28
);
92 printk("gp = %016lx sp = %p\n", regs
->gp
, regs
+1);
99 static char * ireg_name
[] = {"v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6",
100 "t7", "s0", "s1", "s2", "s3", "s4", "s5", "s6",
101 "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9",
102 "t10", "t11", "ra", "pv", "at", "gp", "sp", "zero"};
106 dik_show_code(unsigned int *pc
)
111 for (i
= -6; i
< 2; i
++) {
113 if (__get_user(insn
, (unsigned int __user
*)pc
+ i
))
115 printk("%c%08x%c", i
? ' ' : '<', insn
, i
? ' ' : '>');
121 dik_show_trace(unsigned long *sp
)
125 while (0x1ff8 & (unsigned long) sp
) {
126 extern char _stext
[], _etext
[];
127 unsigned long tmp
= *sp
;
129 if (tmp
< (unsigned long) &_stext
)
131 if (tmp
>= (unsigned long) &_etext
)
133 printk("[<%lx>]", tmp
);
134 print_symbol(" %s", tmp
);
144 static int kstack_depth_to_print
= 24;
146 void show_stack(struct task_struct
*task
, unsigned long *sp
)
148 unsigned long *stack
;
152 * debugging aid: "show_stack(NULL);" prints the
153 * back trace for this cpu.
156 sp
=(unsigned long*)&sp
;
159 for(i
=0; i
< kstack_depth_to_print
; i
++) {
160 if (((long) stack
& (THREAD_SIZE
-1)) == 0)
162 if (i
&& ((i
% 4) == 0))
164 printk("%016lx ", *stack
++);
170 void dump_stack(void)
172 show_stack(NULL
, NULL
);
175 EXPORT_SYMBOL(dump_stack
);
178 die_if_kernel(char * str
, struct pt_regs
*regs
, long err
, unsigned long *r9_15
)
183 printk("CPU %d ", hard_smp_processor_id());
185 printk("%s(%d): %s %ld\n", current
->comm
, task_pid_nr(current
), str
, err
);
186 dik_show_regs(regs
, r9_15
);
187 add_taint(TAINT_DIE
);
188 dik_show_trace((unsigned long *)(regs
+1));
189 dik_show_code((unsigned int *)regs
->pc
);
191 if (test_and_set_thread_flag (TIF_DIE_IF_KERNEL
)) {
192 printk("die_if_kernel recursion detected.\n");
199 #ifndef CONFIG_MATHEMU
200 static long dummy_emul(void) { return 0; }
201 long (*alpha_fp_emul_imprecise
)(struct pt_regs
*regs
, unsigned long writemask
)
202 = (void *)dummy_emul
;
203 long (*alpha_fp_emul
) (unsigned long pc
)
204 = (void *)dummy_emul
;
206 long alpha_fp_emul_imprecise(struct pt_regs
*regs
, unsigned long writemask
);
207 long alpha_fp_emul (unsigned long pc
);
211 do_entArith(unsigned long summary
, unsigned long write_mask
,
212 struct pt_regs
*regs
)
214 long si_code
= FPE_FLTINV
;
218 /* Software-completion summary bit is set, so try to
219 emulate the instruction. If the processor supports
220 precise exceptions, we don't have to search. */
221 if (!amask(AMASK_PRECISE_TRAP
))
222 si_code
= alpha_fp_emul(regs
->pc
- 4);
224 si_code
= alpha_fp_emul_imprecise(regs
, write_mask
);
228 die_if_kernel("Arithmetic fault", regs
, 0, NULL
);
230 info
.si_signo
= SIGFPE
;
232 info
.si_code
= si_code
;
233 info
.si_addr
= (void __user
*) regs
->pc
;
234 send_sig_info(SIGFPE
, &info
, current
);
238 do_entIF(unsigned long type
, struct pt_regs
*regs
)
243 if ((regs
->ps
& ~IPL_MAX
) == 0) {
245 const unsigned int *data
246 = (const unsigned int *) regs
->pc
;
247 printk("Kernel bug at %s:%d\n",
248 (const char *)(data
[1] | (long)data
[2] << 32),
251 die_if_kernel((type
== 1 ? "Kernel Bug" : "Instruction fault"),
256 case 0: /* breakpoint */
257 info
.si_signo
= SIGTRAP
;
259 info
.si_code
= TRAP_BRKPT
;
261 info
.si_addr
= (void __user
*) regs
->pc
;
263 if (ptrace_cancel_bpt(current
)) {
264 regs
->pc
-= 4; /* make pc point to former bpt */
267 send_sig_info(SIGTRAP
, &info
, current
);
270 case 1: /* bugcheck */
271 info
.si_signo
= SIGTRAP
;
273 info
.si_code
= __SI_FAULT
;
274 info
.si_addr
= (void __user
*) regs
->pc
;
276 send_sig_info(SIGTRAP
, &info
, current
);
279 case 2: /* gentrap */
280 info
.si_addr
= (void __user
*) regs
->pc
;
281 info
.si_trapno
= regs
->r16
;
282 switch ((long) regs
->r16
) {
339 info
.si_signo
= signo
;
342 info
.si_addr
= (void __user
*) regs
->pc
;
343 send_sig_info(signo
, &info
, current
);
347 if (implver() == IMPLVER_EV4
) {
350 /* The some versions of SRM do not handle
351 the opDEC properly - they return the PC of the
352 opDEC fault, not the instruction after as the
353 Alpha architecture requires. Here we fix it up.
354 We do this by intentionally causing an opDEC
355 fault during the boot sequence and testing if
356 we get the correct PC. If not, we set a flag
357 to correct it every time through. */
358 regs
->pc
+= opDEC_fix
;
360 /* EV4 does not implement anything except normal
361 rounding. Everything else will come here as
362 an illegal instruction. Emulate them. */
363 si_code
= alpha_fp_emul(regs
->pc
- 4);
367 info
.si_signo
= SIGFPE
;
369 info
.si_code
= si_code
;
370 info
.si_addr
= (void __user
*) regs
->pc
;
371 send_sig_info(SIGFPE
, &info
, current
);
377 case 3: /* FEN fault */
378 /* Irritating users can call PAL_clrfen to disable the
379 FPU for the process. The kernel will then trap in
380 do_switch_stack and undo_switch_stack when we try
381 to save and restore the FP registers.
383 Given that GCC by default generates code that uses the
384 FP registers, PAL_clrfen is not useful except for DoS
385 attacks. So turn the bleeding FPU back on and be done
387 current_thread_info()->pcb
.flags
|= 1;
388 __reload_thread(¤t_thread_info()->pcb
);
392 default: /* unexpected instruction-fault type */
396 info
.si_signo
= SIGILL
;
398 info
.si_code
= ILL_ILLOPC
;
399 info
.si_addr
= (void __user
*) regs
->pc
;
400 send_sig_info(SIGILL
, &info
, current
);
403 /* There is an ifdef in the PALcode in MILO that enables a
404 "kernel debugging entry point" as an unprivileged call_pal.
406 We don't want to have anything to do with it, but unfortunately
407 several versions of MILO included in distributions have it enabled,
408 and if we don't put something on the entry point we'll oops. */
411 do_entDbg(struct pt_regs
*regs
)
415 die_if_kernel("Instruction fault", regs
, 0, NULL
);
417 info
.si_signo
= SIGILL
;
419 info
.si_code
= ILL_ILLOPC
;
420 info
.si_addr
= (void __user
*) regs
->pc
;
421 force_sig_info(SIGILL
, &info
, current
);
426 * entUna has a different register layout to be reasonably simple. It
427 * needs access to all the integer registers (the kernel doesn't use
428 * fp-regs), and it needs to have them in order for simpler access.
430 * Due to the non-standard register layout (and because we don't want
431 * to handle floating-point regs), user-mode unaligned accesses are
432 * handled separately by do_entUnaUser below.
434 * Oh, btw, we don't handle the "gp" register correctly, but if we fault
435 * on a gp-register unaligned load/store, something is _very_ wrong
436 * in the kernel anyway..
439 unsigned long regs
[32];
440 unsigned long ps
, pc
, gp
, a0
, a1
, a2
;
443 struct unaligned_stat
{
444 unsigned long count
, va
, pc
;
448 /* Macro for exception fixup code to access integer registers. */
449 #define una_reg(r) (regs->regs[(r) >= 16 && (r) <= 18 ? (r)+19 : (r)])
453 do_entUna(void * va
, unsigned long opcode
, unsigned long reg
,
454 struct allregs
*regs
)
456 long error
, tmp1
, tmp2
, tmp3
, tmp4
;
457 unsigned long pc
= regs
->pc
- 4;
458 const struct exception_table_entry
*fixup
;
460 unaligned
[0].count
++;
461 unaligned
[0].va
= (unsigned long) va
;
462 unaligned
[0].pc
= pc
;
464 /* We don't want to use the generic get/put unaligned macros as
465 we want to trap exceptions. Only if we actually get an
466 exception will we decide whether we should have caught it. */
469 case 0x0c: /* ldwu */
470 __asm__
__volatile__(
471 "1: ldq_u %1,0(%3)\n"
472 "2: ldq_u %2,1(%3)\n"
476 ".section __ex_table,\"a\"\n"
478 " lda %1,3b-1b(%0)\n"
480 " lda %2,3b-2b(%0)\n"
482 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
486 una_reg(reg
) = tmp1
|tmp2
;
490 __asm__
__volatile__(
491 "1: ldq_u %1,0(%3)\n"
492 "2: ldq_u %2,3(%3)\n"
496 ".section __ex_table,\"a\"\n"
498 " lda %1,3b-1b(%0)\n"
500 " lda %2,3b-2b(%0)\n"
502 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
506 una_reg(reg
) = (int)(tmp1
|tmp2
);
510 __asm__
__volatile__(
511 "1: ldq_u %1,0(%3)\n"
512 "2: ldq_u %2,7(%3)\n"
516 ".section __ex_table,\"a\"\n"
518 " lda %1,3b-1b(%0)\n"
520 " lda %2,3b-2b(%0)\n"
522 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
526 una_reg(reg
) = tmp1
|tmp2
;
529 /* Note that the store sequences do not indicate that they change
530 memory because it _should_ be affecting nothing in this context.
531 (Otherwise we have other, much larger, problems.) */
533 __asm__
__volatile__(
534 "1: ldq_u %2,1(%5)\n"
535 "2: ldq_u %1,0(%5)\n"
542 "3: stq_u %2,1(%5)\n"
543 "4: stq_u %1,0(%5)\n"
545 ".section __ex_table,\"a\"\n"
547 " lda %2,5b-1b(%0)\n"
549 " lda %1,5b-2b(%0)\n"
551 " lda $31,5b-3b(%0)\n"
553 " lda $31,5b-4b(%0)\n"
555 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
),
556 "=&r"(tmp3
), "=&r"(tmp4
)
557 : "r"(va
), "r"(una_reg(reg
)), "0"(0));
563 __asm__
__volatile__(
564 "1: ldq_u %2,3(%5)\n"
565 "2: ldq_u %1,0(%5)\n"
572 "3: stq_u %2,3(%5)\n"
573 "4: stq_u %1,0(%5)\n"
575 ".section __ex_table,\"a\"\n"
577 " lda %2,5b-1b(%0)\n"
579 " lda %1,5b-2b(%0)\n"
581 " lda $31,5b-3b(%0)\n"
583 " lda $31,5b-4b(%0)\n"
585 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
),
586 "=&r"(tmp3
), "=&r"(tmp4
)
587 : "r"(va
), "r"(una_reg(reg
)), "0"(0));
593 __asm__
__volatile__(
594 "1: ldq_u %2,7(%5)\n"
595 "2: ldq_u %1,0(%5)\n"
602 "3: stq_u %2,7(%5)\n"
603 "4: stq_u %1,0(%5)\n"
605 ".section __ex_table,\"a\"\n\t"
607 " lda %2,5b-1b(%0)\n"
609 " lda %1,5b-2b(%0)\n"
611 " lda $31,5b-3b(%0)\n"
613 " lda $31,5b-4b(%0)\n"
615 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
),
616 "=&r"(tmp3
), "=&r"(tmp4
)
617 : "r"(va
), "r"(una_reg(reg
)), "0"(0));
624 printk("Bad unaligned kernel access at %016lx: %p %lx %ld\n",
625 pc
, va
, opcode
, reg
);
629 /* Ok, we caught the exception, but we don't want it. Is there
630 someone to pass it along to? */
631 if ((fixup
= search_exception_tables(pc
)) != 0) {
633 newpc
= fixup_exception(una_reg
, fixup
, pc
);
635 printk("Forwarding unaligned exception at %lx (%lx)\n",
643 * Yikes! No one to forward the exception to.
644 * Since the registers are in a weird format, dump them ourselves.
648 printk("%s(%d): unhandled unaligned exception\n",
649 current
->comm
, task_pid_nr(current
));
651 printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx\n",
652 pc
, una_reg(26), regs
->ps
);
653 printk("r0 = %016lx r1 = %016lx r2 = %016lx\n",
654 una_reg(0), una_reg(1), una_reg(2));
655 printk("r3 = %016lx r4 = %016lx r5 = %016lx\n",
656 una_reg(3), una_reg(4), una_reg(5));
657 printk("r6 = %016lx r7 = %016lx r8 = %016lx\n",
658 una_reg(6), una_reg(7), una_reg(8));
659 printk("r9 = %016lx r10= %016lx r11= %016lx\n",
660 una_reg(9), una_reg(10), una_reg(11));
661 printk("r12= %016lx r13= %016lx r14= %016lx\n",
662 una_reg(12), una_reg(13), una_reg(14));
663 printk("r15= %016lx\n", una_reg(15));
664 printk("r16= %016lx r17= %016lx r18= %016lx\n",
665 una_reg(16), una_reg(17), una_reg(18));
666 printk("r19= %016lx r20= %016lx r21= %016lx\n",
667 una_reg(19), una_reg(20), una_reg(21));
668 printk("r22= %016lx r23= %016lx r24= %016lx\n",
669 una_reg(22), una_reg(23), una_reg(24));
670 printk("r25= %016lx r27= %016lx r28= %016lx\n",
671 una_reg(25), una_reg(27), una_reg(28));
672 printk("gp = %016lx sp = %p\n", regs
->gp
, regs
+1);
674 dik_show_code((unsigned int *)pc
);
675 dik_show_trace((unsigned long *)(regs
+1));
677 if (test_and_set_thread_flag (TIF_DIE_IF_KERNEL
)) {
678 printk("die_if_kernel recursion detected.\n");
686 * Convert an s-floating point value in memory format to the
687 * corresponding value in register format. The exponent
688 * needs to be remapped to preserve non-finite values
689 * (infinities, not-a-numbers, denormals).
691 static inline unsigned long
692 s_mem_to_reg (unsigned long s_mem
)
694 unsigned long frac
= (s_mem
>> 0) & 0x7fffff;
695 unsigned long sign
= (s_mem
>> 31) & 0x1;
696 unsigned long exp_msb
= (s_mem
>> 30) & 0x1;
697 unsigned long exp_low
= (s_mem
>> 23) & 0x7f;
700 exp
= (exp_msb
<< 10) | exp_low
; /* common case */
702 if (exp_low
== 0x7f) {
706 if (exp_low
== 0x00) {
712 return (sign
<< 63) | (exp
<< 52) | (frac
<< 29);
716 * Convert an s-floating point value in register format to the
717 * corresponding value in memory format.
719 static inline unsigned long
720 s_reg_to_mem (unsigned long s_reg
)
722 return ((s_reg
>> 62) << 30) | ((s_reg
<< 5) >> 34);
726 * Handle user-level unaligned fault. Handling user-level unaligned
727 * faults is *extremely* slow and produces nasty messages. A user
728 * program *should* fix unaligned faults ASAP.
730 * Notice that we have (almost) the regular kernel stack layout here,
731 * so finding the appropriate registers is a little more difficult
732 * than in the kernel case.
734 * Finally, we handle regular integer load/stores only. In
735 * particular, load-linked/store-conditionally and floating point
736 * load/stores are not supported. The former make no sense with
737 * unaligned faults (they are guaranteed to fail) and I don't think
738 * the latter will occur in any decent program.
740 * Sigh. We *do* have to handle some FP operations, because GCC will
741 * uses them as temporary storage for integer memory to memory copies.
742 * However, we need to deal with stt/ldt and sts/lds only.
745 #define OP_INT_MASK ( 1L << 0x28 | 1L << 0x2c /* ldl stl */ \
746 | 1L << 0x29 | 1L << 0x2d /* ldq stq */ \
747 | 1L << 0x0c | 1L << 0x0d /* ldwu stw */ \
748 | 1L << 0x0a | 1L << 0x0e ) /* ldbu stb */
750 #define OP_WRITE_MASK ( 1L << 0x26 | 1L << 0x27 /* sts stt */ \
751 | 1L << 0x2c | 1L << 0x2d /* stl stq */ \
752 | 1L << 0x0d | 1L << 0x0e ) /* stw stb */
754 #define R(x) ((size_t) &((struct pt_regs *)0)->x)
756 static int unauser_reg_offsets
[32] = {
757 R(r0
), R(r1
), R(r2
), R(r3
), R(r4
), R(r5
), R(r6
), R(r7
), R(r8
),
758 /* r9 ... r15 are stored in front of regs. */
759 -56, -48, -40, -32, -24, -16, -8,
760 R(r16
), R(r17
), R(r18
),
761 R(r19
), R(r20
), R(r21
), R(r22
), R(r23
), R(r24
), R(r25
), R(r26
),
762 R(r27
), R(r28
), R(gp
),
769 do_entUnaUser(void __user
* va
, unsigned long opcode
,
770 unsigned long reg
, struct pt_regs
*regs
)
773 static long last_time
= 0;
775 unsigned long tmp1
, tmp2
, tmp3
, tmp4
;
776 unsigned long fake_reg
, *reg_addr
= &fake_reg
;
780 /* Check the UAC bits to decide what the user wants us to do
781 with the unaliged access. */
783 if (!test_thread_flag (TIF_UAC_NOPRINT
)) {
784 if (cnt
>= 5 && jiffies
- last_time
> 5*HZ
) {
788 printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n",
789 current
->comm
, task_pid_nr(current
),
790 regs
->pc
- 4, va
, opcode
, reg
);
794 if (test_thread_flag (TIF_UAC_SIGBUS
))
796 /* Not sure why you'd want to use this, but... */
797 if (test_thread_flag (TIF_UAC_NOFIX
))
800 /* Don't bother reading ds in the access check since we already
801 know that this came from the user. Also rely on the fact that
802 the page at TASK_SIZE is unmapped and so can't be touched anyway. */
803 if (!__access_ok((unsigned long)va
, 0, USER_DS
))
806 ++unaligned
[1].count
;
807 unaligned
[1].va
= (unsigned long)va
;
808 unaligned
[1].pc
= regs
->pc
- 4;
810 if ((1L << opcode
) & OP_INT_MASK
) {
811 /* it's an integer load/store */
813 reg_addr
= (unsigned long *)
814 ((char *)regs
+ unauser_reg_offsets
[reg
]);
815 } else if (reg
== 30) {
816 /* usp in PAL regs */
819 /* zero "register" */
824 /* We don't want to use the generic get/put unaligned macros as
825 we want to trap exceptions. Only if we actually get an
826 exception will we decide whether we should have caught it. */
829 case 0x0c: /* ldwu */
830 __asm__
__volatile__(
831 "1: ldq_u %1,0(%3)\n"
832 "2: ldq_u %2,1(%3)\n"
836 ".section __ex_table,\"a\"\n"
838 " lda %1,3b-1b(%0)\n"
840 " lda %2,3b-2b(%0)\n"
842 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
846 *reg_addr
= tmp1
|tmp2
;
850 __asm__
__volatile__(
851 "1: ldq_u %1,0(%3)\n"
852 "2: ldq_u %2,3(%3)\n"
856 ".section __ex_table,\"a\"\n"
858 " lda %1,3b-1b(%0)\n"
860 " lda %2,3b-2b(%0)\n"
862 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
866 alpha_write_fp_reg(reg
, s_mem_to_reg((int)(tmp1
|tmp2
)));
870 __asm__
__volatile__(
871 "1: ldq_u %1,0(%3)\n"
872 "2: ldq_u %2,7(%3)\n"
876 ".section __ex_table,\"a\"\n"
878 " lda %1,3b-1b(%0)\n"
880 " lda %2,3b-2b(%0)\n"
882 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
886 alpha_write_fp_reg(reg
, tmp1
|tmp2
);
890 __asm__
__volatile__(
891 "1: ldq_u %1,0(%3)\n"
892 "2: ldq_u %2,3(%3)\n"
896 ".section __ex_table,\"a\"\n"
898 " lda %1,3b-1b(%0)\n"
900 " lda %2,3b-2b(%0)\n"
902 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
906 *reg_addr
= (int)(tmp1
|tmp2
);
910 __asm__
__volatile__(
911 "1: ldq_u %1,0(%3)\n"
912 "2: ldq_u %2,7(%3)\n"
916 ".section __ex_table,\"a\"\n"
918 " lda %1,3b-1b(%0)\n"
920 " lda %2,3b-2b(%0)\n"
922 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
926 *reg_addr
= tmp1
|tmp2
;
929 /* Note that the store sequences do not indicate that they change
930 memory because it _should_ be affecting nothing in this context.
931 (Otherwise we have other, much larger, problems.) */
933 __asm__
__volatile__(
934 "1: ldq_u %2,1(%5)\n"
935 "2: ldq_u %1,0(%5)\n"
942 "3: stq_u %2,1(%5)\n"
943 "4: stq_u %1,0(%5)\n"
945 ".section __ex_table,\"a\"\n"
947 " lda %2,5b-1b(%0)\n"
949 " lda %1,5b-2b(%0)\n"
951 " lda $31,5b-3b(%0)\n"
953 " lda $31,5b-4b(%0)\n"
955 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
),
956 "=&r"(tmp3
), "=&r"(tmp4
)
957 : "r"(va
), "r"(*reg_addr
), "0"(0));
963 fake_reg
= s_reg_to_mem(alpha_read_fp_reg(reg
));
967 __asm__
__volatile__(
968 "1: ldq_u %2,3(%5)\n"
969 "2: ldq_u %1,0(%5)\n"
976 "3: stq_u %2,3(%5)\n"
977 "4: stq_u %1,0(%5)\n"
979 ".section __ex_table,\"a\"\n"
981 " lda %2,5b-1b(%0)\n"
983 " lda %1,5b-2b(%0)\n"
985 " lda $31,5b-3b(%0)\n"
987 " lda $31,5b-4b(%0)\n"
989 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
),
990 "=&r"(tmp3
), "=&r"(tmp4
)
991 : "r"(va
), "r"(*reg_addr
), "0"(0));
997 fake_reg
= alpha_read_fp_reg(reg
);
1000 case 0x2d: /* stq */
1001 __asm__
__volatile__(
1002 "1: ldq_u %2,7(%5)\n"
1003 "2: ldq_u %1,0(%5)\n"
1010 "3: stq_u %2,7(%5)\n"
1011 "4: stq_u %1,0(%5)\n"
1013 ".section __ex_table,\"a\"\n\t"
1015 " lda %2,5b-1b(%0)\n"
1017 " lda %1,5b-2b(%0)\n"
1019 " lda $31,5b-3b(%0)\n"
1021 " lda $31,5b-4b(%0)\n"
1023 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
),
1024 "=&r"(tmp3
), "=&r"(tmp4
)
1025 : "r"(va
), "r"(*reg_addr
), "0"(0));
1031 /* What instruction were you trying to use, exactly? */
1035 /* Only integer loads should get here; everyone else returns early. */
1041 regs
->pc
-= 4; /* make pc point to faulting insn */
1042 info
.si_signo
= SIGSEGV
;
1045 /* We need to replicate some of the logic in mm/fault.c,
1046 since we don't have access to the fault code in the
1047 exception handling return path. */
1048 if (!__access_ok((unsigned long)va
, 0, USER_DS
))
1049 info
.si_code
= SEGV_ACCERR
;
1051 struct mm_struct
*mm
= current
->mm
;
1052 down_read(&mm
->mmap_sem
);
1053 if (find_vma(mm
, (unsigned long)va
))
1054 info
.si_code
= SEGV_ACCERR
;
1056 info
.si_code
= SEGV_MAPERR
;
1057 up_read(&mm
->mmap_sem
);
1060 send_sig_info(SIGSEGV
, &info
, current
);
1065 info
.si_signo
= SIGBUS
;
1067 info
.si_code
= BUS_ADRALN
;
1069 send_sig_info(SIGBUS
, &info
, current
);
1076 /* Tell PAL-code what global pointer we want in the kernel. */
1077 register unsigned long gptr
__asm__("$29");
1080 /* Hack for Multia (UDB) and JENSEN: some of their SRMs have
1081 a bug in the handling of the opDEC fault. Fix it up if so. */
1082 if (implver() == IMPLVER_EV4
)