Skip to content

Commit

Permalink
threads_schedule: thread in a supervisor mode is always able to finis…
Browse files Browse the repository at this point in the history
…h work

PD-313
  • Loading branch information
HBuczynski authored and HBuczynski committed Nov 22, 2022
1 parent 22a9bb2 commit 81bf68d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hal/armv7m/arch/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ static inline void *hal_cpuGetUserSP(cpu_context_t *ctx)

static inline int hal_cpuSupervisorMode(cpu_context_t *ctx)
{
return 0;
return ((ctx->irq_ret & (1 << 2)) == 0) ? 1 : 0;
}


Expand Down
2 changes: 1 addition & 1 deletion proc/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ int threads_schedule(unsigned int n, cpu_context_t *context, void *arg)

LIST_REMOVE(&threads_common.ready[i], selected);

if (!selected->exit)
if (!selected->exit || hal_cpuSupervisorMode(selected->context))
break;

selected->state = GHOST;
Expand Down

0 comments on commit 81bf68d

Please sign in to comment.