2 * (c) 2008-2009 Technische Universität Dresden
3 * This file is part of TUD:OS and distributed under the terms of the
4 * GNU General Public License 2.
5 * Please see the COPYING-GPL-2 file for details.
8 //#include "slab_alloc.h"
10 #include <l4/re/parent-sys.h>
11 #include <l4/re/protocols>
12 #include <l4/re/error_helper>
13 #include <l4/re/util/cap_alloc>
15 #include <l4/cxx/iostream>
20 using L4Re::Util::cap_alloc;
21 using L4Re::Dataspace;
24 static Slab_alloc<App_task> *alloc()
26 static Slab_alloc<App_task> a;
32 void *App_task::operator new (size_t) throw()
33 { return alloc()->alloc(); }
35 void App_task::operator delete (void *m) throw()
36 { alloc()->free((App_task*)m); }
40 App_task::dispatch(l4_umword_t obj, L4::Ipc_iostream &ios)
45 if (tag.label() != L4Re::Protocol::Parent)
52 case L4Re::Parent_::Signal:
62 L4Re::Util::cap_alloc.free(obj_cap());
65 L4::cout << "LDR: task " << obj << " exited with " << val
79 : _task(L4::Cap<L4::Task>::Invalid),
80 _thread(L4::Cap<L4::Thread>::Invalid)
82 //object_pool.cap_alloc()->alloc(&_alloc);
83 Gate_alloc::registry.register_obj(&_rm);
85 //object_pool.cap_alloc()->alloc(&log);
90 //object_pool.cap_alloc()->free(&_alloc);
91 Gate_alloc::registry.unregister_obj(&_rm);
92 //object_pool.cap_alloc()->free(&log);
93 if (_thread.is_valid())
94 cap_alloc.free(_thread);
97 cap_alloc.free(_task);
99 if (_sched.obj_cap().is_valid())
100 cap_alloc.free(_sched.obj_cap());
102 Gate_alloc::registry.unregister_obj(this);