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.
12 #include <l4/re/util/cap_alloc>
13 #include <l4/re/util/object_registry>
14 #include <l4/cxx/ipc_server>
18 static char page_to_map[L4_PAGESIZE] __attribute__((aligned(L4_PAGESIZE)));
20 static L4Re::Util::Registry_server<> server;
22 class Smap_server : public L4::Server_object_t<Mapper>
25 int dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios);
29 Smap_server::dispatch(l4_umword_t, L4::Ipc::Iostream &ios)
34 // We're only talking the Map_example protocol
35 if (t.label() != Mapper::Protocol)
46 // put something into the page to read it out at the other side
47 snprintf(page_to_map, sizeof(page_to_map), "Hello from the server!");
48 printf("Sending to client\n");
50 ios << L4::Ipc::Snd_fpage::mem((l4_addr_t)page_to_map, L4_PAGESHIFT,
51 L4_FPAGE_RO, snd_base);
61 static Smap_server smap;
64 if (!server.registry()->register_obj(&smap, "smap").is_valid())
66 printf("Could not register my service, read-only namespace?\n");
70 printf("Welcome to the memory map example server!\n");
72 // Wait for client requests