nckernel  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
interrupt.c
Go to the documentation of this file.
1 #include <sys/types.h>
2 #include <stddef.h>
3 #include <stdio.h>
4 #include <string.h>
5 
6 #include <interrupt.h>
7 
8 #include <isr.h>
9 
10 void enable_interrupt(void)
11 {
12  asm __volatile__ ("sti"::);
13 }
14 
16 {
17  asm __volatile__ ("cli"::);
18 }
19 
20 void irq_local_save(unsigned long *eflags)
21 {
22  asm __volatile__ ("pushf; pop %0; cli":"=m"(*eflags):);
23  *eflags &= 0x0200;
24 }
25 
26 void irq_local_restore(unsigned long eflags)
27 {
28  if (eflags) {
29  asm __volatile__("sti"::);
30  } else {
31  asm __volatile__("cli"::);
32  }
33 }
34 
35 /* End of a file */