Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/stacks.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/stacks.c b/src/stacks.c index 1ad9ef0..1cd0fde 100644 --- a/src/stacks.c +++ b/src/stacks.c @@ -661,6 +661,9 @@ fail: void VISIBLE16 check_irqs(void) { + if (!MODESEGMENT && !CanInterrupt) + // Can't enable interrupts (PIC and/or IVT not yet setup) + return; if (need_hop_back()) { extern void _cfunc16_check_irqs(void); stack_hop_back(0, 0, _cfunc16_check_irqs); @@ -674,12 +677,11 @@ void yield(void) { if (MODESEGMENT || !CONFIG_THREADS) { - if (MODESEGMENT || CanInterrupt) - check_irqs(); + check_irqs(); return; } struct thread_info *cur = getCurThread(); - if (cur == &MainThread && CanInterrupt) + if (cur == &MainThread) // Permit irqs to fire check_irqs();
@@ -690,6 +692,9 @@ yield(void) void VISIBLE16 wait_irq(void) { + if (!MODESEGMENT && !CanInterrupt) + // Can't enable interrupts (PIC and/or IVT not yet setup) + return; if (need_hop_back()) { extern void _cfunc16_wait_irq(void); stack_hop_back(0, 0, _cfunc16_wait_irq); @@ -707,8 +712,7 @@ yield_toirq(void) yield(); return; } - if (MODESEGMENT || CanInterrupt) - wait_irq(); + wait_irq(); }
// Wait for all threads (other than the main thread) to complete.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/stacks.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/stacks.c b/src/stacks.c index 1cd0fde..192fb2a 100644 --- a/src/stacks.c +++ b/src/stacks.c @@ -661,9 +661,11 @@ fail: void VISIBLE16 check_irqs(void) { - if (!MODESEGMENT && !CanInterrupt) + if (!MODESEGMENT && !CanInterrupt) { // Can't enable interrupts (PIC and/or IVT not yet setup) + cpu_relax(); return; + } if (need_hop_back()) { extern void _cfunc16_check_irqs(void); stack_hop_back(0, 0, _cfunc16_check_irqs); @@ -692,9 +694,11 @@ yield(void) void VISIBLE16 wait_irq(void) { - if (!MODESEGMENT && !CanInterrupt) + if (!MODESEGMENT && !CanInterrupt) { // Can't enable interrupts (PIC and/or IVT not yet setup) + cpu_relax(); return; + } if (need_hop_back()) { extern void _cfunc16_wait_irq(void); stack_hop_back(0, 0, _cfunc16_wait_irq);
On Thu, Aug 13, 2015 at 10:16:30AM -0400, Kevin O'Connor wrote:
Signed-off-by: Kevin O'Connor kevin@koconnor.net
FYI, I committed a slightly modified version of this series.
-Kevin