l4-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IDL issue - struct return vs. cap return


From: Sam Mason
Subject: Re: IDL issue - struct return vs. cap return
Date: Tue, 10 Jul 2007 17:14:59 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

On Tue, Jul 10, 2007 at 05:24:18PM +0200, Neal H. Walfield wrote:
> My observation was that
> structs are often returned by reference, not by value.  I claimed that
> if you want to generally return structs by value, then there are
> scenarios where you also need to modify the compiler--just like when
> returning capabilities by value.

The problem is that capabilities aren't just the cap_t you see in
userspace, there's the associated state in the kernel and it needs to
know where to put this.  A very simple option is to do the same as Unix
and dynamically allocate a new capability (a file descriptor) each time
a capability is returned (a file is opened).  But we can do better than
this (I do hope I'm interpreting this correctly!) by having a small set
of capability registers that provide faster access to capabilities.
When we do this the capability reference that you're passing is telling
the kernel where you want the capability to end up.  This is why Shap
has been talking about the stub generator having to preallocate the
capability slot, effectively emulating the Unix way of doing things.

I'm not entirely sure how a compiler could be modified to make this
transparent, but I guess it would follow similar lines of an optimising
compiler putting a function's parameters into the CPU's registers.


  Sam




reply via email to

[Prev in Thread] Current Thread [Next in Thread]