Looks like unnecessary mapping of capability

Stefan Kalkowski stefan.kalkowski at ...1...
Wed Jan 30 11:34:44 CET 2013


Hi Jaeyong,

On 01/30/2013 02:20 AM, jaeyong yoo wrote:
> Hello! Genode,
> 
> From time to time, I saw something like this:
> 
>     l4_task_map(L4_BASE_TASK_CAP, L4_BASE_TASK_CAP,
>                         l4_obj_fpage(A.dst(), 0, L4_FPAGE_RWX),
>                         B.dst() | L4_ITEM_MAP);
> 
> I think it looks like a unnecessary mapping, because rather than
> mapping, we can just copy the capability like this,
>     A = B.

No, that's not the same. Moreover, it has to be "B = A" in your example.

The "l4_task_map" call above, creates a duplicate of the capability
referenced by "A.dst()" to "B.dst()". The value given by "dst()" is an
index into the capability name space of the task - in the following
shortly titled as capability index. You cannot modify the capability
name space in user mode. All changes to that space are done explicitly
via the "l4_task_map" syscall, or implicitly by sending a capability
mapping via IPC.

The second example is simply an assignment, where A and B will reference
the same capability index in the end. Moreover, the reference counter in
Genode's capability will be increased. Look at
"base-foc/include/base/native_types.h" for the definition of the
capability class for Fiasco.OC.

Normally, we simply use the simple assignments when passing around
capabilities by value. But in some rare situations it is necessary to
really duplicate a capability index.
When waiting for IPC you can specify capability indices, which will
contain capabilities passed by the sender. If the capability indices you
specified contain still valid capabilities, they will nevertheless get
overwritten. In Genode, the message buffer object "Msg_buf" has some
capability indices used to hold received capabilities. Before receiving
new ones, already received capabilities are duplicated via "l4_task_map".

Regards
Stefan

> 
> Since I'm feeling like I miss something here, could you tell me the
> difference between two of them?
> 
> Best regards,
> Jaeyong
> 
> 
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_jan
> 
> 
> 
> _______________________________________________
> 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