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 #include <l4/sys/err.h>
11 #include <l4/sys/types.h>
13 #include <l4/re/util/cap_alloc>
14 #include <l4/cxx/ipc_stream>
21 func_smap_call(L4::Cap<void> const &server)
23 L4::Ipc_iostream s(l4_utcb());
27 if ((err = L4Re::Env::env()->rm()->reserve_area(&addr, L4_PAGESIZE,
28 L4Re::Rm::Search_addr)))
30 printf("The reservation of one page within our virtual memory failed with %d\n", err);
35 s << l4_umword_t(Opcode::Do_map)
37 s << L4::Rcv_fpage::mem((l4_addr_t)addr, L4_PAGESHIFT, 0);
38 l4_msgtag_t res = s.call(server.cap(), Protocol::Map_example);
39 if (l4_ipc_error(res, l4_utcb()))
42 printf("String sent by server: %s\n", (char *)addr);
51 L4::Cap<void> server = L4Re::Env::env()->get_cap<void>("smap_server");
52 if (!server.is_valid())
54 printf("Could not get capability slot!\n");
59 printf("Asking for page from server\n");
61 if (func_smap_call(server))
63 printf("Error talking to server\n");
66 printf("It worked!\n");
68 L4Re::Util::cap_alloc.free(server, L4Re::This_task);