public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Arthur Shipkowski <art@videon-central.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] struct NS16550 {...} __attribute__ ((packed)) at ns16550.h
Date: Mon, 25 Apr 2005 16:15:13 -0400	[thread overview]
Message-ID: <003501c549d3$7d67aa00$1780a8c0@art> (raw)
In-Reply-To: <20050425194342.9B7F5C1510@atlas.denx.de>

>> ARM (silently) does the wrong thing i.e. masks out the lower 2 bits.
>> So gcc on ARM generates byte load/stores.
>
> ...which is broken, especially when there is no need to do this since
> the fields are properly aligned.

Based on a quick Google scan of the GCC mailing list, __attribute__
((packed)) also works (partially due to necessity and partially due to
breaking old code) as a mode to allow unaligned access to a given structure.
Some architectures offer no support for doing unaligned long loads and
stores directly (I suspect on ARM it might be due to some sort of
brokenness).  On the other hand, PPC handles it in hardware, while MIPS
invokes an exception handler in the Linux kernel
(arch/mips/kernel/unaligned.c).

There are discussions on this on the GCC mailing list going back a ways; a
notable one (that mentions m68k as another platform that generates byte
accesses besides ARM) is at http://gcc.gnu.org/ml/gcc/1997-10/msg00063.html
while a more recent bug report hinting at this fact is at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12200

Art

  reply	other threads:[~2005-04-25 20:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-22 14:57 [U-Boot-Users] struct NS16550 {...} __attribute__ ((packed)) at ns16550.h Woojung.Huh at smsc.com
2005-04-22 18:39 ` Wolfgang Denk
2005-04-25  7:44   ` Jean-Paul Saman
2005-04-25  8:20     ` Wolfgang Denk
2005-04-25 14:06       ` Arthur Shipkowski
2005-04-25 14:56         ` Wolfgang Denk
2005-04-25 15:18           ` Pantelis Antoniou
2005-04-25 19:43             ` Wolfgang Denk
2005-04-25 20:15               ` Arthur Shipkowski [this message]
2005-04-25 20:59                 ` Wolfgang Denk
2005-04-26  6:23               ` Pantelis Antoniou
2005-04-26  7:21                 ` Wolfgang Denk
2005-04-26 14:32                   ` Cory Tusar
  -- strict thread matches above, loose matches on Subject: below --
2005-04-22 18:55 Woojung.Huh at smsc.com

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='003501c549d3$7d67aa00$1780a8c0@art' \
    --to=art@videon-central.com \
    --cc=u-boot@lists.denx.de \
    /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