Hacker News new | ask | show | jobs
by winocm 775 days ago
32-bit PowerPC implementations do support little endian mode, but not from power-on reset. You can have a little stub handler that basically does the switch to LE by setting MSR.{LE,ILE} via srr1 and then performing a RFI after loading the return address into srr0.

It is notoriously difficult to write bi-endian code though. I really wish there were assembly directives to change the word swapping per instruction instead of doing it manually, for my own sanity.

I think the 970 supports this too, but it’s a bit weirder with the MSR.HV settings.

Note that little endian mode on PPC affects all memory accesses, including real mode when MSR.ILE is set.

1 comments

Given that PowerPC supports indexed load/store instructions with reversed endianness it's doesn't cost extra cycles or code size to access little-endian peripherals. The real problem is how fragile drivers are these days.