Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Richard Earnshaw <rearnsha@arm.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Richard.Earnshaw@arm.com, twall@oculustech.com, gdb@sources.redhat.com
Subject: Re: packing/unpacking 4-octet longs
Date: Thu, 06 Dec 2001 02:03:00 -0000	[thread overview]
Message-ID: <200112061002.KAA02195@cam-mail2.cambridge.arm.com> (raw)
In-Reply-To: Your message of "Wed, 05 Dec 2001 13:42:20 EST." <3C0E6A8C.9040306@cygnus.com>

> 
> > I'm not aware of this affecting the ARM (except in that FPA format doubles 
> > and long doubles always have the word with the exponent at the lowest 
> > address, but there's nothing in the IEEE FP specs that says this is 
> > invalid).  In particular, storing a word, or multi-word, at an unaligned 
> > address does not change the order of bytes in memory, so
> > 	memcpy(unaligned_address, aligned_address, sizeof(some_word))
> > does not require diddling with the internal order (or have I misunderstood 
> > the problem?)
> 
> That was a useful manual :-)  See 5-21 where it explains that a 
> misaligned 32bit access gets rotated before it is stored :-/

You're talking about the ARM manual I posted?  If so, please read it 
again, more carefully.  Rotation is *never* done before a store, only on a 
load: it's a side effect of the byte-lane steering used for reading bytes; 
and it's also useful for fetching half-words from memory on those 
machines, since the effect of the rotation means that a ldr (32-bit load) 
from a mis-aligned address will always result in the desired bits being 
placed in bits 0:15 (little-endian mode) or bits 16:31 (big-endian mode) 
of the target register.

Anyway, the issue isn't relevant, since the ARM ABI never makes use of 
this behaviour for un-aligned (packed) objects, the memcpy rule I 
described above applies.

R.


  reply	other threads:[~2001-12-06 10:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-04  5:44 Timothy Wall
2001-12-05  8:26 ` Andrew Cagney
2001-12-05  8:46   ` Richard Earnshaw
2001-12-05 10:11     ` Lars Brinkhoff
2001-12-05 10:42     ` Andrew Cagney
2001-12-06  2:03       ` Richard Earnshaw [this message]
2001-12-05  9:31   ` Timothy Wall
2001-12-05 10:03     ` Andrew Cagney
2001-12-05 10:20       ` Timothy Wall
2001-12-05 10:49         ` Andrew Cagney

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=200112061002.KAA02195@cam-mail2.cambridge.arm.com \
    --to=rearnsha@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=ac131313@cygnus.com \
    --cc=gdb@sources.redhat.com \
    --cc=twall@oculustech.com \
    /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