Re: Byte-reverse instructions in PowerPC Processors | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
Roberto Barbieri Carrera wrote:
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.
Portable device drivers often have similar issues.One I have recently seen is in the Linux kernel: drivers/net/e100.c You may be able to borrow the techniques used there.
David Daney
[Linux C Programming] [C Programming] [Kernel List] [eCos] [Fedora Development] [Fedora Announce] [Autoconf] [The DWARVES Debugging Tools] [Yosemite Campsites] [Yosemite News] [Linux GCC] [C++ How to Program]