2 * Copyright (c) 2007-2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 #include <interrupt.h>
35 u64 gpr
[14]; /* GPR 2..GPR 15 */
36 u64 fpr
[4]; /* FPR 0, 2, 4, 6 */
40 * NOTE: Be *very* careful not to deref something we're not supposed to, we
41 * don't want to recursively PROG.
43 static void dump_stack(u64 addr
)
46 struct stack_frame
*cur
;
50 sclp_msg("Stack trace:\n");
58 end
= (addr
& ~PAGE_MASK
) + PAGE_SIZE
- sizeof(struct stack_frame
);
60 cur
= (struct stack_frame
*) addr
;
62 while(((u64
)cur
) >= start
&& ((u64
)cur
) < end
) {
65 sclp_msg(" %016lx %-s\n", ra
,
66 symtab_lookup(ra
, buf
, sizeof(buf
)));
71 cur
= (struct stack_frame
*) cur
->back_chain
;
76 * All is lost! All hands abandon ship!
78 * Try to write out a message to a special buffer to help debugging, and
81 static void abend(void)
86 sclp_msg("PROG %04x, ILC %d\n", *PGM_INT_CODE
, (*PGM_INT_ILC
) >> 1);
89 sclp_msg("R%-2d = %016lx R%-2d = %016lx\n",
90 i
, PSA_INT_GPR
[i
], i
+8, PSA_INT_GPR
[i
+8]);
92 sclp_msg("PSW = %016lx %016lx\n",
93 *((u64
*) PGM_INT_OLD_PSW
), *(((u64
*) PGM_INT_OLD_PSW
)+1));
95 dump_stack(PSA_INT_GPR
[15]);
100 * NOTE: we don't care about not clobbering registers as when this
101 * code executes, the CPU will be stopped.
104 "SR %r1, %r1 # not used, but should be zero\n"
105 "SR %r3, %r3 # CPU Address\n"
106 "SIGP %r1, %r3, 0x05 # Signal, order 0x05\n"
110 * If SIGP failed, loop forever
115 void __pgm_int_handler(void)