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