Closed mlouielu closed 7 years ago
@mlouielu , let me double-check it. You mean that triggering scheduler in irq context would violate flow of exception handler due to exception return ?
If so, you might be right. How about the result of test suites and behavior of minishell?
Although I think this is a correct fix, please hold off a second.
I still trying to figure out why we can not do a context switch inside a regular ISR....it is weird.
Confirm that this have some bug inside, reproduce step:
Currently, I'm working on #36 to ensure that this problem isn't coming from the scheduler.
The use of sched_elect(0)
SHOULD be deprecated. Let's introduce new kernel function schedule()
.
+1 I defer to @yenWu.
Moreover, PendSV handler is involved with sched_elect()
. It's in irq context and works well due to the lowest priority of pendsv. It's always at the bottom of interrupt handle stack and only exception return to Thread mode. It fits the requirements of the scheduler.
DO NOT USE sched_elect inside the irq.
If a context switch is done inside the irq, it will make v7m-head.S
pop {pc}
to a undefined place, or not able topop {pc}
out.cc. @yenWu.