]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re_kernel/server/src/region.h
update
[l4.git] / l4 / pkg / l4re_kernel / server / src / region.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 #pragma once
11
12 #include <l4/sys/types.h>
13 #include <l4/re/dataspace>
14 #include <l4/re/util/region_mapping>
15 #include <l4/cxx/ipc_server>
16
17 #include "slab_alloc.h"
18 #if 0
19 class Rm_dataspace : public L4::Capability
20 {
21 public:
22   Rm_dataspace(L4::Capability const &ds) : L4::Capability(ds) {}
23
24   Rm_dataspace() : L4::Capability(L4_INVALID_CAP) {}
25
26   int map(unsigned long offset, unsigned long flags,
27           l4_addr_t local_addr, l4_addr_t min, l4_addr_t max) const;
28 };
29 #endif
30
31 class Region_ops;
32
33 typedef L4Re::Util::Region_handler<L4::Cap<L4Re::Dataspace>, Region_ops> Region_handler;
34
35 class Region_ops
36 {
37 public:
38   typedef l4_umword_t Map_result;
39   static int map(Region_handler const *h, l4_addr_t addr,
40                  L4Re::Util::Region const &r, bool writable,
41                  l4_umword_t *result);
42
43   static void unmap(Region_handler const *h, l4_addr_t vaddr,
44                     l4_addr_t offs, unsigned long size);
45
46   static void free(Region_handler const *h, l4_addr_t start, unsigned long size);
47
48   static void take(Region_handler const *h);
49   static void release(Region_handler const *h);
50 };
51
52
53 class Region_map
54 : public L4Re::Util::Region_map<Region_handler, Slab_alloc>
55 {
56 private:
57   typedef L4Re::Util::Region_map<Region_handler, Slab_alloc> Base;
58
59 public:
60   Region_map();
61   //void setup_wait(L4::Ipc_istream &istr);
62   int handle_pagefault(L4::Ipc_iostream &ios);
63   int handle_rm_request(L4::Ipc_iostream &ios);
64   virtual ~Region_map() {}
65
66   void init();
67
68   void debug_dump(unsigned long function) const;
69 private:
70   int reply_err(L4::Ipc_iostream &ios);
71 };
72
73