unwind.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _UNWIND_H_
  3. #define _UNWIND_H_
  4. #include <linux/list.h>
  5. /* Max number of levels to backtrace */
  6. #define MAX_UNWIND_ENTRIES 30
  7. /* From ABI specifications */
  8. struct unwind_table_entry {
  9. unsigned int region_start;
  10. unsigned int region_end;
  11. unsigned int Cannot_unwind:1; /* 0 */
  12. unsigned int Millicode:1; /* 1 */
  13. unsigned int Millicode_save_sr0:1; /* 2 */
  14. unsigned int Region_description:2; /* 3..4 */
  15. unsigned int reserved1:1; /* 5 */
  16. unsigned int Entry_SR:1; /* 6 */
  17. unsigned int Entry_FR:4; /* number saved *//* 7..10 */
  18. unsigned int Entry_GR:5; /* number saved *//* 11..15 */
  19. unsigned int Args_stored:1; /* 16 */
  20. unsigned int Variable_Frame:1; /* 17 */
  21. unsigned int Separate_Package_Body:1; /* 18 */
  22. unsigned int Frame_Extension_Millicode:1; /* 19 */
  23. unsigned int Stack_Overflow_Check:1; /* 20 */
  24. unsigned int Two_Instruction_SP_Increment:1; /* 21 */
  25. unsigned int Ada_Region:1; /* 22 */
  26. unsigned int cxx_info:1; /* 23 */
  27. unsigned int cxx_try_catch:1; /* 24 */
  28. unsigned int sched_entry_seq:1; /* 25 */
  29. unsigned int reserved2:1; /* 26 */
  30. unsigned int Save_SP:1; /* 27 */
  31. unsigned int Save_RP:1; /* 28 */
  32. unsigned int Save_MRP_in_frame:1; /* 29 */
  33. unsigned int extn_ptr_defined:1; /* 30 */
  34. unsigned int Cleanup_defined:1; /* 31 */
  35. unsigned int MPE_XL_interrupt_marker:1; /* 0 */
  36. unsigned int HP_UX_interrupt_marker:1; /* 1 */
  37. unsigned int Large_frame:1; /* 2 */
  38. unsigned int Pseudo_SP_Set:1; /* 3 */
  39. unsigned int reserved4:1; /* 4 */
  40. unsigned int Total_frame_size:27; /* 5..31 */
  41. };
  42. struct unwind_table {
  43. struct list_head list;
  44. const char *name;
  45. unsigned long gp;
  46. unsigned long base_addr;
  47. unsigned long start;
  48. unsigned long end;
  49. const struct unwind_table_entry *table;
  50. unsigned long length;
  51. };
  52. struct unwind_frame_info {
  53. struct task_struct *t;
  54. /* Eventually we would like to be able to get at any of the registers
  55. available; but for now we only try to get the sp and ip for each
  56. frame */
  57. /* struct pt_regs regs; */
  58. unsigned long sp, ip, rp, r31;
  59. unsigned long prev_sp, prev_ip;
  60. };
  61. struct unwind_table *
  62. unwind_table_add(const char *name, unsigned long base_addr,
  63. unsigned long gp, void *start, void *end);
  64. void
  65. unwind_table_remove(struct unwind_table *table);
  66. void unwind_frame_init(struct unwind_frame_info *info, struct task_struct *t,
  67. struct pt_regs *regs);
  68. void unwind_frame_init_from_blocked_task(struct unwind_frame_info *info,
  69. struct task_struct *t);
  70. void unwind_frame_init_task(struct unwind_frame_info *info,
  71. struct task_struct *task, struct pt_regs *regs);
  72. int unwind_once(struct unwind_frame_info *info);
  73. int unwind_to_user(struct unwind_frame_info *info);
  74. int unwind_init(void);
  75. #endif