forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/arch/arm64/include/asm/scs.h
....@@ -2,34 +2,26 @@
22 #ifndef _ASM_SCS_H
33 #define _ASM_SCS_H
44
5
-#ifndef __ASSEMBLY__
5
+#ifdef __ASSEMBLY__
66
7
-#include <linux/scs.h>
7
+#include <asm/asm-offsets.h>
88
99 #ifdef CONFIG_SHADOW_CALL_STACK
10
+ scs_sp .req x18
1011
11
-extern void scs_init_irq(void);
12
+ .macro scs_load tsk, tmp
13
+ ldr scs_sp, [\tsk, #TSK_TI_SCS_SP]
14
+ .endm
1215
13
-static __always_inline void scs_save(struct task_struct *tsk)
14
-{
15
- void *s;
16
+ .macro scs_save tsk, tmp
17
+ str scs_sp, [\tsk, #TSK_TI_SCS_SP]
18
+ .endm
19
+#else
20
+ .macro scs_load tsk, tmp
21
+ .endm
1622
17
- asm volatile("mov %0, x18" : "=r" (s));
18
- task_set_scs(tsk, s);
19
-}
20
-
21
-static inline void scs_overflow_check(struct task_struct *tsk)
22
-{
23
- if (unlikely(scs_corrupted(tsk)))
24
- panic("corrupted shadow stack detected inside scheduler\n");
25
-}
26
-
27
-#else /* CONFIG_SHADOW_CALL_STACK */
28
-
29
-static inline void scs_init_irq(void) {}
30
-static inline void scs_save(struct task_struct *tsk) {}
31
-static inline void scs_overflow_check(struct task_struct *tsk) {}
32
-
23
+ .macro scs_save tsk, tmp
24
+ .endm
3325 #endif /* CONFIG_SHADOW_CALL_STACK */
3426
3527 #endif /* __ASSEMBLY __ */