diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2010-05-23 10:24:22 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2010-05-23 10:24:22 -0400 |
commit | 9c447c3a6d94b4e43e0b55a1d0cf0f9731472aa2 (patch) | |
tree | 2cb21e691276a923a0e2e4252c673b0ca16a62c2 /src/util.h | |
parent | 49cc72ba1e59e552754217225d66c7ef0feaf84f (diff) | |
download | seabios-hppa-9c447c3a6d94b4e43e0b55a1d0cf0f9731472aa2.zip seabios-hppa-9c447c3a6d94b4e43e0b55a1d0cf0f9731472aa2.tar.gz seabios-hppa-9c447c3a6d94b4e43e0b55a1d0cf0f9731472aa2.tar.bz2 |
Allow wait_irq to be called in 32bit code.
If wait_irq() is called from 32bit code, then jump to 16bit mode for
the wait.
Have wait_irq check for threads, and have it use yield if threads are
pending. This ensures threads aren't delayed if anything calls
wait_irq.
Use wait_irq() in 32bit mode during a failed boot.
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -21,7 +21,7 @@ static inline void irq_enable(void) static inline unsigned long irq_save(void) { unsigned long flags; - asm volatile("pushfl ; popl %0" : "=g" (flags)); + asm volatile("pushfl ; popl %0" : "=g" (flags): :"memory"); irq_disable(); return flags; } @@ -36,12 +36,6 @@ static inline void cpu_relax(void) asm volatile("rep ; nop": : :"memory"); } -// Atomically enable irqs and sleep until an irq; then re-disable irqs. -static inline void wait_irq(void) -{ - asm volatile("sti ; hlt ; cli ; cld": : :"memory"); -} - static inline void nop(void) { asm volatile("nop"); @@ -49,12 +43,12 @@ static inline void nop(void) static inline void hlt(void) { - asm volatile("hlt"); + asm volatile("hlt": : :"memory"); } static inline void wbinvd(void) { - asm volatile("wbinvd"); + asm volatile("wbinvd": : :"memory"); } #define CPUID_MSR (1 << 5) @@ -182,7 +176,6 @@ inline void __call16_int(struct bregs *callregs, u16 offset); extern void irq_trampoline_ ##nr (); \ __call16_int((callregs), (u32)&irq_trampoline_ ##nr ); \ } while (0) -void check_irqs(void); u8 checksum_far(u16 buf_seg, void *buf_far, u32 len); u8 checksum(void *buf, u32 len); size_t strlen(const char *s); @@ -209,6 +202,7 @@ extern struct thread_info MainThread; void thread_setup(void); struct thread_info *getCurThread(void); void yield(void); +void wait_irq(void); void run_thread(void (*func)(void*), void *data); void wait_threads(void); struct mutex_s { u32 isLocked; }; |