1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 #ifndef _ORC_TYPES_H 3 #define _ORC_TYPES_H 4 5 #include <linux/types.h> 6 7 /* 8 * The ORC_REG_* registers are base registers which are used to find other 9 * registers on the stack. 10 * 11 * ORC_REG_PREV_SP, also known as DWARF Call Frame Address (CFA), is the 12 * address of the previous frame: the caller's SP before it called the current 13 * function. 14 * 15 * ORC_REG_UNDEFINED means the corresponding register's value didn't change in 16 * the current frame. 17 * 18 * The most commonly used base registers are SP and FP -- which the previous SP 19 * is usually based on -- and PREV_SP and UNDEFINED -- which the previous FP is 20 * usually based on. 21 * 22 * The rest of the base registers are needed for special cases like entry code 23 * and GCC realigned stacks. 24 */ 25 #define ORC_REG_UNDEFINED 0 26 #define ORC_REG_PREV_SP 1 27 #define ORC_REG_SP 2 28 #define ORC_REG_FP 3 29 #define ORC_REG_MAX 4 30 31 #define ORC_TYPE_UNDEFINED 0 32 #define ORC_TYPE_END_OF_STACK 1 33 #define ORC_TYPE_CALL 2 34 #define ORC_TYPE_REGS 3 35 #define ORC_TYPE_REGS_PARTIAL 4 36 37 #ifndef __ASSEMBLY__ 38 /* 39 * This struct is more or less a vastly simplified version of the DWARF Call 40 * Frame Information standard. It contains only the necessary parts of DWARF 41 * CFI, simplified for ease of access by the in-kernel unwinder. It tells the 42 * unwinder how to find the previous SP and FP (and sometimes entry regs) on 43 * the stack for a given code address. Each instance of the struct corresponds 44 * to one or more code locations. 45 */ 46 struct orc_entry { 47 s16 sp_offset; 48 s16 fp_offset; 49 s16 ra_offset; 50 unsigned int sp_reg:4; 51 unsigned int fp_reg:4; 52 unsigned int ra_reg:4; 53 unsigned int type:3; 54 unsigned int signal:1; 55 }; 56 #endif /* __ASSEMBLY__ */ 57 58 #endif /* _ORC_TYPES_H */ 59