Am Mittwoch, dem 13.10.2021 um 15:21 +0000 schrieb Michael Matz:
> Hello,
> 
> On Wed, 13 Oct 2021, Martin Uecker wrote:
> 
> > does anybody know if all architectures support passing
> > an environment pointer in their function call ABI? 
> 
...
> 
> Or you could mean what normally would be called 'static chain', i.e.
> a pointer to the stack frame of outer functions for languages
> supporting  nested functions.  I could imagine this also be called
> environment. 

Yes, sorry for not being clear. It is sometimes called environment
pointer.

> If you mean that, then it's indeed psABI specific, and possibly not
> al ABIs specify it (in which case GCC will probably have set a de-
> facto standard at least for unixy systems).  The x86-64 psABI for
> instance does specify a  register for this, which is separate from
> the normal argument passing registers.  Other psABIs could say that
> it's passed like a hidden  argument prepended to the formal list of
> args.
> 

Yes, most architecture seem to define a register. I am wondering
if there is a table or summary somewhere.

> Or do you mean something else entirely?  It might also help to know
> the  purpose of your question :)
> 

There is currently no standard way to set or query
the static chain from C although this is used by
many other languages. Also function pointers in C
usually can not store the static chain. I am going
to propose to WG14 to add some kind of wide function
pointer to address this.  I am doing back ground
research to understand whether this exists everywhere.

Martin






Reply via email to