RM Session - attach() method

Stefan Kalkowski stefan.kalkowski at ...1...
Thu Mar 27 11:24:56 CET 2014


Hello Aditya,

On 03/21/2014 11:11 AM, Aditya Kousik wrote:
> Hello,
> 
> I understand that R/W accesses to physical space are made through the RM
> session. Is this sequence of events correct?
> 
> 1. Create a Dataspace_capability.
> 2. Allocate a dataspace as env()->ram_session->alloc(size) which returns a
> dataspace_capability to the aforementioned DS.
> 3. Attach the dataspace as env()->rm_session()->attach(ds) which returns a
> void pointer having the virtual address pointing to the starting address of
> the dataspace.

that is correct.

> 
> So if one were to write to this virtual address, it goes through the
> RM_session and eventually writes to the physical address. 

Well, "it goes through the RM_session" isn't described correctly.
Attaching a dataspace results in: the page-fault handler of that thread
will be able to resolve page-faults related to the corresponding virtual
memory area. Therefore, writes to the virtual memory area will in fact
write to the physical memory area - not eventually (not considering
cache effects that should be transparent to the user).

> My question is,
> calling attach(ds) in one process and the same attach(ds) in another is
> going to return different virtual addresses. Will writing to these
> different (virtual) addresses give the same result?

Yes, of course.

> 
> Is there a function that can be called to print what physical address is
> mapped to where? 

The dataspace session interface allows to request the physical address
of the dataspace. Assuming you've a capability called "cap" referencing
the dataspace in question, you can do the following:

  Dataspace_client ds_cli(cap);
  PINF("phys address of dataspace %p", (void*) ds_cli.phys_addr());

> And can the contents of Dataspace_capability be printed in
> a readable form?

I assume you mean the contents of the dataspace, and not of the
dataspace capability, it's important to not confuse them. The contents
of a dataspace can only be printed by attaching it, and then e.g.
printing it byte-wise.

Regards
Stefan

> 
> Thanks and regards
> Aditya
> 
> 
> 
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> 
> 
> 
> _______________________________________________
> Genode-main mailing list
> Genode-main at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/genode-main
> 

-- 
Stefan Kalkowski
Genode Labs

http://www.genode-labs.com/ ยท http://genode.org/




More information about the users mailing list