> 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".

Thanks for the answer.
I would like to check that I understand correctly with the following example.
Please stop me if I am going somewhere wrong.

We can consider a thread waiting for an IPC with the following rcv_buf:

    rcv_buf {
        [cap: 0x13000(dst), 0x002f(local_name)]
        some buf;
    }

The thread receives an IPC call and the rcv_buf becomes the following:

    rcv_buf {
        [cap: 0x14000, 0x002f] // <--- overwritten to 0x14000.
        some buf;
    }
And, 0x14000 and 0x13000 is mapped by l4_task_map.
And, the thread who waits for the IPC call (who originally created 0x13000) uses
the capability index 0x13000 as usual.


Regards,
Jaeyong

On Wed, Jan 30, 2013 at 7:34 PM, Stefan Kalkowski <stefan.kalkowski@...1...> wrote:
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@...49....sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/genode-main
>

--
Stefan Kalkowski
Genode Labs

http://www.genode-labs.com/ · http://genode.org/

------------------------------------------------------------------------------
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@...12...ceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main