aboutsummaryrefslogtreecommitdiffstats
path: root/src/stacks.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2015-08-07 16:12:02 -0400
committerKevin O'Connor <kevin@koconnor.net>2015-08-17 11:58:03 -0400
commitec52068b241ae47d7244c3dd5abb6171625ae5aa (patch)
tree7fd81df91b1ec3747751ce64a8b7b8b435572bb5 /src/stacks.c
parentb3f1fad3c4e0f272e34c17b70741a16d1d3d3237 (diff)
downloadseabios-ec52068b241ae47d7244c3dd5abb6171625ae5aa.tar.gz
Move CanInterrupt check to check_irqs()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stacks.c')
-rw-r--r--src/stacks.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/stacks.c b/src/stacks.c
index 1ad9ef09..107c89e4 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();
@@ -702,13 +704,12 @@ wait_irq(void)
void
yield_toirq(void)
{
- if (!MODESEGMENT && have_threads()) {
- // Threads still active - do a yield instead.
+ if (!MODESEGMENT && (have_threads() || !CanInterrupt)) {
+ // Threads still active or irqs not available - do a yield instead.
yield();
return;
}
- if (MODESEGMENT || CanInterrupt)
- wait_irq();
+ wait_irq();
}
// Wait for all threads (other than the main thread) to complete.