hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/arch/arm64/include/asm/scs.h
....@@ -2,34 +2,27 @@
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_current
13
+ get_current_task scs_sp
14
+ ldr scs_sp, [scs_sp, #TSK_TI_SCS_SP]
15
+ .endm
1216
13
-static __always_inline void scs_save(struct task_struct *tsk)
14
-{
15
- void *s;
17
+ .macro scs_save tsk, tmp
18
+ str scs_sp, [\tsk, #TSK_TI_SCS_SP]
19
+ .endm
20
+#else
21
+ .macro scs_load_current
22
+ .endm
1623
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
-
24
+ .macro scs_save tsk, tmp
25
+ .endm
3326 #endif /* CONFIG_SHADOW_CALL_STACK */
3427
3528 #endif /* __ASSEMBLY __ */