From: Ralf Baechle <ralf@linux-mips.org>
To: william_lei@ali.com.tw
Cc: linux-mips@linux-mips.org
Subject: Re: How to emulate lw/sw instruction by lb/sb instruction
Date: Mon, 25 Sep 2006 12:05:32 +0100 [thread overview]
Message-ID: <20060925110532.GA14735@linux-mips.org> (raw)
In-Reply-To: <OF041A6F77.FC0AA7D2-ON482571F4.00036CCB-482571F4.0003EC56@LocalDomain>
On Mon, Sep 25, 2006 at 08:41:53AM +0800, william_lei@ali.com.tw wrote:
> Dear all
> 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.
You can use gcc's __attribute__((packed)) to define a data structure
that does not have any alignment gaps in it. Gcc will then use unaligned
loads and stores to access this structure. This however is a kludge, for
best performance you should redefine the data structures your code is
working to avoid such missalignment.
Otoh if the miss-alignment case is rare only then you may actually be
better off by relying on the kernel's handling of this case.
Ralf
next prev parent reply other threads:[~2006-09-25 11:04 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
2006-09-25 11:05 ` Ralf Baechle [this message]
[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=20060925110532.GA14735@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=linux-mips@linux-mips.org \
--cc=william_lei@ali.com.tw \
/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