]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/ia32/vm.cpp
60408ad7d107a74aa033f2eebcd58fb99e38fa0e
[l4.git] / kernel / fiasco / src / kern / ia32 / vm.cpp
1 INTERFACE:
2
3 #include "task.h"
4
5 class Vm : public Task
6 {
7 public:
8   explicit Vm(Ram_quota *q) : Task(q) {}
9   int resume_vcpu(Context *, Vcpu_state *, bool) = 0;
10 };
11
12 template< typename VM >
13 struct Vm_allocator
14 {
15   static Kmem_slab_t<VM> a;
16 };
17
18 template<typename VM>
19 Kmem_slab_t<VM> Vm_allocator<VM>::a("Vm");
20
21 // ------------------------------------------------------------------------
22 IMPLEMENTATION:
23
24 PUBLIC inline virtual
25 Page_number
26 Vm::map_max_address() const
27 { return Page_number::create(1UL << (MWORD_BITS - Mem_space::Page_shift)); }
28
29 PUBLIC static
30 template< typename VM >
31 Slab_cache *
32 Vm::allocator()
33 { return &Vm_allocator<VM>::a; }
34
35 // ------------------------------------------------------------------------
36 IMPLEMENTATION [ia32]:
37
38 PROTECTED static inline
39 bool
40 Vm::is_64bit()
41 { return false; }
42
43 // ------------------------------------------------------------------------
44 IMPLEMENTATION [amd64]:
45
46 PROTECTED static inline
47 bool
48 Vm::is_64bit()
49 { return true; }