shared memory Beispiel?

Frank Mehnert fm3 at os.inf.tu-dresden.de
Wed Aug 31 10:36:19 CEST 2005


Hi Mathias,

please send questions like this to l4-hackers in every case. Simply because
I'm not the only one with knowledge about L4/L4-Userland. The other reason
is that other L4 developers might be interested in such questions as well.

On Wednesday 31 August 2005 10:03, you wrote:
> ich versuche eine L4-Anwendung zu schreiben, die mit shared memory
> arbeitet. Konkret soll ein Kernel-Thread in L4Linux-2.6 (ein
> Netzwerktreiber-Stub) über den gemeinsamen Speicher mit einem L4-Task
> (der ausgelagerte Netzwerktreiber) die zu sendenden, bzw. empfangenen
> Rahmen austauschen. Ich hab schon im l4/pkg-Verzeichnis nach etwas
> passendem gesucht, doch bin nicht wirklich fündig geworden, wie man dass
> nun am Besten macht.
> Ich will ja nur ein Stück Speicher fester Größe read/write für zwei
> L4-Threads mappen. Muss ich dazu den Dataspacemanager benutzen, oder den
> Regionmapper, oder gar l4io? Oder geht das vielleicht doch allein mit
> den L4.V2-Systemrufen?

I would suggest to use the dataspace manager dm_phys to allocate some
memory and to map it into both L4Linux 2.6 and the native L4 task. Mapping
into the native L4 task should be no problem as long this task has a
region manager (the normal case for L4env tasks) -- simply attach the
dataspace to the region manager.

To map it into L4Linux 2.6, you have to reserve a range of virtual memory
inside the Linux server (Adam, which function should someone use for this?)
and then map it into that reserved region via l4dm_map_ds() (see dm_phys
manual). Since L4Linux 2.6 makes havy use of L4env functionality, this
function is available. Make sure that the whole dataspace is mapped into
L4Linux since there is no region manager.

Finally, make sure that both tasks have the right to map the dataspace.
If the Linux server creates the dataspace it has to share the rights
explicitly with the native L4 task with l4dm_share().

A more advanced approach would be to use the DSI (DROPS streaming interface)
which is also available at the remote CVS. The DSI provides functions
for synchronization between clients accessing the same dataspace. There
is the dsi_example package.

There might be comments from other people reading this list.

> Entschuldige, dass ich Dich mit solch banalen Problemen störe, doch ich
> weiß eben nicht, wie man das macht und die Dokumentationen (dm_mem,
> dm_phys, L4-Referenzmanual, ...) sind dahingehend nicht gerade
> aussagekräftig :/

IMHO there still were some threads about this on l4-hackers (please see
http://os.inf.tu-dresden.de/mailman/listinfo/)

Frank
-- 
## Dept. of Computer Science, Dresden University of Technology, Germany ##
## http://os.inf.tu-dresden.de/~fm3                                     ##
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://os.inf.tu-dresden.de/pipermail/l4-hackers/attachments/20050831/41d259f1/attachment.sig>


More information about the l4-hackers mailing list