]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/fpu.cpp
update
[l4.git] / kernel / fiasco / src / kern / fpu.cpp
1 /*
2  * Fiasco
3  * Floating point unit code
4  */
5
6 INTERFACE:
7
8 #include "initcalls.h"
9 #include "per_cpu_data.h"
10 #include "types.h"
11
12 class Context;
13 class Fpu_state;
14 class Trap_state;
15
16
17 class Fpu
18 {
19 public:
20   // all the following methods are arch dependent
21   static void init(unsigned cpu) FIASCO_INIT_CPU;
22
23   static unsigned state_size();
24   static unsigned state_align();
25   static void init_state(Fpu_state *);
26   static void restore_state(Fpu_state *);
27   static void save_state(Fpu_state *);
28   static void disable();
29   static void enable();
30
31   static Per_cpu<Fpu> fpu;
32
33   Context *owner() const { return _owner; }
34   void set_owner(Context *owner) { _owner = owner; }
35   bool is_owner(Context *owner) const { return _owner == owner; }
36
37 private:
38   Context *_owner;
39 };
40
41 IMPLEMENTATION:
42
43 #include "fpu_state.h"
44
45 DEFINE_PER_CPU Per_cpu<Fpu> Fpu::fpu;
46
47
48 //---------------------------------------------------------------------------
49 IMPLEMENTATION [!fpu]:
50
51 IMPLEMENT inline
52 void Fpu::init_state(Fpu_state *)
53 {}
54
55 IMPLEMENT inline
56 unsigned Fpu::state_size()
57 { return 0; }
58
59 IMPLEMENT inline
60 unsigned Fpu::state_align()
61 { return 1; }
62
63 IMPLEMENT
64 void Fpu::init(unsigned)
65 {}
66
67 IMPLEMENT inline
68 void Fpu::save_state(Fpu_state *)
69 {}
70
71 IMPLEMENT inline
72 void Fpu::restore_state(Fpu_state *)
73 {}
74
75 IMPLEMENT inline
76 void Fpu::disable()
77 {}
78
79 IMPLEMENT inline
80 void Fpu::enable()
81 {}