Byte-reverse instructions in PowerPC Processors

Roberto Barbieri Carrera rbarbiericarrera@gmail.com
Tue Aug 26 06:19:00 GMT 2008


Hello,

I don´t actually know if this is the proper place for asking this.
Please excuse me if I´m wrong.

I´m developing a system that works in two stages: configuration time
and run time.

Configuration processing is performed in a little endian machine, with
code compiled with gcc.

Run time processing is performed in a ´603´ PowerPC processor, namely,
an MPC8248. Also compiled with gcc.

The output of the configuration stage is a binary file containing
several struct´s. This means that the endianness of the data has to be
converted somewhere.

Of course I can do this with some software, but this brings a
maintainability issue, i.e., if a struct changes in the future, the
conversion software will have to be changed also. This usually brings
bugs.

I though that, as the PowerPC processor has byte-reverse instructions,
one could declare, for example, a big struct containing all the file´s
structs, as byte-order reversed, so that the compiler could use the
byte-reversed instructions each time it accesses something within this
struct. Declaring my struct like this in the PowerPC code could make
my binary file little endian, as well as its memory image in the
PowerPC processor, and no conversions would be necessary.

Is it possible to do something like this with gcc? If not, would it be
too hard to implement?

Thank you in advance for your answer.

Kind regards,
Roberto Barbieri Carrera



More information about the Gcc-help mailing list