Thread (109 messages) 109 messages, 10 authors, 2007-04-27

Re: [PATCH 6/6] [POWERPC] make struct property's value a void *

From: Segher Boessenkool <hidden>
Date: 2007-04-05 18:12:33

On PowerPC misaligned data doesn't generate exceptions, the chip works
it out transparently.
That's not true.  _Most_ chips will in _most_ cases
handle unaligned accesses, unless you have disabled
that.  You cannot depend on it working without taking
alignment exceptions.
On sparc everything is aligned.  I know, I've been accessing OFW data
structures for more than 10 years and I haven't gotten one unaligned
trap on sparc yet.
It tends to work in practice, sure.  Nothing gives you
any guarantee it will, though.
quoted
So just do an of_decode_int() and its cousins -- platforms
that are trying to guarantee alignment, or that can handle
unaligned memory accesses, can just define these as direct
accesses; everyone else should use the read-by-byte sequences.
No, that's just stupid.  Peppering simple accesses to properties
with these wrappers is just going to make the code uglier for
no tangible gain whatsoever.
It would remove the millions of casts (and the need for the GCC
-fstrict-aliasing flag for this code).
And besides what Stephen is doing is just extending existing
practice, he isn't changing how any of this stuff is already
used.  So this discussion should not get in the way of his
patches getting installed.
I agree.  However when making this code more generally useful,
it would be good to make it more correct at the same time, since
it will only get harder to do so later on.


Segher
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help