1 // SPDX-License-Identifier: GPL-2.0
3 * arch/alpha/kernel/traps.c
5 * (C) Copyright 1994 Linus Torvalds
9 * This file initializes the trap entry points
12 #include <linux/jiffies.h>
14 #include <linux/sched/signal.h>
15 #include <linux/sched/debug.h>
16 #include <linux/tty.h>
17 #include <linux/delay.h>
18 #include <linux/extable.h>
19 #include <linux/kallsyms.h>
20 #include <linux/ratelimit.h>
22 #include <asm/gentrap.h>
23 #include <linux/uaccess.h>
24 #include <asm/unaligned.h>
25 #include <asm/sysinfo.h>
26 #include <asm/hwrpb.h>
27 #include <asm/mmu_context.h>
28 #include <asm/special_insns.h>
32 /* Work-around for some SRMs which mishandle opDEC faults. */
39 __asm__
__volatile__ (
40 /* Load the address of... */
42 /* A stub instruction fault handler. Just add 4 to the
48 /* Install the instruction fault handler. */
50 " call_pal %[wrent]\n"
51 /* With that in place, the fault from the round-to-minf fp
52 insn will arrive either at the "lda 4" insn (bad) or one
53 past that (good). This places the correct fixup in %0. */
55 " cvttq/svm $f31,$f31\n"
57 : [fix
] "=r" (opDEC_fix
)
58 : [rti
] "n" (PAL_rti
), [wrent
] "n" (PAL_wrent
)
59 : "$0", "$1", "$16", "$17", "$22", "$23", "$24", "$25");
62 printk("opDEC fixup enabled.\n");
66 dik_show_regs(struct pt_regs
*regs
, unsigned long *r9_15
)
68 printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx %s\n",
69 regs
->pc
, regs
->r26
, regs
->ps
, print_tainted());
70 printk("pc is at %pSR\n", (void *)regs
->pc
);
71 printk("ra is at %pSR\n", (void *)regs
->r26
);
72 printk("v0 = %016lx t0 = %016lx t1 = %016lx\n",
73 regs
->r0
, regs
->r1
, regs
->r2
);
74 printk("t2 = %016lx t3 = %016lx t4 = %016lx\n",
75 regs
->r3
, regs
->r4
, regs
->r5
);
76 printk("t5 = %016lx t6 = %016lx t7 = %016lx\n",
77 regs
->r6
, regs
->r7
, regs
->r8
);
80 printk("s0 = %016lx s1 = %016lx s2 = %016lx\n",
81 r9_15
[9], r9_15
[10], r9_15
[11]);
82 printk("s3 = %016lx s4 = %016lx s5 = %016lx\n",
83 r9_15
[12], r9_15
[13], r9_15
[14]);
84 printk("s6 = %016lx\n", r9_15
[15]);
87 printk("a0 = %016lx a1 = %016lx a2 = %016lx\n",
88 regs
->r16
, regs
->r17
, regs
->r18
);
89 printk("a3 = %016lx a4 = %016lx a5 = %016lx\n",
90 regs
->r19
, regs
->r20
, regs
->r21
);
91 printk("t8 = %016lx t9 = %016lx t10= %016lx\n",
92 regs
->r22
, regs
->r23
, regs
->r24
);
93 printk("t11= %016lx pv = %016lx at = %016lx\n",
94 regs
->r25
, regs
->r27
, regs
->r28
);
95 printk("gp = %016lx sp = %p\n", regs
->gp
, regs
+1);
102 static char * ireg_name
[] = {"v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6",
103 "t7", "s0", "s1", "s2", "s3", "s4", "s5", "s6",
104 "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9",
105 "t10", "t11", "ra", "pv", "at", "gp", "sp", "zero"};
109 dik_show_code(unsigned int *pc
)
114 for (i
= -6; i
< 2; i
++) {
116 if (__get_user(insn
, (unsigned int __user
*)pc
+ i
))
118 printk("%c%08x%c", i
? ' ' : '<', insn
, i
? ' ' : '>');
124 dik_show_trace(unsigned long *sp
)
128 while (0x1ff8 & (unsigned long) sp
) {
129 extern char _stext
[], _etext
[];
130 unsigned long tmp
= *sp
;
132 if (tmp
< (unsigned long) &_stext
)
134 if (tmp
>= (unsigned long) &_etext
)
136 printk("[<%lx>] %pSR\n", tmp
, (void *)tmp
);
145 static int kstack_depth_to_print
= 24;
147 void show_stack(struct task_struct
*task
, unsigned long *sp
)
149 unsigned long *stack
;
153 * debugging aid: "show_stack(NULL);" prints the
154 * back trace for this cpu.
157 sp
=(unsigned long*)&sp
;
160 for(i
=0; i
< kstack_depth_to_print
; i
++) {
161 if (((long) stack
& (THREAD_SIZE
-1)) == 0)
170 pr_cont("%016lx", *stack
++);
177 die_if_kernel(char * str
, struct pt_regs
*regs
, long err
, unsigned long *r9_15
)
182 printk("CPU %d ", hard_smp_processor_id());
184 printk("%s(%d): %s %ld\n", current
->comm
, task_pid_nr(current
), str
, err
);
185 dik_show_regs(regs
, r9_15
);
186 add_taint(TAINT_DIE
, LOCKDEP_NOW_UNRELIABLE
);
187 dik_show_trace((unsigned long *)(regs
+1));
188 dik_show_code((unsigned int *)regs
->pc
);
190 if (test_and_set_thread_flag (TIF_DIE_IF_KERNEL
)) {
191 printk("die_if_kernel recursion detected.\n");
198 #ifndef CONFIG_MATHEMU
199 static long dummy_emul(void) { return 0; }
200 long (*alpha_fp_emul_imprecise
)(struct pt_regs
*regs
, unsigned long writemask
)
201 = (void *)dummy_emul
;
202 EXPORT_SYMBOL_GPL(alpha_fp_emul_imprecise
);
203 long (*alpha_fp_emul
) (unsigned long pc
)
204 = (void *)dummy_emul
;
205 EXPORT_SYMBOL_GPL(alpha_fp_emul
);
207 long alpha_fp_emul_imprecise(struct pt_regs
*regs
, unsigned long writemask
);
208 long alpha_fp_emul (unsigned long pc
);
212 do_entArith(unsigned long summary
, unsigned long write_mask
,
213 struct pt_regs
*regs
)
215 long si_code
= FPE_FLTINV
;
219 /* Software-completion summary bit is set, so try to
220 emulate the instruction. If the processor supports
221 precise exceptions, we don't have to search. */
222 if (!amask(AMASK_PRECISE_TRAP
))
223 si_code
= alpha_fp_emul(regs
->pc
- 4);
225 si_code
= alpha_fp_emul_imprecise(regs
, write_mask
);
229 die_if_kernel("Arithmetic fault", regs
, 0, NULL
);
231 info
.si_signo
= SIGFPE
;
233 info
.si_code
= si_code
;
234 info
.si_addr
= (void __user
*) regs
->pc
;
235 send_sig_info(SIGFPE
, &info
, current
);
239 do_entIF(unsigned long type
, struct pt_regs
*regs
)
244 if ((regs
->ps
& ~IPL_MAX
) == 0) {
246 const unsigned int *data
247 = (const unsigned int *) regs
->pc
;
248 printk("Kernel bug at %s:%d\n",
249 (const char *)(data
[1] | (long)data
[2] << 32),
252 #ifdef CONFIG_ALPHA_WTINT
254 /* If CALL_PAL WTINT is totally unsupported by the
255 PALcode, e.g. MILO, "emulate" it by overwriting
258 = (unsigned int *) regs
->pc
- 1;
259 if (*pinsn
== PAL_wtint
) {
260 *pinsn
= 0x47e01400; /* mov 0,$0 */
266 #endif /* ALPHA_WTINT */
267 die_if_kernel((type
== 1 ? "Kernel Bug" : "Instruction fault"),
272 case 0: /* breakpoint */
273 info
.si_signo
= SIGTRAP
;
275 info
.si_code
= TRAP_BRKPT
;
277 info
.si_addr
= (void __user
*) regs
->pc
;
279 if (ptrace_cancel_bpt(current
)) {
280 regs
->pc
-= 4; /* make pc point to former bpt */
283 send_sig_info(SIGTRAP
, &info
, current
);
286 case 1: /* bugcheck */
287 info
.si_signo
= SIGTRAP
;
289 info
.si_code
= TRAP_FIXME
;
290 info
.si_addr
= (void __user
*) regs
->pc
;
292 send_sig_info(SIGTRAP
, &info
, current
);
295 case 2: /* gentrap */
296 info
.si_addr
= (void __user
*) regs
->pc
;
297 info
.si_trapno
= regs
->r16
;
298 switch ((long) regs
->r16
) {
355 info
.si_signo
= signo
;
358 info
.si_addr
= (void __user
*) regs
->pc
;
359 send_sig_info(signo
, &info
, current
);
363 if (implver() == IMPLVER_EV4
) {
366 /* The some versions of SRM do not handle
367 the opDEC properly - they return the PC of the
368 opDEC fault, not the instruction after as the
369 Alpha architecture requires. Here we fix it up.
370 We do this by intentionally causing an opDEC
371 fault during the boot sequence and testing if
372 we get the correct PC. If not, we set a flag
373 to correct it every time through. */
374 regs
->pc
+= opDEC_fix
;
376 /* EV4 does not implement anything except normal
377 rounding. Everything else will come here as
378 an illegal instruction. Emulate them. */
379 si_code
= alpha_fp_emul(regs
->pc
- 4);
383 info
.si_signo
= SIGFPE
;
385 info
.si_code
= si_code
;
386 info
.si_addr
= (void __user
*) regs
->pc
;
387 send_sig_info(SIGFPE
, &info
, current
);
393 case 3: /* FEN fault */
394 /* Irritating users can call PAL_clrfen to disable the
395 FPU for the process. The kernel will then trap in
396 do_switch_stack and undo_switch_stack when we try
397 to save and restore the FP registers.
399 Given that GCC by default generates code that uses the
400 FP registers, PAL_clrfen is not useful except for DoS
401 attacks. So turn the bleeding FPU back on and be done
403 current_thread_info()->pcb
.flags
|= 1;
404 __reload_thread(¤t_thread_info()->pcb
);
408 default: /* unexpected instruction-fault type */
412 info
.si_signo
= SIGILL
;
414 info
.si_code
= ILL_ILLOPC
;
415 info
.si_addr
= (void __user
*) regs
->pc
;
416 send_sig_info(SIGILL
, &info
, current
);
419 /* There is an ifdef in the PALcode in MILO that enables a
420 "kernel debugging entry point" as an unprivileged call_pal.
422 We don't want to have anything to do with it, but unfortunately
423 several versions of MILO included in distributions have it enabled,
424 and if we don't put something on the entry point we'll oops. */
427 do_entDbg(struct pt_regs
*regs
)
431 die_if_kernel("Instruction fault", regs
, 0, NULL
);
433 info
.si_signo
= SIGILL
;
435 info
.si_code
= ILL_ILLOPC
;
436 info
.si_addr
= (void __user
*) regs
->pc
;
437 force_sig_info(SIGILL
, &info
, current
);
442 * entUna has a different register layout to be reasonably simple. It
443 * needs access to all the integer registers (the kernel doesn't use
444 * fp-regs), and it needs to have them in order for simpler access.
446 * Due to the non-standard register layout (and because we don't want
447 * to handle floating-point regs), user-mode unaligned accesses are
448 * handled separately by do_entUnaUser below.
450 * Oh, btw, we don't handle the "gp" register correctly, but if we fault
451 * on a gp-register unaligned load/store, something is _very_ wrong
452 * in the kernel anyway..
455 unsigned long regs
[32];
456 unsigned long ps
, pc
, gp
, a0
, a1
, a2
;
459 struct unaligned_stat
{
460 unsigned long count
, va
, pc
;
464 /* Macro for exception fixup code to access integer registers. */
465 #define una_reg(r) (_regs[(r) >= 16 && (r) <= 18 ? (r)+19 : (r)])
469 do_entUna(void * va
, unsigned long opcode
, unsigned long reg
,
470 struct allregs
*regs
)
472 long error
, tmp1
, tmp2
, tmp3
, tmp4
;
473 unsigned long pc
= regs
->pc
- 4;
474 unsigned long *_regs
= regs
->regs
;
475 const struct exception_table_entry
*fixup
;
477 unaligned
[0].count
++;
478 unaligned
[0].va
= (unsigned long) va
;
479 unaligned
[0].pc
= pc
;
481 /* We don't want to use the generic get/put unaligned macros as
482 we want to trap exceptions. Only if we actually get an
483 exception will we decide whether we should have caught it. */
486 case 0x0c: /* ldwu */
487 __asm__
__volatile__(
488 "1: ldq_u %1,0(%3)\n"
489 "2: ldq_u %2,1(%3)\n"
495 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
499 una_reg(reg
) = tmp1
|tmp2
;
503 __asm__
__volatile__(
504 "1: ldq_u %1,0(%3)\n"
505 "2: ldq_u %2,3(%3)\n"
511 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
515 una_reg(reg
) = (int)(tmp1
|tmp2
);
519 __asm__
__volatile__(
520 "1: ldq_u %1,0(%3)\n"
521 "2: ldq_u %2,7(%3)\n"
527 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
531 una_reg(reg
) = tmp1
|tmp2
;
534 /* Note that the store sequences do not indicate that they change
535 memory because it _should_ be affecting nothing in this context.
536 (Otherwise we have other, much larger, problems.) */
538 __asm__
__volatile__(
539 "1: ldq_u %2,1(%5)\n"
540 "2: ldq_u %1,0(%5)\n"
547 "3: stq_u %2,1(%5)\n"
548 "4: stq_u %1,0(%5)\n"
554 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
),
555 "=&r"(tmp3
), "=&r"(tmp4
)
556 : "r"(va
), "r"(una_reg(reg
)), "0"(0));
562 __asm__
__volatile__(
563 "1: ldq_u %2,3(%5)\n"
564 "2: ldq_u %1,0(%5)\n"
571 "3: stq_u %2,3(%5)\n"
572 "4: stq_u %1,0(%5)\n"
578 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
),
579 "=&r"(tmp3
), "=&r"(tmp4
)
580 : "r"(va
), "r"(una_reg(reg
)), "0"(0));
586 __asm__
__volatile__(
587 "1: ldq_u %2,7(%5)\n"
588 "2: ldq_u %1,0(%5)\n"
595 "3: stq_u %2,7(%5)\n"
596 "4: stq_u %1,0(%5)\n"
602 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
),
603 "=&r"(tmp3
), "=&r"(tmp4
)
604 : "r"(va
), "r"(una_reg(reg
)), "0"(0));
610 printk("Bad unaligned kernel access at %016lx: %p %lx %lu\n",
611 pc
, va
, opcode
, reg
);
615 /* Ok, we caught the exception, but we don't want it. Is there
616 someone to pass it along to? */
617 if ((fixup
= search_exception_tables(pc
)) != 0) {
619 newpc
= fixup_exception(una_reg
, fixup
, pc
);
621 printk("Forwarding unaligned exception at %lx (%lx)\n",
629 * Yikes! No one to forward the exception to.
630 * Since the registers are in a weird format, dump them ourselves.
633 printk("%s(%d): unhandled unaligned exception\n",
634 current
->comm
, task_pid_nr(current
));
636 printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx\n",
637 pc
, una_reg(26), regs
->ps
);
638 printk("r0 = %016lx r1 = %016lx r2 = %016lx\n",
639 una_reg(0), una_reg(1), una_reg(2));
640 printk("r3 = %016lx r4 = %016lx r5 = %016lx\n",
641 una_reg(3), una_reg(4), una_reg(5));
642 printk("r6 = %016lx r7 = %016lx r8 = %016lx\n",
643 una_reg(6), una_reg(7), una_reg(8));
644 printk("r9 = %016lx r10= %016lx r11= %016lx\n",
645 una_reg(9), una_reg(10), una_reg(11));
646 printk("r12= %016lx r13= %016lx r14= %016lx\n",
647 una_reg(12), una_reg(13), una_reg(14));
648 printk("r15= %016lx\n", una_reg(15));
649 printk("r16= %016lx r17= %016lx r18= %016lx\n",
650 una_reg(16), una_reg(17), una_reg(18));
651 printk("r19= %016lx r20= %016lx r21= %016lx\n",
652 una_reg(19), una_reg(20), una_reg(21));
653 printk("r22= %016lx r23= %016lx r24= %016lx\n",
654 una_reg(22), una_reg(23), una_reg(24));
655 printk("r25= %016lx r27= %016lx r28= %016lx\n",
656 una_reg(25), una_reg(27), una_reg(28));
657 printk("gp = %016lx sp = %p\n", regs
->gp
, regs
+1);
659 dik_show_code((unsigned int *)pc
);
660 dik_show_trace((unsigned long *)(regs
+1));
662 if (test_and_set_thread_flag (TIF_DIE_IF_KERNEL
)) {
663 printk("die_if_kernel recursion detected.\n");
671 * Convert an s-floating point value in memory format to the
672 * corresponding value in register format. The exponent
673 * needs to be remapped to preserve non-finite values
674 * (infinities, not-a-numbers, denormals).
676 static inline unsigned long
677 s_mem_to_reg (unsigned long s_mem
)
679 unsigned long frac
= (s_mem
>> 0) & 0x7fffff;
680 unsigned long sign
= (s_mem
>> 31) & 0x1;
681 unsigned long exp_msb
= (s_mem
>> 30) & 0x1;
682 unsigned long exp_low
= (s_mem
>> 23) & 0x7f;
685 exp
= (exp_msb
<< 10) | exp_low
; /* common case */
687 if (exp_low
== 0x7f) {
691 if (exp_low
== 0x00) {
697 return (sign
<< 63) | (exp
<< 52) | (frac
<< 29);
701 * Convert an s-floating point value in register format to the
702 * corresponding value in memory format.
704 static inline unsigned long
705 s_reg_to_mem (unsigned long s_reg
)
707 return ((s_reg
>> 62) << 30) | ((s_reg
<< 5) >> 34);
711 * Handle user-level unaligned fault. Handling user-level unaligned
712 * faults is *extremely* slow and produces nasty messages. A user
713 * program *should* fix unaligned faults ASAP.
715 * Notice that we have (almost) the regular kernel stack layout here,
716 * so finding the appropriate registers is a little more difficult
717 * than in the kernel case.
719 * Finally, we handle regular integer load/stores only. In
720 * particular, load-linked/store-conditionally and floating point
721 * load/stores are not supported. The former make no sense with
722 * unaligned faults (they are guaranteed to fail) and I don't think
723 * the latter will occur in any decent program.
725 * Sigh. We *do* have to handle some FP operations, because GCC will
726 * uses them as temporary storage for integer memory to memory copies.
727 * However, we need to deal with stt/ldt and sts/lds only.
730 #define OP_INT_MASK ( 1L << 0x28 | 1L << 0x2c /* ldl stl */ \
731 | 1L << 0x29 | 1L << 0x2d /* ldq stq */ \
732 | 1L << 0x0c | 1L << 0x0d /* ldwu stw */ \
733 | 1L << 0x0a | 1L << 0x0e ) /* ldbu stb */
735 #define OP_WRITE_MASK ( 1L << 0x26 | 1L << 0x27 /* sts stt */ \
736 | 1L << 0x2c | 1L << 0x2d /* stl stq */ \
737 | 1L << 0x0d | 1L << 0x0e ) /* stw stb */
739 #define R(x) ((size_t) &((struct pt_regs *)0)->x)
741 static int unauser_reg_offsets
[32] = {
742 R(r0
), R(r1
), R(r2
), R(r3
), R(r4
), R(r5
), R(r6
), R(r7
), R(r8
),
743 /* r9 ... r15 are stored in front of regs. */
744 -56, -48, -40, -32, -24, -16, -8,
745 R(r16
), R(r17
), R(r18
),
746 R(r19
), R(r20
), R(r21
), R(r22
), R(r23
), R(r24
), R(r25
), R(r26
),
747 R(r27
), R(r28
), R(gp
),
754 do_entUnaUser(void __user
* va
, unsigned long opcode
,
755 unsigned long reg
, struct pt_regs
*regs
)
757 static DEFINE_RATELIMIT_STATE(ratelimit
, 5 * HZ
, 5);
759 unsigned long tmp1
, tmp2
, tmp3
, tmp4
;
760 unsigned long fake_reg
, *reg_addr
= &fake_reg
;
764 /* Check the UAC bits to decide what the user wants us to do
765 with the unaliged access. */
767 if (!(current_thread_info()->status
& TS_UAC_NOPRINT
)) {
768 if (__ratelimit(&ratelimit
)) {
769 printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n",
770 current
->comm
, task_pid_nr(current
),
771 regs
->pc
- 4, va
, opcode
, reg
);
774 if ((current_thread_info()->status
& TS_UAC_SIGBUS
))
776 /* Not sure why you'd want to use this, but... */
777 if ((current_thread_info()->status
& TS_UAC_NOFIX
))
780 /* Don't bother reading ds in the access check since we already
781 know that this came from the user. Also rely on the fact that
782 the page at TASK_SIZE is unmapped and so can't be touched anyway. */
783 if ((unsigned long)va
>= TASK_SIZE
)
786 ++unaligned
[1].count
;
787 unaligned
[1].va
= (unsigned long)va
;
788 unaligned
[1].pc
= regs
->pc
- 4;
790 if ((1L << opcode
) & OP_INT_MASK
) {
791 /* it's an integer load/store */
793 reg_addr
= (unsigned long *)
794 ((char *)regs
+ unauser_reg_offsets
[reg
]);
795 } else if (reg
== 30) {
796 /* usp in PAL regs */
799 /* zero "register" */
804 /* We don't want to use the generic get/put unaligned macros as
805 we want to trap exceptions. Only if we actually get an
806 exception will we decide whether we should have caught it. */
809 case 0x0c: /* ldwu */
810 __asm__
__volatile__(
811 "1: ldq_u %1,0(%3)\n"
812 "2: ldq_u %2,1(%3)\n"
818 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
822 *reg_addr
= tmp1
|tmp2
;
826 __asm__
__volatile__(
827 "1: ldq_u %1,0(%3)\n"
828 "2: ldq_u %2,3(%3)\n"
834 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
838 alpha_write_fp_reg(reg
, s_mem_to_reg((int)(tmp1
|tmp2
)));
842 __asm__
__volatile__(
843 "1: ldq_u %1,0(%3)\n"
844 "2: ldq_u %2,7(%3)\n"
850 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
854 alpha_write_fp_reg(reg
, tmp1
|tmp2
);
858 __asm__
__volatile__(
859 "1: ldq_u %1,0(%3)\n"
860 "2: ldq_u %2,3(%3)\n"
866 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
870 *reg_addr
= (int)(tmp1
|tmp2
);
874 __asm__
__volatile__(
875 "1: ldq_u %1,0(%3)\n"
876 "2: ldq_u %2,7(%3)\n"
882 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
)
886 *reg_addr
= tmp1
|tmp2
;
889 /* Note that the store sequences do not indicate that they change
890 memory because it _should_ be affecting nothing in this context.
891 (Otherwise we have other, much larger, problems.) */
893 __asm__
__volatile__(
894 "1: ldq_u %2,1(%5)\n"
895 "2: ldq_u %1,0(%5)\n"
902 "3: stq_u %2,1(%5)\n"
903 "4: stq_u %1,0(%5)\n"
909 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
),
910 "=&r"(tmp3
), "=&r"(tmp4
)
911 : "r"(va
), "r"(*reg_addr
), "0"(0));
917 fake_reg
= s_reg_to_mem(alpha_read_fp_reg(reg
));
921 __asm__
__volatile__(
922 "1: ldq_u %2,3(%5)\n"
923 "2: ldq_u %1,0(%5)\n"
930 "3: stq_u %2,3(%5)\n"
931 "4: stq_u %1,0(%5)\n"
937 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
),
938 "=&r"(tmp3
), "=&r"(tmp4
)
939 : "r"(va
), "r"(*reg_addr
), "0"(0));
945 fake_reg
= alpha_read_fp_reg(reg
);
949 __asm__
__volatile__(
950 "1: ldq_u %2,7(%5)\n"
951 "2: ldq_u %1,0(%5)\n"
958 "3: stq_u %2,7(%5)\n"
959 "4: stq_u %1,0(%5)\n"
965 : "=r"(error
), "=&r"(tmp1
), "=&r"(tmp2
),
966 "=&r"(tmp3
), "=&r"(tmp4
)
967 : "r"(va
), "r"(*reg_addr
), "0"(0));
973 /* What instruction were you trying to use, exactly? */
977 /* Only integer loads should get here; everyone else returns early. */
983 regs
->pc
-= 4; /* make pc point to faulting insn */
984 info
.si_signo
= SIGSEGV
;
987 /* We need to replicate some of the logic in mm/fault.c,
988 since we don't have access to the fault code in the
989 exception handling return path. */
990 if ((unsigned long)va
>= TASK_SIZE
)
991 info
.si_code
= SEGV_ACCERR
;
993 struct mm_struct
*mm
= current
->mm
;
994 down_read(&mm
->mmap_sem
);
995 if (find_vma(mm
, (unsigned long)va
))
996 info
.si_code
= SEGV_ACCERR
;
998 info
.si_code
= SEGV_MAPERR
;
999 up_read(&mm
->mmap_sem
);
1002 send_sig_info(SIGSEGV
, &info
, current
);
1007 info
.si_signo
= SIGBUS
;
1009 info
.si_code
= BUS_ADRALN
;
1011 send_sig_info(SIGBUS
, &info
, current
);
1018 /* Tell PAL-code what global pointer we want in the kernel. */
1019 register unsigned long gptr
__asm__("$29");
1022 /* Hack for Multia (UDB) and JENSEN: some of their SRMs have
1023 a bug in the handling of the opDEC fault. Fix it up if so. */
1024 if (implver() == IMPLVER_EV4
)