caller saves, so function is free to use any register.  params are put
on the stack and then just uses a call instruction wich leaves the
return pc on the stack.  function allocates space for its local
variables on the stack and restores SP before return.  return value of
a function is put in AX (for integers and pointers).  structures and
64bit vlongs are returned the way that the caller allocates it and
passes a pointer to it as the first parameter (on the stack).  AX is
then not used as return value and can be used freely in the callee.

--
cinap
--- Begin Message ---
Hi,

I'm in the process of porting dyncall (http://dyncall.org) to Plan9, and I
was wondering if there are any documents about the calling convention used
by Plan9 - specifically for x86, for starters. I was unable to find any at
the time of writing, and well, hoped that it would be similar to the
SystemV calling convention(s) used by the *BSDs or Linux, etc., but that
doesn't seem to be the case.
The only information I found so far, is, that most of the compiled Plan9
functions don't seem to have any prologue/epilogue, however, this
assumption might be wrong (maybe I didn't get how Plan9 works on the
machine-level, so far).

I'm still new to Plan9, but it's quite mind-opening to discover certain
aspects of the OS - especially after getting so (too) used to Unix/Windows
OS design decisions and accepting them as the normal/right way to do
things...

Thanks,
Tassilo

--- End Message ---

Reply via email to