@@ -198,8 +198,8 @@ FUNC_NORETURN void arch_user_mode_enter(k_thread_entry_t user_entry,
198198{
199199
200200 /* Set up privileged stack before entering user mode */
201- arch_current_thread () -> arch .priv_stack_start =
202- (uint32_t )z_priv_stack_find (arch_current_thread () -> stack_obj );
201+ _current -> arch .priv_stack_start =
202+ (uint32_t )z_priv_stack_find (_current -> stack_obj );
203203#if defined(CONFIG_MPU_STACK_GUARD )
204204#if defined(CONFIG_THREAD_STACK_INFO )
205205 /* We're dropping to user mode which means the guard area is no
@@ -208,37 +208,37 @@ FUNC_NORETURN void arch_user_mode_enter(k_thread_entry_t user_entry,
208208 * which accounted for memory borrowed from the thread stack.
209209 */
210210#if FP_GUARD_EXTRA_SIZE > 0
211- if ((arch_current_thread () -> arch .mode & Z_ARM_MODE_MPU_GUARD_FLOAT_Msk ) != 0 ) {
212- arch_current_thread () -> stack_info .start -= FP_GUARD_EXTRA_SIZE ;
213- arch_current_thread () -> stack_info .size += FP_GUARD_EXTRA_SIZE ;
211+ if ((_current -> arch .mode & Z_ARM_MODE_MPU_GUARD_FLOAT_Msk ) != 0 ) {
212+ _current -> stack_info .start -= FP_GUARD_EXTRA_SIZE ;
213+ _current -> stack_info .size += FP_GUARD_EXTRA_SIZE ;
214214 }
215215#endif /* FP_GUARD_EXTRA_SIZE */
216- arch_current_thread () -> stack_info .start -= MPU_GUARD_ALIGN_AND_SIZE ;
217- arch_current_thread () -> stack_info .size += MPU_GUARD_ALIGN_AND_SIZE ;
216+ _current -> stack_info .start -= MPU_GUARD_ALIGN_AND_SIZE ;
217+ _current -> stack_info .size += MPU_GUARD_ALIGN_AND_SIZE ;
218218#endif /* CONFIG_THREAD_STACK_INFO */
219219
220220 /* Stack guard area reserved at the bottom of the thread's
221221 * privileged stack. Adjust the available (writable) stack
222222 * buffer area accordingly.
223223 */
224224#if defined(CONFIG_FPU ) && defined(CONFIG_FPU_SHARING )
225- arch_current_thread () -> arch .priv_stack_start +=
226- ((arch_current_thread () -> arch .mode & Z_ARM_MODE_MPU_GUARD_FLOAT_Msk ) != 0 ) ?
225+ _current -> arch .priv_stack_start +=
226+ ((_current -> arch .mode & Z_ARM_MODE_MPU_GUARD_FLOAT_Msk ) != 0 ) ?
227227 MPU_GUARD_ALIGN_AND_SIZE_FLOAT : MPU_GUARD_ALIGN_AND_SIZE ;
228228#else
229- arch_current_thread () -> arch .priv_stack_start += MPU_GUARD_ALIGN_AND_SIZE ;
229+ _current -> arch .priv_stack_start += MPU_GUARD_ALIGN_AND_SIZE ;
230230#endif /* CONFIG_FPU && CONFIG_FPU_SHARING */
231231#endif /* CONFIG_MPU_STACK_GUARD */
232232
233233#if defined(CONFIG_CPU_AARCH32_CORTEX_R )
234- arch_current_thread () -> arch .priv_stack_end =
235- arch_current_thread () -> arch .priv_stack_start + CONFIG_PRIVILEGED_STACK_SIZE ;
234+ _current -> arch .priv_stack_end =
235+ _current -> arch .priv_stack_start + CONFIG_PRIVILEGED_STACK_SIZE ;
236236#endif
237237
238238 z_arm_userspace_enter (user_entry , p1 , p2 , p3 ,
239- (uint32_t )arch_current_thread () -> stack_info .start ,
240- arch_current_thread () -> stack_info .size -
241- arch_current_thread () -> stack_info .delta );
239+ (uint32_t )_current -> stack_info .start ,
240+ _current -> stack_info .size -
241+ _current -> stack_info .delta );
242242 CODE_UNREACHABLE ;
243243}
244244
@@ -304,7 +304,7 @@ EXPORT_SYMBOL(z_arm_thread_is_in_user_mode);
304304uint32_t z_check_thread_stack_fail (const uint32_t fault_addr , const uint32_t psp )
305305{
306306#if defined(CONFIG_MULTITHREADING )
307- const struct k_thread * thread = arch_current_thread () ;
307+ const struct k_thread * thread = _current ;
308308
309309 if (thread == NULL ) {
310310 return 0 ;
@@ -314,7 +314,7 @@ uint32_t z_check_thread_stack_fail(const uint32_t fault_addr, const uint32_t psp
314314#if (defined(CONFIG_FPU ) && defined(CONFIG_FPU_SHARING )) && \
315315 defined(CONFIG_MPU_STACK_GUARD )
316316 uint32_t guard_len =
317- ((arch_current_thread () -> arch .mode & Z_ARM_MODE_MPU_GUARD_FLOAT_Msk ) != 0 ) ?
317+ ((_current -> arch .mode & Z_ARM_MODE_MPU_GUARD_FLOAT_Msk ) != 0 ) ?
318318 MPU_GUARD_ALIGN_AND_SIZE_FLOAT : MPU_GUARD_ALIGN_AND_SIZE ;
319319#else
320320 /* If MPU_STACK_GUARD is not enabled, the guard length is
@@ -377,7 +377,7 @@ uint32_t z_check_thread_stack_fail(const uint32_t fault_addr, const uint32_t psp
377377#if defined(CONFIG_FPU ) && defined(CONFIG_FPU_SHARING )
378378int arch_float_disable (struct k_thread * thread )
379379{
380- if (thread != arch_current_thread () ) {
380+ if (thread != _current ) {
381381 return - EINVAL ;
382382 }
383383
0 commit comments