Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jul 2009 17:28:42 +0200
From:      Rafal Jaworowski <raj@semihalf.com>
To:        Justin Hibbits <jrh29@alumni.cwru.edu>
Cc:        Peter Grehan <grehan@freebsd.org>, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   Re: FreeBSD/ppc ABI
Message-ID:  <03142B0D-9AA1-4BBC-9E0C-90636B06423E@semihalf.com>
In-Reply-To: <fd9cd3450907080634g4101ead1ic2bf5694d44e7772@mail.gmail.com>
References:  <fd9cd3450907070641l45223e72p5f7147b97fc5755f@mail.gmail.com> <A07805D6-CAD5-4721-86AC-DE1751831D3C@semihalf.com> <fd9cd3450907071007l5501ea85y81bcb1ee8f4b8bdc@mail.gmail.com> <4A538B64.2080506@freebsd.org> <fd9cd3450907080634g4101ead1ic2bf5694d44e7772@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 2009-07-08, at 15:34, Justin Hibbits wrote:

> On Tue, Jul 7, 2009 at 1:52 PM, Peter Grehan<grehan@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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?03142B0D-9AA1-4BBC-9E0C-90636B06423E>