1 // SPDX-License-Identifier: GPL-2.0 2 #include <linux/kernel.h> 3 #include <linux/stdarg.h> 4 #include <linux/string.h> 5 #include <linux/ctype.h> 6 #include <asm/stacktrace.h> 7 #include <asm/boot_data.h> 8 #include <asm/lowcore.h> 9 #include <asm/setup.h> 10 #include <asm/sclp.h> 11 #include <asm/uv.h> 12 #include "boot.h" 13 14 void print_stacktrace(unsigned long sp) 15 { 16 struct stack_info boot_stack = { STACK_TYPE_TASK, (unsigned long)_stack_start, 17 (unsigned long)_stack_end }; 18 bool first = true; 19 20 boot_printk("Call Trace:\n"); 21 while (!(sp & 0x7) && on_stack(&boot_stack, sp, sizeof(struct stack_frame))) { 22 struct stack_frame *sf = (struct stack_frame *)sp; 23 24 boot_printk(first ? "(sp:%016lx [<%016lx>] %pS)\n" : 25 " sp:%016lx [<%016lx>] %pS\n", 26 sp, sf->gprs[8], (void *)sf->gprs[8]); 27 if (sf->back_chain <= sp) 28 break; 29 sp = sf->back_chain; 30 first = false; 31 } 32 } 33 34 void print_pgm_check_info(void) 35 { 36 unsigned long *gpregs = (unsigned long *)get_lowcore()->gpregs_save_area; 37 struct psw_bits *psw = &psw_bits(get_lowcore()->psw_save_area); 38 39 boot_printk("Linux version %s\n", kernel_version); 40 if (!is_prot_virt_guest() && early_command_line[0]) 41 boot_printk("Kernel command line: %s\n", early_command_line); 42 boot_printk("Kernel fault: interruption code %04x ilc:%x\n", 43 get_lowcore()->pgm_code, get_lowcore()->pgm_ilc >> 1); 44 if (kaslr_enabled()) { 45 boot_printk("Kernel random base: %lx\n", __kaslr_offset); 46 boot_printk("Kernel random base phys: %lx\n", __kaslr_offset_phys); 47 } 48 boot_printk("PSW : %016lx %016lx (%pS)\n", 49 get_lowcore()->psw_save_area.mask, 50 get_lowcore()->psw_save_area.addr, 51 (void *)get_lowcore()->psw_save_area.addr); 52 boot_printk( 53 " R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x P:%x AS:%x CC:%x PM:%x RI:%x EA:%x\n", 54 psw->per, psw->dat, psw->io, psw->ext, psw->key, psw->mcheck, 55 psw->wait, psw->pstate, psw->as, psw->cc, psw->pm, psw->ri, 56 psw->eaba); 57 boot_printk("GPRS: %016lx %016lx %016lx %016lx\n", gpregs[0], gpregs[1], gpregs[2], gpregs[3]); 58 boot_printk(" %016lx %016lx %016lx %016lx\n", gpregs[4], gpregs[5], gpregs[6], gpregs[7]); 59 boot_printk(" %016lx %016lx %016lx %016lx\n", gpregs[8], gpregs[9], gpregs[10], gpregs[11]); 60 boot_printk(" %016lx %016lx %016lx %016lx\n", gpregs[12], gpregs[13], gpregs[14], gpregs[15]); 61 print_stacktrace(get_lowcore()->gpregs_save_area[15]); 62 boot_printk("Last Breaking-Event-Address:\n"); 63 boot_printk(" [<%016lx>] %pS\n", (unsigned long)get_lowcore()->pgm_last_break, 64 (void *)get_lowcore()->pgm_last_break); 65 } 66