Client/Server example showing how to map a page to another task – Server implementation.
Client/Server example showing how to map a page to another task – Server implementation. Note that there's also a shared memory library that supplies this functionality in more convenient way.
#include <stdio.h>
#include <l4/re/util/object_registry>
#include "shared.h"
{
public:
};
int
{
ios >> t;
if (t.
label() != Mapper::Protocol)
ios >> opcode;
switch (opcode)
{
case Mapper::Do_map:
ios >> snd_base;
snprintf(page_to_map, sizeof(page_to_map), "Hello from the server!");
printf("Sending to client\n");
default:
}
}
int
main()
{
static Smap_server smap;
{
printf("Could not register my service, read-only namespace?\n");
return 1;
}
printf("Welcome to the memory map example server!\n");
return 0;
}
L4::Cap< void > register_obj(L4::Epiface *o, char const *service) override
Register a new server object to a pre-allocated receive endpoint.
A server loop object which has a Object_registry included.
Object_registry const * registry() const
Return registry of this server loop.
void L4_NORETURN loop(l4_utcb_t *utcb=l4_utcb())
Start the server loop.
Input/Output stream for IPC [un]marshalling.
virtual int dispatch(unsigned long rights, Ipc::Iostream &ios)=0
The abstract handler for client requests to the object.
unsigned long l4_umword_t
Unsigned machine word.
unsigned long l4_addr_t
Address type.
@ L4_EBADPROTO
Unsupported protocol.
@ L4_FPAGE_RO
Read-only flex page
#define L4_PAGESIZE
Minimal page size (in bytes).
#define L4_PAGESHIFT
Size of a page, log2-based.
int Opcode
Data type for RPC opcodes.
Base class (template) for server implementing server objects.
Message tag data structure.
long label() const L4_NOTHROW
Get the protocol value.