Native_capability as [out] parameters

Daniel Waddington daniel.waddington at ...161...
Tue Feb 19 01:38:17 CET 2013


Hi Stefan,

In my test server side session function, if I use a core-created 
capability (via alloc_irq) it works.  If I try to do similar behavior 
locally, the capability appears to be valid (i.e., it exists in the jdb 
object table) but will not martial correctly - .valid() fails at the 
client side (note my server process has L4_BASE_FACTORY_CAP).

Can you enlighten me? I am clearly doing something wrong.


status_t Foo::Session_component::create(Genode::Native_capability& 
result_cap)
{
#if WORKS
   Genode::Foc_cpu_session_client cpu(Genode::env()->cpu_session_cap());
   result_cap = cpu.alloc_irq();
#endif

#if DOES_NOT_WORK
   Cap_index * i = Genode::cap_idx_alloc()->alloc_range(1);

   l4_msgtag_t res = l4_factory_create_irq(L4_BASE_FACTORY_CAP, i->kcap());
   assert(!l4_error(res));

   Genode::Native_capability ncap(i);
   result_cap = ncap;
#endif
}


BTW, I'm currently using Native_capabilities to test.  But I also do not 
know how to convert from a Native_capability to a typed capability. ;-) 
Can you show me?

Daniel

On 02/18/2013 01:15 AM, Stefan Kalkowski wrote:
> Hi Daniel,
>
> On 02/14/2013 08:33 PM, Daniel Waddington wrote:
>> Hi,
>> Can I pass Native_capability types as [out] parameters using
>> "Native_capability *" type - with the cross-process mapping happening?
>> Most of the examples use only use the return value to do [out]
>> capabilities.  i.e. GENODE_RPC(Rpc_foo,int,foo,Genode::Native_capability
>> *) doesn't seem to work, but there might be something else afoot.
> actually it should work the way you've described it. I've tested it
> right now by extending the hello example the same way, and the
> capability was successfully transfered to the calling client as an argument.
> By the way, why do you use Native_capability instead of Capability?
> Although both should work, I would use the generic Capability class,
> especially in an interface.
>
> Best regards
> Stefan
>
>> Daniel
>>
>>
>> ------------------------------------------------------------------------------
>> Free Next-Gen Firewall Hardware Offer
>> Buy your Sophos next-gen firewall before the end March 2013
>> and get the hardware for free! Learn more.
>> http://p.sf.net/sfu/sophos-d2d-feb
>>
>>
>>
>> _______________________________________________
>> Genode-main mailing list
>> Genode-main at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/genode-main
>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genode.org/pipermail/users/attachments/20130218/bfab8527/attachment.html>


More information about the users mailing list