]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/sigma0/server/src/mem_man.h
Update
[l4.git] / l4 / pkg / l4re-core / sigma0 / server / src / mem_man.h
1 /*
2  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3  *               Alexander Warg <warg@os.inf.tu-dresden.de>
4  *     economic rights: Technische Universität Dresden (Germany)
5  *
6  * This file is part of TUD:OS and distributed under the terms of the
7  * GNU General Public License 2.
8  * Please see the COPYING-GPL-2 file for details.
9  */
10 #ifndef SIGMA0_MEM_MAN_H__
11 #define SIGMA0_MEM_MAN_H__
12
13 #include <l4/cxx/avl_set>
14
15 #include "page_alloc.h"
16 #include "region.h"
17
18
19 class Mem_man 
20 {
21 private:
22   bool alloc_from(Region const *r2, Region const &r);
23
24   static Mem_man _ram;
25
26 public:
27   typedef cxx::Avl_set< Region, cxx::Lt_functor<Region>, Slab_alloc> Tree;
28
29 private:
30   Tree _tree;
31
32 public:
33   static Mem_man *ram() { return &_ram; }
34
35   unsigned long alloc(Region const &r, bool force = false);
36   bool reserve(Region const &r);
37   bool add_free(Region const &r);
38   bool add(Region const &r);
39   Region const *find(Region const &r, bool force = false) const;
40
41   bool morecore();
42   unsigned long alloc_first(unsigned long size, unsigned owner = 2);
43
44   void dump();
45 };
46
47 #endif
48