From: Justin Carlson <justin@cs.cmu.edu>
To: Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de>
Cc: linux-mips@oss.sgi.com
Subject: Re: system.h asm fixes
Date: 17 Jun 2002 15:57:08 -0700 [thread overview]
Message-ID: <1024354629.3160.8.camel@xyzzy.rlson.org> (raw)
In-Reply-To: <20020617223650.GD20335@rembrandt.csv.ica.uni-stuttgart.de>
On Mon, 2002-06-17 at 15:36, Thiemo Seufer wrote:
> Ralf Baechle wrote:
> [snip]
> > > Looks to me like we're missing some proper asm clobber markers:
> >
> > No, as per convention $1 is never used by the compiler per convention,
> > so clobbering not necessary. I recently removed all "$1" clobbers to
> > make the code a bit easier to read.
>
> How can this work? A grep shows many instances of $1 usage,
> I don't think all of this code is interrupt safe.
>
The "$x" clobber markers exist so that the *compiler* won't expect
values in those registers to be preserved across the asm call. It has
nothing to do with safety across interrupts. In other words, it's there
to prevent something like this:
foo = 2; // Compiler sticks foo a register, say, $2
asm (
" lw $2, baz\n"
" sw $2, (%0)\n"
::"r" (sna)); // Assembly code uses $2 as a temp reg
(*bar) = foo; // Compiler erroneously does (*bar) = baz;
In terms of interrupt safety, there is no issue with $1; any interrupt
would save the register before mucking with it, and restore it before
returning. The only registers for which this is not true are k0 and k1.
As others have rightly pointed out, the compiler isn't allowed to muck
with $1 anyways, as it is defined to be a temporary register for the
assembler. So the clobber notation isn't necessary.
Make sense?
-Justin
next prev parent reply other threads:[~2002-06-17 22:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-17 18:20 system.h asm fixes Justin Carlson
2002-06-17 19:43 ` Daniel Jacobowitz
2002-06-17 19:58 ` Thiemo Seufer
2002-06-17 20:44 ` Ralf Baechle
2002-06-17 22:36 ` Thiemo Seufer
2002-06-17 22:57 ` Justin Carlson [this message]
2002-06-18 0:52 ` Ralf Baechle
2002-06-19 17:16 ` Maciej W. Rozycki
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=1024354629.3160.8.camel@xyzzy.rlson.org \
--to=justin@cs.cmu.edu \
--cc=ica2_ts@csv.ica.uni-stuttgart.de \
--cc=linux-mips@oss.sgi.com \
/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