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.