File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 2
2
#ifndef __ASM_SUSPEND_H
3
3
#define __ASM_SUSPEND_H
4
4
5
- #define NR_CTX_REGS 12
5
+ #define NR_CTX_REGS 13
6
6
#define NR_CALLEE_SAVED_REGS 12
7
7
8
8
/*
Original file line number Diff line number Diff line change 58
58
* cpu_do_suspend - save CPU registers context
59
59
*
60
60
* x0: virtual address of context pointer
61
+ *
62
+ * This must be kept in sync with struct cpu_suspend_ctx in <asm/suspend.h>.
61
63
* /
62
64
SYM_FUNC_START(cpu_do_suspend)
63
65
mrs x2 , tpidr_el0
@@ -82,6 +84,11 @@ alternative_endif
82
84
stp x8 , x9 , [ x0 , # 48 ]
83
85
stp x10 , x11 , [ x0 , # 64 ]
84
86
stp x12 , x13 , [ x0 , # 80 ]
87
+ / *
88
+ * Save x18 as it may be used as a platform register , e.g. by shadow
89
+ * call stack.
90
+ * /
91
+ str x18 , [ x0 , # 96 ]
85
92
ret
86
93
SYM_FUNC_END(cpu_do_suspend)
87
94
@@ -98,6 +105,13 @@ SYM_FUNC_START(cpu_do_resume)
98
105
ldp x9 , x10 , [ x0 , # 48 ]
99
106
ldp x11 , x12 , [ x0 , # 64 ]
100
107
ldp x13 , x14 , [ x0 , # 80 ]
108
+ / *
109
+ * Restore x18 , as it may be used as a platform register , and clear
110
+ * the buffer to minimize the risk of exposure when used for shadow
111
+ * call stack.
112
+ * /
113
+ ldr x18 , [ x0 , # 96 ]
114
+ str xzr , [ x0 , # 96 ]
101
115
msr tpidr_el0 , x2
102
116
msr tpidrro_el0 , x3
103
117
msr contextidr_el1 , x4
You can’t perform that action at this time.
0 commit comments