1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Most of this ideas comes from x86. 4 * 5 * Copyright (C) 2020 Loongson Technology Corporation Limited 6 */ 7 #ifndef _ASM_UNWIND_HINTS_H 8 #define _ASM_UNWIND_HINTS_H 9 10 #include <linux/objtool.h> 11 #include "orc_types.h" 12 13 #ifdef __ASSEMBLY__ 14 15 .macro UNWIND_HINT_EMPTY 16 UNWIND_HINT sp_reg=ORC_REG_UNDEFINED type=UNWIND_HINT_TYPE_CALL end=1 17 .endm 18 19 .macro UNWIND_HINT_REGS base=ORC_REG_SP offset=0 20 UNWIND_HINT sp_reg=\base sp_offset=\offset type=UNWIND_HINT_TYPE_REGS 21 .endm 22 23 .macro UNWIND_HINT_FUNC offset=0 24 UNWIND_HINT sp_reg=ORC_REG_SP sp_offset=\offset type=UNWIND_HINT_TYPE_FUNC 25 .endm 26 27 .macro NOT_SIBLING_CALL_HINT 28 876: .pushsection .discard.not_sibling_call 29 .long 876b - . 30 .popsection 31 .endm 32 33 #else /* !__ASSEMBLY__ */ 34 35 #define UNWIND_HINT_SAVE UNWIND_HINT(0, 0, UNWIND_HINT_TYPE_SAVE, 0) 36 37 #define UNWIND_HINT_RESTORE UNWIND_HINT(0, 0, UNWIND_HINT_TYPE_RESTORE, 0) 38 39 #define NOT_SIBLING_CALL_HINT \ 40 "876:\n\t" \ 41 ".pushsection .discard.not_sibling_call\n\t" \ 42 ".long 876b - .\n\t" \ 43 ".popsection\n\t" 44 45 #endif /* __ASSEMBLY__ */ 46 47 #endif /* _ASM_UNWIND_HINTS_H */ 48