Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / arch / arm64 / include / asm / scs.h
bloba76f9b387a269e52b242d444f50b6ee291993fa8
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_SCS_H
3 #define _ASM_SCS_H
5 #ifdef __ASSEMBLY__
7 #include <asm/asm-offsets.h>
8 #include <asm/sysreg.h>
10 #ifdef CONFIG_SHADOW_CALL_STACK
11 scs_sp .req x18
13 .macro scs_load_current
14 get_current_task scs_sp
15 ldr scs_sp, [scs_sp, #TSK_TI_SCS_SP]
16 .endm
18 .macro scs_save tsk
19 str scs_sp, [\tsk, #TSK_TI_SCS_SP]
20 .endm
21 #else
22 .macro scs_load_current
23 .endm
25 .macro scs_save tsk
26 .endm
27 #endif /* CONFIG_SHADOW_CALL_STACK */
30 #else
32 #include <linux/scs.h>
33 #include <asm/cpufeature.h>
35 #ifdef CONFIG_UNWIND_PATCH_PAC_INTO_SCS
36 static inline void dynamic_scs_init(void)
38 extern bool __pi_dynamic_scs_is_enabled;
40 if (__pi_dynamic_scs_is_enabled) {
41 pr_info("Enabling dynamic shadow call stack\n");
42 static_branch_enable(&dynamic_scs_enabled);
45 #else
46 static inline void dynamic_scs_init(void) {}
47 #endif
49 enum {
50 EDYNSCS_INVALID_CIE_HEADER = 1,
51 EDYNSCS_INVALID_CIE_SDATA_SIZE = 2,
52 EDYNSCS_INVALID_FDE_AUGM_DATA_SIZE = 3,
53 EDYNSCS_INVALID_CFA_OPCODE = 4,
56 int __pi_scs_patch(const u8 eh_frame[], int size);
58 #endif /* __ASSEMBLY __ */
60 #endif /* _ASM_SCS_H */