FreeBSD/ppc ABI
Rafal Jaworowski
raj at semihalf.com
Wed Jul 8 15:28:44 UTC 2009
On 2009-07-08, at 15:34, Justin Hibbits wrote:
> On Tue, Jul 7, 2009 at 1:52 PM, Peter Grehan<grehan at freebsd.org>
> wrote:
>> Hi Justin,
>>
>>> The trick is only needed in user space, as a shim between two
>>> functions, so I just need any volatile registers that I can use but
>>> aren't function arguments. The target is G4/G5. I only need 3 or 4
>>> volatile registers, but the more the better.
>>
>> You'll probably have to use the stack to spill the param register.
>> Have a
>> look at the MCOUNT macro in ppc's <machine/profile.h> for an
>> example of code
>> that is an intercept between two routines and has to assume that
>> all param
>> registers are used
>>
>> (http://svn.freebsd.org/viewvc/base/head/sys/powerpc/include/profile.h?view=markup&pathrev=153813
>> is the version that has the code fragment commented).
>>
>> later,
>>
>> Peter.
>>
>
> Thanks Peter, and Rafal,
>
> I think this is just what I need. I can use the 3 volatile registers,
> and save the parameter registers when I need to call library
> functions. I'm doing this largely in assembly for performance
> reasons, but knowing how mcount does it will help for the uncommon
> case branches.
What I was trying to say is you need to be careful when messing with
any of the volatiles: only after the caller has saved its context you
can safely use them for your purpose.
Rafal
More information about the freebsd-ppc
mailing list