U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kenneth Johansson <kenneth@southpole.se>
To: u-boot@lists.denx.de
Subject: [U-Boot] __attribute__((__packed__)) switching to byte-access on ARM
Date: Mon, 11 Aug 2008 19:21:28 +0200	[thread overview]
Message-ID: <1218475288.7889.23.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.64.0808111855330.1810@axis700.grange>


On Mon, 2008-08-11 at 19:00 +0200, Guennadi Liakhovetski wrote:
> On Mon, 11 Aug 2008, Kenneth Johansson wrote:
> 
> > 
> > On Mon, 2008-08-11 at 18:23 +0200, Guennadi Liakhovetski wrote:
> > 
> > > I cannot think of any such examples... I know access-types can be changed 
> > > on the hardware, say, on a 16-bit bus a 32-bit access can be split into 
> > > two 16-bit accesses, but I currently cannot think of any examples of the 
> > > compiler doing such things. But, I think, I can imagine _why_ the compiler 
> > > might decide to do that - it cannot guarantee, that the structure is 
> > > 32-bit aligned, so, it is opting for the "safe" variant... So, the 
> > > question is: is the compiler right and the c-code was wrong, or the other 
> > > way round?
> > 
> > Both are "right" :). C has a lot of implementation specific stuff that
> > can make life interesting. Simple thing like if char is signed or
> > unsigned sometimes is really important. 
> > 
> > If you have to make sure that the read/write is done in 16 bit the only
> > option is to use assembler code. 
> 
> I think, properly written mmapped-register access functions like readl() 
> work perfectly too.
> 

what does the compiler do if you change the code  to 

        return *(ulong*)&timers->TCNTO4;

  reply	other threads:[~2008-08-11 17:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-11 15:48 [U-Boot] __attribute__((__packed__)) switching to byte-access on ARM Guennadi Liakhovetski
2008-08-11 16:06 ` Wolfgang Denk
2008-08-11 16:23   ` Guennadi Liakhovetski
2008-08-11 16:50     ` Kenneth Johansson
2008-08-11 17:00       ` Guennadi Liakhovetski
2008-08-11 17:21         ` Kenneth Johansson [this message]
2008-08-11 18:14           ` Guennadi Liakhovetski
2008-08-11 17:16 ` Jean-Christophe PLAGNIOL-VILLARD
2008-08-11 17:44   ` Guennadi Liakhovetski
2008-08-11 19:41     ` Guennadi Liakhovetski
2008-08-11 19:01 ` Scott Wood
2008-08-11 19:20   ` Guennadi Liakhovetski

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=1218475288.7889.23.camel@localhost.localdomain \
    --to=kenneth@southpole.se \
    --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