From: Ulrich Eckhardt <eckhardt@satorlaser.com>
To: linux-mips@linux-mips.org
Subject: Re: How to emulate lw/sw instruction by lb/sb instruction
Date: Mon, 25 Sep 2006 12:49:40 +0200 [thread overview]
Message-ID: <200609251249.40995.eckhardt@satorlaser.com> (raw)
In-Reply-To: <OF041A6F77.FC0AA7D2-ON482571F4.00036CCB-482571F4.0003EC56@LocalDomain>
On Monday 25 September 2006 02:41, william_lei@ali.com.tw wrote:
> Could someone tell me how to modify GCC as titled?because we have met
> problem while porting some middleware,which will generate some lw/sw
> instruction to unaligned address,so I would modify GCC to not generate
> lw/sw instructions for this pieces code.
I'm not exactly sure what problem you are facing but if I understand you
correctly and you have code that simply does misaligned accesses, you would
be better off fixing the code. The reason is that such unaligned accesses
would have to be emulated with bytewise access and combining/dissecting the
values accordingly, which hurts performance (processing and cache). Even when
run on x86 (where such accesses don't cause bus errors) this would be the
better choice, because even there these are emulated in hardware and only
cause hidden performance losses.
Other than that, I would rather filter the output of GCC, i.e. use -S (or what
it was) to generate assembler code and then replace the lw/sw instructions
via your $FAVOURITE_TEXTPROCESSING_TOOL in the affected files. Most other
software isn't that broken and would only suffer from such changes.
Thinking about it, I believe there is also a way (some __attribute__) to tell
GCC that some pointer is not aligned and it will then output suitable code
for unaligned accesses. This requires changes to the generated sourcecode
though, but would be a rather clean solution because it would work on other
platforms, too.
Just wondering, what middleware are you talking about?
Uli
**************************************************************************************
Visit our website at <http://www.satorlaser.de/>
**************************************************************************************
Diese E-Mail und jede mit dieser E-Mail versandte Datei ist vertraulich und ausschließlich für die Nutzung durch den vorgesehenen Empfänger bestimmt. Sollten Sie nicht der vorgesehene Empfänger dieser E-Mail sein, informieren Sie bitte den Absender. Jeder unbefugte Zugriff oder unbefugte Weiterleitung, die Fertigung einer Kopie oder sonstige in diesem Zusammenhang stehende Handlung ist untersagt.
This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error, please be so kind to inform the sender. Any other unauthorised access, unauthorised forwarding, copying or other action in this connection at all, is prohibited.
**************************************************************************************
next prev parent reply other threads:[~2006-09-25 10:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-25 0:41 How to emulate lw/sw instruction by lb/sb instruction william_lei
2006-09-25 6:03 ` Florian Fainelli
2006-09-25 10:49 ` Ulrich Eckhardt [this message]
2006-09-25 11:05 ` Ralf Baechle
[not found] <001401c6e07e$8b07c080$10eca8c0@grendel>
2006-09-25 10:35 ` william_lei
2006-09-25 16:11 ` Maciej W. Rozycki
2006-09-27 20:14 ` Jim Wilson
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=200609251249.40995.eckhardt@satorlaser.com \
--to=eckhardt@satorlaser.com \
--cc=linux-mips@linux-mips.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