From: Martin Pool <mbp@samba.org>
To: linux-ia64@vger.kernel.org
Subject: Re: Unaligned access question
Date: Thu, 25 Sep 2003 02:23:11 +0000 [thread overview]
Message-ID: <marc-linux-ia64-106445674530947@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-106445366428887@msgid-missing>
[-- Attachment #1: Type: text/plain, Size: 802 bytes --]
On 25 Sep 2003, Ian Wienand <ianw@gelato.unsw.edu.au> wrote:
> Hi,
>
> This isn't directly related to kernel development, but I am a bit
> stumped as to why my test program below causes an unaligned access
> when 'i' is 7 (that is, when it tries to access across a 64 bit
> boundary of 'array'). It's counter intuitive to me, I would have
> expected it either fault on all loads (for every value of 'i') or to
> have not faulted at all.
I think adding
__attribute__ ((aligned (1)))
will make it read the structure in a way that can handle less-aligned
addresses. (Or maybe 2-byte aligned.) By default gcc assumes strong
alignment so that it can use faster operations (ld8 or something I
suppose).
As Peter said unaligned access will not necessarily trap.
--
Martin
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2003-09-25 2:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-25 1:34 Unaligned access question Ian Wienand
2003-09-25 2:04 ` Peter Chubb
2003-09-25 2:23 ` Martin Pool [this message]
2003-09-25 8:32 ` Andreas Schwab
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=marc-linux-ia64-106445674530947@msgid-missing \
--to=mbp@samba.org \
--cc=linux-ia64@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.