+17
-8
arch/riscv/kernel/head.S
+17
-8
arch/riscv/kernel/head.S
···
77
77
csrw CSR_SATP, a0
78
78
.align 2
79
79
1:
80
-
/* Set trap vector to exception handler */
81
-
la a0, handle_exception
80
+
/* Set trap vector to spin forever to help debug */
81
+
la a0, .Lsecondary_park
82
82
csrw CSR_TVEC, a0
83
-
84
-
/*
85
-
* Set sup0 scratch register to 0, indicating to exception vector that
86
-
* we are presently executing in kernel.
87
-
*/
88
-
csrw CSR_SCRATCH, zero
89
83
90
84
/* Reload the global pointer */
91
85
.option push
···
138
144
la a0, swapper_pg_dir
139
145
call relocate
140
146
#endif
147
+
call setup_trap_vector
141
148
tail smp_callin
142
149
#endif /* CONFIG_SMP */
150
+
151
+
.align 2
152
+
setup_trap_vector:
153
+
/* Set trap vector to exception handler */
154
+
la a0, handle_exception
155
+
csrw CSR_TVEC, a0
156
+
157
+
/*
158
+
* Set sup0 scratch register to 0, indicating to exception vector that
159
+
* we are presently executing in kernel.
160
+
*/
161
+
csrw CSR_SCRATCH, zero
162
+
ret
143
163
144
164
.Lsecondary_park:
145
165
/* We lack SMP support or have too many harts, so park this hart */
···
248
240
call relocate
249
241
#endif /* CONFIG_MMU */
250
242
243
+
call setup_trap_vector
251
244
/* Restore C environment */
252
245
la tp, init_task
253
246
sw zero, TASK_TI_CPU(tp)