Changeset 122 for trunk/hal/x86_64
- Timestamp:
- Jul 3, 2017, 2:20:52 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_irqmask.c
r118 r122 23 23 #include <hal_internal.h> 24 24 25 static int interrupts_enabled __in_kdata = 0; 25 #define INTRS_ENABLED 0xFFEFAAAA 26 #define INTRS_DISABLED 0xD0CCCCC0 27 28 static uint32_t intrs_state __in_kdata = INTRS_DISABLED; 26 29 27 30 inline void hal_disable_irq(uint32_t *old) 28 31 { 29 if (!interrupts_enabled) { 30 x86_panic("nested critical sections forbidden"); 31 } 32 interrupts_enabled = 0; 32 *old = intrs_state; 33 intrs_state = INTRS_DISABLED; 33 34 cli(); 34 35 } … … 36 37 inline void hal_enable_irq(uint32_t *old) 37 38 { 38 if (interrupts_enabled) { 39 x86_panic("nested critical sections forbidden"); 40 } 41 interrupts_enabled = 1; 39 *old = intrs_state; 40 intrs_state = INTRS_ENABLED; 42 41 sti(); 43 42 } … … 45 44 inline void hal_restore_irq(uint32_t old) 46 45 { 47 if (interrupts_enabled) 48 hal_disable_irq(&old); 46 intrs_state = old; 47 48 if (intrs_state == INTRS_ENABLED) 49 sti(); 50 else if(intrs_state == INTRS_DISABLED) 51 cli(); 49 52 else 50 hal_enable_irq(&old);53 x86_panic("hal_restore_irq: not reachable"); 51 54 } 52 55
Note: See TracChangeset
for help on using the changeset viewer.