From owner-freebsd-ppc@FreeBSD.ORG Wed Jul 8 15:28:44 2009 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4772D106568A for ; Wed, 8 Jul 2009 15:28:44 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from smtp.semihalf.com (smtp.semihalf.com [213.17.239.109]) by mx1.freebsd.org (Postfix) with ESMTP id D8B008FC16 for ; Wed, 8 Jul 2009 15:28:43 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from [10.0.0.34] (cardhu.semihalf.com [213.17.239.108]) by smtp.semihalf.com (Postfix) with ESMTPSA id 64A9FC3AAA; Wed, 8 Jul 2009 17:27:40 +0200 (CEST) Message-Id: <03142B0D-9AA1-4BBC-9E0C-90636B06423E@semihalf.com> From: Rafal Jaworowski To: Justin Hibbits In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Date: Wed, 8 Jul 2009 17:28:42 +0200 References: <4A538B64.2080506@freebsd.org> X-Mailer: Apple Mail (2.935.3) Cc: Peter Grehan , FreeBSD PowerPC ML Subject: Re: FreeBSD/ppc ABI X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jul 2009 15:28:44 -0000 On 2009-07-08, at 15:34, Justin Hibbits wrote: > On Tue, Jul 7, 2009 at 1:52 PM, Peter Grehan > 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 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