From: Scott Anderson <scott_anderson@mvista.com>
To: frowand@mvista.com
Cc: Jim Duey <jduey@ccc-dcs.com>, linuxppc-embedded@lists.linuxppc.org
Subject: Re: PPC 405 Register Model
Date: Tue, 30 Oct 2001 11:54:22 -0800 [thread overview]
Message-ID: <3BDF056E.B658091F@mvista.com> (raw)
In-Reply-To: 3BDF0E29.8FFB2C7@mvista.com
Frank Rowand wrote:
>
> Jim Duey wrote:
> >
> > I'm needing to do some inline assembly for the Walnut board running MVista's
> > Hard Hat Linux and I'm concerned about clobbering registers. Can someone
> > point me to docs or source code that describes the register usage of HHL on
> > the 405GP?
>
> If you use variable names instead of hard coding register numbers you
> don't have to worry about clobbering registers.
FYI, I've seen gcc pass r0 as the register that a variable gets stored
in. Because some PPC instructions treat r0 as a literal zero instead of
the value in r0, this can be bad. To work around this, you just need
to tell gcc that the asm uses r0 and it won't pass you a parameter in
it. Here's an example chunk of code:
/* Get the Time Base. Make sure that r0 is declared as used;
* otherwise it can be passed to me as %0 which doesn't work
* very well with stw.
*/
asm volatile ("0:; mftbu 3; mftb 4; mftbu 0; cmpw 3,0; bne 0b; "
"stw 3,0(%0); stw 4,4(%0)"
:: "r" (&tb): "r3", "r4", "r0");
The "r0" at the tail end of the asm tells gcc that r0 is used.
Scott Anderson
scott_anderson@mvista.com MontaVista Software Inc.
(408)328-9214 1237 East Arques Ave.
http://www.mvista.com Sunnyvale, CA 94085
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
next prev parent reply other threads:[~2001-10-30 19:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-30 17:58 PPC 405 Register Model Jim Duey
2001-10-30 18:54 ` Jerry Van Baren
2001-10-30 20:31 ` Frank Rowand
2001-10-30 19:54 ` Scott Anderson [this message]
2001-10-30 20:53 ` Peter Barada
-- strict thread matches above, loose matches on Subject: below --
2001-10-30 19:40 Jim Duey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3BDF056E.B658091F@mvista.com \
--to=scott_anderson@mvista.com \
--cc=frowand@mvista.com \
--cc=jduey@ccc-dcs.com \
--cc=linuxppc-embedded@lists.linuxppc.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).