xref: /openbmc/linux/arch/parisc/include/asm/unwind.h (revision ba61bb17)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _UNWIND_H_
3 #define _UNWIND_H_
4 
5 #include <linux/list.h>
6 
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 
36 	unsigned int MPE_XL_interrupt_marker:1;	/* 0 */
37 	unsigned int HP_UX_interrupt_marker:1;	/* 1 */
38 	unsigned int Large_frame:1;	/* 2 */
39 	unsigned int Pseudo_SP_Set:1;	/* 3 */
40 	unsigned int reserved4:1;	/* 4 */
41 	unsigned int Total_frame_size:27;	/* 5..31 */
42 };
43 
44 struct unwind_table {
45 	struct list_head list;
46 	const char *name;
47 	unsigned long gp;
48 	unsigned long base_addr;
49 	unsigned long start;
50 	unsigned long end;
51 	const struct unwind_table_entry *table;
52 	unsigned long length;
53 };
54 
55 struct unwind_frame_info {
56 	struct task_struct *t;
57 	/* Eventually we would like to be able to get at any of the registers
58 	   available; but for now we only try to get the sp and ip for each
59 	   frame */
60 	/* struct pt_regs regs; */
61 	unsigned long sp, ip, rp, r31;
62 	unsigned long prev_sp, prev_ip;
63 };
64 
65 struct unwind_table *
66 unwind_table_add(const char *name, unsigned long base_addr,
67 		 unsigned long gp, void *start, void *end);
68 void
69 unwind_table_remove(struct unwind_table *table);
70 
71 void unwind_frame_init(struct unwind_frame_info *info, struct task_struct *t,
72 		       struct pt_regs *regs);
73 void unwind_frame_init_from_blocked_task(struct unwind_frame_info *info, struct task_struct *t);
74 void unwind_frame_init_running(struct unwind_frame_info *info, struct pt_regs *regs);
75 int unwind_once(struct unwind_frame_info *info);
76 int unwind_to_user(struct unwind_frame_info *info);
77 
78 int unwind_init(void);
79 
80 #endif
81