[Scummvm-devel] Wii & Gamecube (resp. PowerPC) vs. unaligned memory access

Max Horn max at quendi.de
Fri May 6 13:08:13 CEST 2011


Am 05.05.2011 um 19:04 schrieb Andre Heider:
[...]

> Hi,
> 
> ugh, it's been a while, but as far as I remember not every powerpc is
> capable of that. Accessing unaligned addresses on a 750CL using >8bit
> instructions that cross a 64bit boundary shouldn't work. Maybe with a
> fault handler that acts on alignment exceptions and splits the access.
> Anyway, the broadway on the Wii requires alignment on certain
> instructions, and I think I added need_memalign because I ran into the
> issue. Maybe just with -fstrict-aliasing (which is implied by >= -O2),
> but I really can't remember. Also, we run on bare metal there and the
> hardware exception handler of the homebrew libs halts in the case of
> an alignment exceptions.

Upon reading the 750CL data sheets <https://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/2F33B5691BBB8769872571D10065F7D5>, I found this on page 9, section 1.1

* Has single-cycle misaligned access within a doubleword boundary
...
* Supports big-endian and little-endian byte addressing
* Supports misaligned little-endian in hardware

So like most (all?) PowerPC processors, both LE and BE are supported, but only in LE mode is unaligned access valid; but as we know, the Wii operates in BE mode. Bummer. But at least that explains it :).

Cheers,
Max



More information about the Scummvm-devel mailing list