#include "ram_quota.h"
#include "kobject_helper.h"
-class Factory : public Ram_quota, public Kobject_h<Factory>, public Kobject
+class Factory : public Ram_quota, public Kobject_h<Factory>
{
FIASCO_DECLARE_KOBJ();
#include "ipc_gate.h"
#include "kmem_slab.h"
#include "task.h"
-#include "thread.h"
+#include "thread_object.h"
#include "static_init.h"
#include "l4_buf_iter.h"
#include "l4_types.h"
: Ram_quota(q, max)
{}
-PRIVATE static inline NOEXPORT NEEDS["kmem_slab.h"]
+
+static Kmem_slab_t<Factory> _factory_allocator("Factory");
+
+PRIVATE static
Factory::Self_alloc *
Factory::allocator()
-{
- static Self_alloc* slabs =
- new Kmem_slab_simple (sizeof (Factory), sizeof (Mword), "Factory");
-
- return slabs;
-}
+{ return &_factory_allocator; }
PUBLIC static inline
Factory *
if (!map(o, o_space, c_space, cap, rl.list()))
{
delete o;
- // FIXME: reap stuff if needed
return commit_result(-L4_err::ENomem);
}
- // FIXME: reap stuff if needed
+ // return a tag with one typed item for the returned capability
return commit_result(0, 0, 1);
}
if (!new_t)
return 0;
- if (new_t->state() != Task::Ready || !new_t->initialize())
+ if (!new_t->valid() || !new_t->initialize())
{
delete new_t;
return 0;
Kobject_iface *
Factory::new_thread(Utcb const *)
{
- Thread *t = new (this) Thread();
+ Thread_object *t = new (this) Thread_object();
return t;
}
return reinterpret_cast<Kobject_iface*>(-L4_err::EInval);
unsigned char thread_rights = 0;
- thread = Kobject::dcast<Thread*>(o_space->lookup_local(bind_thread.obj_index(), &thread_rights));
+ thread = Kobject::dcast<Thread_object*>(o_space->lookup_local(bind_thread.obj_index(), &thread_rights));
if (EXPECT_FALSE(!(thread_rights & L4_fpage::W)))
return reinterpret_cast<Kobject_iface*>(-L4_err::EPerm);
PRIVATE inline NOEXPORT
Kobject_iface *
-Factory::new_irq(Utcb const *)
+Factory::new_irq(unsigned w, Utcb const *utcb)
{
- Irq *i = Irq::allocate(this);
- return i;
+ if (w >= 3 && utcb->values[2])
+ return Irq::allocate<Irq_muxer>(this);
+ else
+ return Irq::allocate<Irq_sender>(this);
}
-
PUBLIC
L4_msg_tag
Factory::kinvoke(L4_obj_ref ref, Mword rights, Syscall_frame *f,
break;
case L4_msg_tag::Label_irq:
- new_o = new_irq(utcb);
+ new_o = new_irq(f->tag().words(), utcb);
break;
case L4_msg_tag::Label_vm:
Log_entry *le = tbe->payload<Log_entry>();
le->op = utcb->values[0];
le->buffer = buffer.obj_index();
- le->id = dbg_id();
+ le->id = dbg_info()->dbg_id();
le->ram = current();
le->newo = new_o ? new_o->dbg_info()->dbg_id() : ~0);
//----------------------------------------------------------------------------
-IMPLEMENTATION [svm]:
+IMPLEMENTATION [svm || vmx]:
-#include "vm.h"
+#include "vm_factory.h"
PRIVATE inline NOEXPORT
Kobject_iface *
Factory::new_vm(Utcb const *)
{
- Vm *new_t = Vm::create(this);
+ Vm *new_t = Vm_factory::create(this);
if (!new_t)
return 0;
- if (new_t->state() != Task::Ready || !new_t->initialize())
+ if (!new_t->valid() || !new_t->initialize())
{
delete new_t;
return 0;
}
//----------------------------------------------------------------------------
-IMPLEMENTATION [!svm && !tz]:
+IMPLEMENTATION [!svm && !tz && !vmx]:
PRIVATE inline NOEXPORT
Kobject_iface *