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)
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.
10 #ifndef SIGMA0_PAGE_ALLOC_H__
11 #define SIGMA0_PAGE_ALLOC_H__
13 #include <l4/sys/consts.h>
15 #include <l4/cxx/list_alloc>
16 #include <l4/cxx/slab_alloc>
21 typedef cxx::List_alloc Alloc;
24 static unsigned long _total;
27 static void free(void *m)
29 allocator()->free(m, L4_PAGESIZE);
30 _total += L4_PAGESIZE;
33 static Alloc *allocator() { return &_alloc; }
34 static unsigned long total() { return _total; }
37 template< typename T >
38 class Page_alloc : public Page_alloc_base
41 enum { can_free = 1 };
43 { return (T*)_alloc.alloc(L4_PAGESIZE,L4_PAGESIZE); }
46 { _alloc.free(b, L4_PAGESIZE); }
49 template< typename Type >
51 : public cxx::Slab_static<Type, L4_PAGESIZE, 2, Page_alloc>