]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/loader/server/src/remote_mem.cc
update
[l4.git] / l4 / pkg / loader / server / src / remote_mem.cc
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 #include <cstring>
11 #include <cstdio>
12
13 #include "remote_mem.h"
14 #include "app_task.h"
15
16 l4_addr_t
17 Stack::add(l4_addr_t start, l4_umword_t size, Region_map *rm,
18                 L4::Cap<L4Re::Dataspace> m, unsigned long offs, unsigned flags,
19                 unsigned char align, char const *what)
20 {
21   (void) what;
22   unsigned rh_flags = flags;
23   if (!m.is_valid())
24     rh_flags |= L4Re::Rm::Reserved;
25
26   void *x = rm->attach((void*)start, size, Region_handler(m, L4_INVALID_CAP, offs, rh_flags),
27         rh_flags, align);
28   if (x == L4_INVALID_PTR)
29     return 0;
30
31   l4re_mem_area_t a;
32   a.start = (l4_addr_t)x;
33   a.size = size;
34   push(a);
35   return l4_addr_t(x);
36 }