public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* GCC not awre of MMU
@ 2003-07-29 16:01 Schaefer Philipp
2003-08-07 7:13 ` Jim Wilson
0 siblings, 1 reply; 2+ messages in thread
From: Schaefer Philipp @ 2003-07-29 16:01 UTC (permalink / raw)
To: gcc-bugs
Hello,
I am using: GCC
Configured with: ../gcc-3.0.4/configure --target=powerpc-ibm-eabi
--with-newlib
i686-ibm-cygwin
Thread model: single
gcc version 3.0.4
I am porting a firmware to PPC 403cr
an I am using Memory Management Unit MMU to access litle endian Hardware.
The MMU is configured to have both Big-endian and Little endian Spaces.
Now to my Problem:
I have a code line like :
short a = (short)((PointerToMyStruct->ALongValue)+5);
this generates for Power PC
a Assamblercode like :(Pseudo Code)
Load lower halfword from ALongValue to Register 9
add 5 to register 9
save lower halfword in a;
But this Code would work only Correct If there would not be a MMU wich
swaps Litle Endian to Big-endian Values in some part of Memory !!!
Is there a Posibility to tell GCC there is a MMU so he can not predict the
endiness and generate Code like:
(Pseudo Code)
Load WORD (not halfword!) from ALongValue
Add 5
store lower half word in a.
Thank You Very much !
SIEMENS
Postal Address
Siemens AG, A&D PT 2 D
D-76187 Karlsruhe
Office Address:
Oestliche Rheinbrueckenstrasse 50
D-76187 Karlsruhe
Dipl.-Ing.
Philipp Schäfer Tel. +49 (0)721 595-7030
R & D Engineer Fax +49 (0)721 595-2326
mailto:philipp.schaefer@siemens.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: GCC not awre of MMU
2003-07-29 16:01 GCC not awre of MMU Schaefer Philipp
@ 2003-08-07 7:13 ` Jim Wilson
0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 2003-08-07 7:13 UTC (permalink / raw)
To: Schaefer Philipp; +Cc: gcc-bugs
Schaefer Philipp wrote:
> But this Code would work only Correct If there would not be a MMU wich
> swaps Litle Endian to Big-endian Values in some part of Memory !!!
Try declaring the object as volatile. Gcc won't change the memory
access size for references to volatile objects, so it will load an
entire word from memory and then convert to a short within the register.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-08-07 7:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-29 16:01 GCC not awre of MMU Schaefer Philipp
2003-08-07 7:13 ` Jim Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).