mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Added Interrupt::IsEnabled().
This commit is contained in:
parent
36ff6c7f96
commit
8cbf9ff8f0
3 changed files with 18 additions and 2 deletions
|
@ -47,6 +47,9 @@ const unsigned IRQ13 = 45;
|
|||
const unsigned IRQ14 = 46;
|
||||
const unsigned IRQ15 = 47;
|
||||
|
||||
extern "C" unsigned long asm_interrupts_are_enabled();
|
||||
|
||||
inline bool IsEnabled() { return asm_interrupts_are_enabled(); }
|
||||
inline void Enable() { asm volatile("sti"); }
|
||||
inline void Disable() { asm volatile("cli"); }
|
||||
|
||||
|
|
|
@ -443,3 +443,11 @@ interrupt_handler_prepare:
|
|||
interrupt_handler_null:
|
||||
iretq
|
||||
|
||||
.global asm_interrupts_are_enabled
|
||||
.type asm_interrupts_are_enabled, @function
|
||||
asm_interrupts_are_enabled:
|
||||
pushfq
|
||||
popq %rax
|
||||
andq $0x000200, %rax # FLAGS_INTERRUPT
|
||||
retq
|
||||
|
||||
|
|
|
@ -153,9 +153,14 @@ irq_common_stub:
|
|||
;sti
|
||||
iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP
|
||||
|
||||
global
|
||||
|
||||
global interrupt_handler_null
|
||||
interrupt_handler_null:
|
||||
iret
|
||||
|
||||
global asm_interrupts_are_enabled
|
||||
asm_interrupts_are_enabled:
|
||||
pushf
|
||||
pop eax
|
||||
and eax, 0x000200 ; FLAGS_INTERRUPT
|
||||
ret
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue