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>
15 #include <l4/cxx/iostream>
16 #include <l4/cxx/l4iostream>
20 static char page_to_map[L4_PAGESIZE] __attribute__((aligned(L4_PAGESIZE)));
22 static L4Re::Util::Registry_server<> server;
24 class Smap_server : public L4::Server_object
27 int dispatch(l4_umword_t obj, L4::Ipc_iostream &ios);
31 Smap_server::dispatch(l4_umword_t, L4::Ipc_iostream &ios)
36 // We're only talking the Map_example protocol
37 if (t.label() != Protocol::Map_example)
48 // put something into the page to read it out at the other side
49 snprintf(page_to_map, sizeof(page_to_map), "Hello from the server!");
50 printf("Sending to client\n");
52 ios << L4::Snd_fpage::mem((l4_addr_t)page_to_map, L4_PAGESHIFT,
53 L4_FPAGE_RO, snd_base);
63 static Smap_server smap;
66 if (!server.registry()->register_obj(&smap, "smap_server").is_valid())
68 printf("Could not register my service, read-only namespace?\n");
72 printf("Welcome to the memory map example server!\n");
74 // Wait for client requests