OOStuBS - Technische Informatik II (TI-II)  2.4
cpu.h
gehe zur Dokumentation dieser Datei
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2  * Technische Informatik II *
3  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
4  * *
5  * C P U *
6  * *
7 \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
8 
9 #ifndef __CPU_include__
10 #define __CPU_include__
11 
20 class CPU {
21  public:
26  inline void enable_int () {
27  asm("sti");
28  }
29 
35  inline bool disable_int () {
36  long temp;
37  asm(
38  "pushf\n\t"
39  "cli\n\t"
40  "movl (%%esp), %0\n\t"
41  "add $4, %%esp \n\t"
42  :"=r"(temp)
43  );
44  return temp&(1<<9);
45  }
46 
55  inline void halt () {
56  asm("hlt");
57  }
58 };
59 
60 #endif