File tree Expand file tree Collapse file tree 3 files changed +31
-25
lines changed Expand file tree Collapse file tree 3 files changed +31
-25
lines changed Original file line number Diff line number Diff line change @@ -137,29 +137,6 @@ static void dump_stack(int *stack)
137137 printk (" ** SAR %p\n" , (void * )bsa [BSA_SAR_OFF /4 ]);
138138}
139139
140- #if CONFIG_XTENSA_ASM2
141- static inline void * restore_stack (void * interrupted_stack )
142- {
143- if (!_is_preempt (_current ) &&
144- !(_current -> base .thread_state & _THREAD_DEAD )) {
145- return interrupted_stack ;
146- }
147-
148- int key = irq_lock ();
149-
150- _current -> switch_handle = interrupted_stack ;
151- _current = _get_next_ready_thread ();
152-
153- void * ret = _current -> switch_handle ;
154-
155- irq_unlock (key );
156-
157- _check_stack_sentinel ();
158-
159- return ret ;
160- }
161- #endif
162-
163140/* The wrapper code lives here instead of in the python script that
164141 * generates _xtensa_handle_one_int*(). Seems cleaner, still kind of
165142 * ugly.
@@ -174,7 +151,7 @@ void *xtensa_int##l##_c(void *interrupted_stack) \
174151 irqs ^= m; \
175152 __asm__ volatile("wsr.intclear %0" : : "r"(m)); \
176153 } \
177- return restore_stack (interrupted_stack); \
154+ return _get_next_switch_handle (interrupted_stack); \
178155}
179156
180157DEF_INT_C_HANDLER (2 )
@@ -235,6 +212,6 @@ void *xtensa_excint1_c(int *interrupted_stack)
235212 _NanoFatalErrorHandler (_NANO_ERR_HW_EXCEPTION , & _default_esf );
236213 }
237214
238- return restore_stack (interrupted_stack );
215+ return _get_next_switch_handle (interrupted_stack );
239216}
240217
Original file line number Diff line number Diff line change @@ -541,4 +541,10 @@ static inline int _is_thread_user(void)
541541#endif
542542}
543543#endif /* CONFIG_USERSPACE */
544+
545+ /**
546+ * Returns the switch_handle of the next thread to run following an interrupt.
547+ */
548+ void * _get_next_switch_handle (void * interrupted );
549+
544550#endif /* _ksched__h_ */
Original file line number Diff line number Diff line change @@ -538,3 +538,26 @@ struct k_thread *_get_next_ready_thread(void)
538538 return NULL ;
539539}
540540#endif
541+
542+ #ifdef CONFIG_USE_SWITCH
543+ void * _get_next_switch_handle (void * interrupted )
544+ {
545+ if (!_is_preempt (_current ) &&
546+ !(_current -> base .thread_state & _THREAD_DEAD )) {
547+ return interrupted ;
548+ }
549+
550+ int key = irq_lock ();
551+
552+ _current -> switch_handle = interrupted ;
553+ _current = _get_next_ready_thread ();
554+
555+ void * ret = _current -> switch_handle ;
556+
557+ irq_unlock (key );
558+
559+ _check_stack_sentinel ();
560+
561+ return ret ;
562+ }
563+ #endif
You can’t perform that action at this time.
0 commit comments