diff options
-rw-r--r-- | src/fw/csm.c | 1 | ||||
-rw-r--r-- | src/post.c | 2 | ||||
-rw-r--r-- | src/stacks.c | 13 | ||||
-rw-r--r-- | src/stacks.h | 2 |
4 files changed, 11 insertions, 7 deletions
diff --git a/src/fw/csm.c b/src/fw/csm.c index 7cdb398f..aee2f90e 100644 --- a/src/fw/csm.c +++ b/src/fw/csm.c @@ -183,6 +183,7 @@ handle_csm_0002(struct bregs *regs) struct bios_data_area_s *bda = MAKE_FLATPTR(SEG_BDA, 0); bda->hdcount = 0; + thread_setup(); mathcp_setup(); timer_setup(); clock_setup(); @@ -124,7 +124,6 @@ interface_init(void) bda_init(); // Other interfaces - thread_init(); boot_init(); bios32_init(); pmm_init(); @@ -167,6 +166,7 @@ platform_hardware_setup(void) // Init base pc hardware. pic_setup(); + thread_setup(); mathcp_setup(); timer_setup(); clock_setup(); diff --git a/src/stacks.c b/src/stacks.c index 1dbdfe9b..1ad9ef09 100644 --- a/src/stacks.c +++ b/src/stacks.c @@ -558,12 +558,13 @@ getCurThread(void) return (void*)ALIGN_DOWN(esp, THREADSTACKSIZE); } -static int ThreadControl; +static u8 CanInterrupt, ThreadControl; // Initialize the support for internal threads. void -thread_init(void) +thread_setup(void) { + CanInterrupt = 1; if (! CONFIG_THREADS) return; ThreadControl = romfile_loadint("etc/threads", 1); @@ -673,11 +674,12 @@ void yield(void) { if (MODESEGMENT || !CONFIG_THREADS) { - check_irqs(); + if (MODESEGMENT || CanInterrupt) + check_irqs(); return; } struct thread_info *cur = getCurThread(); - if (cur == &MainThread) + if (cur == &MainThread && CanInterrupt) // Permit irqs to fire check_irqs(); @@ -705,7 +707,8 @@ yield_toirq(void) yield(); return; } - wait_irq(); + if (MODESEGMENT || CanInterrupt) + wait_irq(); } // Wait for all threads (other than the main thread) to complete. diff --git a/src/stacks.h b/src/stacks.h index 82c4c3c8..a3b031ce 100644 --- a/src/stacks.h +++ b/src/stacks.h @@ -28,7 +28,7 @@ extern struct thread_info MainThread; struct thread_info *getCurThread(void); void yield(void); void yield_toirq(void); -void thread_init(void); +void thread_setup(void); int threads_during_optionroms(void); void run_thread(void (*func)(void*), void *data); void wait_threads(void); |