From: Richard Earnshaw <rearnsha@arm.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: twall@oculustech.com, gdb@sources.redhat.com, Richard.Earnshaw@arm.com
Subject: Re: packing/unpacking 4-octet longs
Date: Wed, 05 Dec 2001 08:46:00 -0000 [thread overview]
Message-ID: <200112051645.QAA06737@cam-mail2.cambridge.arm.com> (raw)
In-Reply-To: Your message of "Wed, 05 Dec 2001 11:25:58 EST." <3C0E4A96.6070601@cygnus.com>
> > 0xaabbccdd is stored as 0xbb 0xaa 0xdd 0xcc. This I can account for in the
> > long/float/double packing/unpacking routines (though I'm not sure how I'm
> > going to make a clean patch yet...). The problem is that the word order
> > switches if the value is accessed at an odd address (apparently this made
> > sense to the hardware designers). The MS word of a long is always the first
> > one accessed (they must have forgotten that the chip was little-endian).
>
> Mutter something about hardware engineers taking short cuts :-)
As opposed to software engineers making invalid assumptions about the
world they operate in :-) In particular, by ignoring bits of the
standards that are inconveniently difficult to deal with...
> I'm
> pretty sure that there is another very old wacko architecture that did
> something similar to this, I'm trying to remember which. pdp11?
> original m68k?
PDP11, I think. It's a bit before my time, but IIRC it's because earlier
PDPS (8? 9?) were 16-bit machines, so there wasn't really any concept of
word-ordering beyond that: 16-bit words were little-endian, but the most
significant word was always at the lowest address (or the other way
around). When the pdp-11 came out, with 32-bit operations, all this
caused carnage. I'm told that it was this that convinced Digital that all
the world would in future be little-endian (and hence, I believe, why MIPS
processors grew a little-endian mode).
> This problem also shows up on hardware that implemented
> big/little endian using xor bits - Arm?
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?)
R.
next prev parent reply other threads:[~2001-12-05 16:46 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 [this message]
2001-12-05 10:11 ` Lars Brinkhoff
2001-12-05 10:42 ` Andrew Cagney
2001-12-06 2:03 ` Richard Earnshaw
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=200112051645.QAA06737@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