pgm_check_info.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. void print_stacktrace(unsigned long sp)
  14. {
  15. struct stack_info boot_stack = { STACK_TYPE_TASK, (unsigned long)_stack_start,
  16. (unsigned long)_stack_end };
  17. bool first = true;
  18. boot_printk("Call Trace:\n");
  19. while (!(sp & 0x7) && on_stack(&boot_stack, sp, sizeof(struct stack_frame))) {
  20. struct stack_frame *sf = (struct stack_frame *)sp;
  21. boot_printk(first ? "(sp:%016lx [<%016lx>] %pS)\n" :
  22. " sp:%016lx [<%016lx>] %pS\n",
  23. sp, sf->gprs[8], (void *)sf->gprs[8]);
  24. if (sf->back_chain <= sp)
  25. break;
  26. sp = sf->back_chain;
  27. first = false;
  28. }
  29. }
  30. void print_pgm_check_info(void)
  31. {
  32. unsigned long *gpregs = (unsigned long *)get_lowcore()->gpregs_save_area;
  33. struct psw_bits *psw = &psw_bits(get_lowcore()->psw_save_area);
  34. boot_printk("Linux version %s\n", kernel_version);
  35. if (!is_prot_virt_guest() && early_command_line[0])
  36. boot_printk("Kernel command line: %s\n", early_command_line);
  37. boot_printk("Kernel fault: interruption code %04x ilc:%x\n",
  38. get_lowcore()->pgm_code, get_lowcore()->pgm_ilc >> 1);
  39. if (kaslr_enabled()) {
  40. boot_printk("Kernel random base: %lx\n", __kaslr_offset);
  41. boot_printk("Kernel random base phys: %lx\n", __kaslr_offset_phys);
  42. }
  43. boot_printk("PSW : %016lx %016lx (%pS)\n",
  44. get_lowcore()->psw_save_area.mask,
  45. get_lowcore()->psw_save_area.addr,
  46. (void *)get_lowcore()->psw_save_area.addr);
  47. boot_printk(
  48. " 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",
  49. psw->per, psw->dat, psw->io, psw->ext, psw->key, psw->mcheck,
  50. psw->wait, psw->pstate, psw->as, psw->cc, psw->pm, psw->ri,
  51. psw->eaba);
  52. boot_printk("GPRS: %016lx %016lx %016lx %016lx\n", gpregs[0], gpregs[1], gpregs[2], gpregs[3]);
  53. boot_printk(" %016lx %016lx %016lx %016lx\n", gpregs[4], gpregs[5], gpregs[6], gpregs[7]);
  54. boot_printk(" %016lx %016lx %016lx %016lx\n", gpregs[8], gpregs[9], gpregs[10], gpregs[11]);
  55. boot_printk(" %016lx %016lx %016lx %016lx\n", gpregs[12], gpregs[13], gpregs[14], gpregs[15]);
  56. print_stacktrace(get_lowcore()->gpregs_save_area[15]);
  57. boot_printk("Last Breaking-Event-Address:\n");
  58. boot_printk(" [<%016lx>] %pS\n", (unsigned long)get_lowcore()->pgm_last_break,
  59. (void *)get_lowcore()->pgm_last_break);
  60. }