1f7515d9fSJosh Poimboeuf /* SPDX-License-Identifier: GPL-2.0 */ 2f7515d9fSJosh Poimboeuf #ifndef _LINUX_OBJTOOL_TYPES_H 3f7515d9fSJosh Poimboeuf #define _LINUX_OBJTOOL_TYPES_H 4f7515d9fSJosh Poimboeuf 5f7515d9fSJosh Poimboeuf #ifndef __ASSEMBLY__ 6f7515d9fSJosh Poimboeuf 7f7515d9fSJosh Poimboeuf #include <linux/types.h> 8f7515d9fSJosh Poimboeuf 9f7515d9fSJosh Poimboeuf /* 10f7515d9fSJosh Poimboeuf * This struct is used by asm and inline asm code to manually annotate the 11f7515d9fSJosh Poimboeuf * location of registers on the stack. 12f7515d9fSJosh Poimboeuf */ 13f7515d9fSJosh Poimboeuf struct unwind_hint { 14f7515d9fSJosh Poimboeuf u32 ip; 15f7515d9fSJosh Poimboeuf s16 sp_offset; 16f7515d9fSJosh Poimboeuf u8 sp_reg; 17f7515d9fSJosh Poimboeuf u8 type; 18f7515d9fSJosh Poimboeuf u8 signal; 19f7515d9fSJosh Poimboeuf }; 20f7515d9fSJosh Poimboeuf 21f7515d9fSJosh Poimboeuf #endif /* __ASSEMBLY__ */ 22f7515d9fSJosh Poimboeuf 23f7515d9fSJosh Poimboeuf /* 24fb799447SJosh Poimboeuf * UNWIND_HINT_TYPE_UNDEFINED: A blind spot in ORC coverage which can result in 25fb799447SJosh Poimboeuf * a truncated and unreliable stack unwind. 26fb799447SJosh Poimboeuf * 27fb799447SJosh Poimboeuf * UNWIND_HINT_TYPE_END_OF_STACK: The end of the kernel stack unwind before 28fb799447SJosh Poimboeuf * hitting user entry, boot code, or fork entry (when there are no pt_regs 29fb799447SJosh Poimboeuf * available). 30fb799447SJosh Poimboeuf * 31f7515d9fSJosh Poimboeuf * UNWIND_HINT_TYPE_CALL: Indicates that sp_reg+sp_offset resolves to PREV_SP 32f7515d9fSJosh Poimboeuf * (the caller's SP right before it made the call). Used for all callable 33f7515d9fSJosh Poimboeuf * functions, i.e. all C code and all callable asm functions. 34f7515d9fSJosh Poimboeuf * 35f7515d9fSJosh Poimboeuf * UNWIND_HINT_TYPE_REGS: Used in entry code to indicate that sp_reg+sp_offset 36f7515d9fSJosh Poimboeuf * points to a fully populated pt_regs from a syscall, interrupt, or exception. 37f7515d9fSJosh Poimboeuf * 38f7515d9fSJosh Poimboeuf * UNWIND_HINT_TYPE_REGS_PARTIAL: Used in entry code to indicate that 39f7515d9fSJosh Poimboeuf * sp_reg+sp_offset points to the iret return frame. 40f7515d9fSJosh Poimboeuf * 41fb799447SJosh Poimboeuf * UNWIND_HINT_TYPE_FUNC: Generate the unwind metadata of a callable function. 42f7515d9fSJosh Poimboeuf * Useful for code which doesn't have an ELF function annotation. 43f7515d9fSJosh Poimboeuf * 44fb799447SJosh Poimboeuf * UNWIND_HINT_TYPE_{SAVE,RESTORE}: Save the unwind metadata at a certain 45fb799447SJosh Poimboeuf * location so that it can be restored later. 46f7515d9fSJosh Poimboeuf */ 47fb799447SJosh Poimboeuf #define UNWIND_HINT_TYPE_UNDEFINED 0 48fb799447SJosh Poimboeuf #define UNWIND_HINT_TYPE_END_OF_STACK 1 49fb799447SJosh Poimboeuf #define UNWIND_HINT_TYPE_CALL 2 50fb799447SJosh Poimboeuf #define UNWIND_HINT_TYPE_REGS 3 51fb799447SJosh Poimboeuf #define UNWIND_HINT_TYPE_REGS_PARTIAL 4 52f902cfddSJosh Poimboeuf /* The below hint types don't have corresponding ORC types */ 53fb799447SJosh Poimboeuf #define UNWIND_HINT_TYPE_FUNC 5 54fb799447SJosh Poimboeuf #define UNWIND_HINT_TYPE_SAVE 6 55fb799447SJosh Poimboeuf #define UNWIND_HINT_TYPE_RESTORE 7 56f7515d9fSJosh Poimboeuf 5722c3d580SPeter Zijlstra /* 5822c3d580SPeter Zijlstra * Annotate types 5922c3d580SPeter Zijlstra */ 6022c3d580SPeter Zijlstra #define ANNOTYPE_NOENDBR 1 61bf5febebSPeter Zijlstra #define ANNOTYPE_RETPOLINE_SAFE 2 62317f2a64SPeter Zijlstra #define ANNOTYPE_INSTR_BEGIN 3 63317f2a64SPeter Zijlstra #define ANNOTYPE_INSTR_END 4 6418aa6118SPeter Zijlstra #define ANNOTYPE_UNRET_BEGIN 5 65f0cd57c3SPeter Zijlstra #define ANNOTYPE_IGNORE_ALTS 6 66112765caSPeter Zijlstra #define ANNOTYPE_INTRA_FUNCTION_CALL 7 67*e7a174fbSPeter Zijlstra #define ANNOTYPE_REACHABLE 8 6822c3d580SPeter Zijlstra 69f7515d9fSJosh Poimboeuf #endif /* _LINUX_OBJTOOL_TYPES_H */ 70