cpu/native: Don't access sched_active_*

Replaced accesses to sched_active_* with API calls in C files
This commit is contained in:
Marian Buschsieweke 2020-08-17 11:54:17 +02:00
parent c01ef33ccc
commit b657ebc39a
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F
3 changed files with 12 additions and 11 deletions

View File

@ -298,9 +298,9 @@ void native_isr_entry(int sig, siginfo_t *info, void *context)
if (context == NULL) {
errx(EXIT_FAILURE, "native_isr_entry: context is null - unhandled");
}
if (sched_active_thread == NULL) {
if (thread_get_active() == NULL) {
_native_in_isr++;
warnx("native_isr_entry: sched_active_thread is null - unhandled");
warnx("native_isr_entry: thread_get_active() is null - unhandled");
_native_in_isr--;
return;
}
@ -325,7 +325,7 @@ void native_isr_entry(int sig, siginfo_t *info, void *context)
native_isr_context.uc_stack.ss_size = sizeof(__isr_stack);
native_isr_context.uc_stack.ss_flags = 0;
makecontext(&native_isr_context, native_irq_handler, 0);
_native_cur_ctx = (ucontext_t *)sched_active_thread->sp;
_native_cur_ctx = (ucontext_t *)thread_get_active()->sp;
DEBUG("\n\n\t\tnative_isr_entry: return to _native_sig_leave_tramp\n\n");
/* disable interrupts in context */

View File

@ -142,12 +142,12 @@ void isr_cpu_switch_context_exit(void)
ucontext_t *ctx;
DEBUG("isr_cpu_switch_context_exit\n");
if ((sched_context_switch_request == 1) || (sched_active_thread == NULL)) {
if ((sched_context_switch_request == 1) || (thread_get_active() == NULL)) {
sched_run();
}
DEBUG("isr_cpu_switch_context_exit: calling setcontext(%" PRIkernel_pid ")\n\n", sched_active_pid);
ctx = (ucontext_t *)(sched_active_thread->sp);
DEBUG("isr_cpu_switch_context_exit: calling setcontext(%" PRIkernel_pid ")\n\n", thread_getpid());
ctx = (ucontext_t *)(thread_get_active()->sp);
native_interrupts_enabled = 1;
_native_mod_ctx_leave_sigh(ctx);
@ -195,8 +195,9 @@ void isr_thread_yield(void)
}
sched_run();
ucontext_t *ctx = (ucontext_t *)(sched_active_thread->sp);
DEBUG("isr_thread_yield: switching to(%" PRIkernel_pid ")\n\n", sched_active_pid);
ucontext_t *ctx = (ucontext_t *)(thread_get_active()->sp);
DEBUG("isr_thread_yield: switching to(%" PRIkernel_pid ")\n\n",
thread_getpid());
native_interrupts_enabled = 1;
_native_mod_ctx_leave_sigh(ctx);
@ -211,7 +212,7 @@ void thread_yield_higher(void)
sched_context_switch_request = 1;
if (_native_in_isr == 0) {
ucontext_t *ctx = (ucontext_t *)(sched_active_thread->sp);
ucontext_t *ctx = (ucontext_t *)(thread_get_active()->sp);
_native_in_isr = 1;
if (!native_interrupts_enabled) {
warnx("thread_yield_higher: interrupts are disabled - this should not be");

View File

@ -125,11 +125,11 @@ void _native_syscall_leave(void)
&& (_native_in_isr == 0)
&& (_native_in_syscall == 0)
&& (native_interrupts_enabled == 1)
&& (sched_active_thread != NULL)
&& (thread_get_active() != NULL)
)
{
_native_in_isr = 1;
_native_cur_ctx = (ucontext_t *)sched_active_thread->sp;
_native_cur_ctx = (ucontext_t *)thread_get_active()->sp;
native_isr_context.uc_stack.ss_sp = __isr_stack;
native_isr_context.uc_stack.ss_size = SIGSTKSZ;
native_isr_context.uc_stack.ss_flags = 0;