Sunday, December 18

Architectural differences between PowerPC and x86

Here are some interesting bits of information I recently found while checking some documentation about the transition from Mac OS X/PowerPc to x86:

  • The x86 C-language calling convention specifies that arguments to functions are passed on the stack. The PowerPC ABI specifies that arguments to functions are passed in registers. Also, x86 has far fewer registers, so many local variables use the stack for their storage. Thus, programming errors,or other operations that access past the end of a local variable array or otherwise incorrectly manipulate values on the stack may be more likely to crash applications on x86 systems than on PowerPC.

  • A long double is 16 bytes on both architectures, but only 80 bits are significant in long double data types on Intel-based Macintosh computers. (damn legacy x87 fpu!)

  • An integer divide-by-zero operation is fatal on an x86 system but the operation continues on a PowerPC system, where it returns zero.
These last two differences are specially interesting when planning to port software from OS X/PowerPC to x86, since they could cause unexpected results and bugs in the new Intel Macs.

If you like this kind of topic, I highly recommend you the reading of the following articles by Ars Technica:

The Pentium 4 and the G4e: an Architectural Comparison: Part I
The Pentium 4 and the G4e: an Architectural Comparison: Part II

PowerPC, we will miss you on the desktop :-(

No comments: