]> rtime.felk.cvut.cz Git - l4.git/blobdiff - kernel/fiasco/src/kern/ia32/vm.cpp
update
[l4.git] / kernel / fiasco / src / kern / ia32 / vm.cpp
index 93592e708fcb5f8d728395e46135c66d9764bc6c..7727efec3e827e73984039b9fd92d2063b948314 100644 (file)
@@ -7,14 +7,18 @@ class Vm : public Task
 public:
   ~Vm() {}
 
-  void invoke(L4_obj_ref obj, Mword rights, Syscall_frame *f, Utcb *utcb) = 0;
+  int resume_vcpu(Context *, Vcpu_state *, bool) = 0;
+};
 
-  enum Operation
-  {
-    Vm_run_op = Task::Vm_ops + 0,
-  };
+template< typename VM >
+struct Vm_allocator
+{
+  static Kmem_slab_t<VM> a;
 };
 
+template<typename VM>
+Kmem_slab_t<VM> Vm_allocator<VM>::a("Vm");
+
 // ------------------------------------------------------------------------
 IMPLEMENTATION:
 
@@ -42,44 +46,14 @@ struct Vm_space_factory
 
 
 PUBLIC
-Vm::Vm(Ram_quota *q)
-  : Task(Vm_space_factory(), q, L4_fpage(0))
-{
-}
+Vm::Vm(Ram_quota *q) : Task(Vm_space_factory(), q)
+{}
 
 PUBLIC static
 template< typename VM >
 slab_cache_anon *
 Vm::allocator()
-{
-  static slab_cache_anon *slabs = new Kmem_slab_simple (sizeof (VM),
-                                                        sizeof (Mword),
-                                                        "Vm");
-  return slabs;
-}
-
-
-PUBLIC
-template< typename Vm_impl >
-void
-Vm::vm_invoke(L4_obj_ref obj, Mword rights, Syscall_frame *f, Utcb *utcb)
-{
-  if (EXPECT_FALSE(f->tag().proto() != L4_msg_tag::Label_task))
-    {
-      f->tag(commit_result(-L4_err::EBadproto));
-      return;
-    }
-
-  switch (utcb->values[0])
-    {
-    case Vm_run_op:
-      f->tag(static_cast<Vm_impl *>(this)->sys_vm_run(f, utcb));
-      return;
-    default:
-      Task::invoke(obj, rights, f, utcb);
-      return;
-    }
-}
+{ return &Vm_allocator<VM>::a; }
 
 
 // ------------------------------------------------------------------------