PowerPC Programming
From Applepedia
This page is intended as a repository of useful links relating to the use of PowerPC processors as found in G4 and G5 Macs. Altivec specific information is on another page.
Contents |
What is the PowerPC?
PowerPC is a RISC microprocessor architecture created by the 1991 Apple-IBM-Motorola alliance, known as AIM. Originally intended for workstations, PowerPC CPUs have since become popular embedded and high-performance processors as well. PowerPC was the cornerstone of AIM's PReP and Common Hardware Reference Platform initiatives in the 1990s, but the architecture found the most success in the personal computer market in Apple's Power Macintosh line from 1997 - 2005. PowerPC is largely based on IBM's earlier (but retroactively named) POWER architecture, and retains a high level of compatibility with it; the architectures have remained close enough that the same programs and operating systems will run on both if some care is taken in preparation.[1]
Recently, PowerPC has frequently been called a Poor Person's Computer due to its stigma as being outdated as of the Intel switch.
Which PowerPC processor does my Mac use?
If you've bought a Mac in the last nine months, you're stuck with an Intel processor.
If you have a G4 desktop or laptop, your processor is of the Freescale MPC7XXX series. This will help you find relevant documentation on Freescale's website. It's only needed for the more specific details of your processor.
If you have a G5 desktop, your processor is of the IBM PowerPC 970 series. You can find documentation at IBM's website.
Tips & Tricks
- gcc -S butan.c will translate a C program to assembly. Try the -O3 flag to get more optimized code, if the code doesn't do what you expect it to do try -O0 to turn off optimizations.
- otool -tdv executable.o will disassemble an executable.
- /Developer/Tools/PPCExplain addi will explain an instruction.
Links
Introductory
- PowerPC Architecture: A simple explanation of a few things you should know before you start programming the PPC.
- PowerPC Technical TidbitsO Introduction to the register set and addressing modes.
- Beginner Assembly Language for PPC Darwin: A clear introduction to PPC assembly.
- PowerPC Assembly Programming on the Mac Mini: Another introduction.
- Mac OS X PPC Shellcode Tricks
- PowerPC/OS X Shellcode Assembly - "Smashing The Mac For Fun & Profit": Watch out for "b-r00t" the el33t hacker!
Quick Reference
- PowerPC Microprocessor Family: The Programmer's Reference Guide by IBM: Very, very handy. Print this out.
- Simplified Mnemonics for PowerPC Instructions by Freescale: Simplified versions of some commonly used instructions.
Reference
- Mac OS X Assembler Guide: Assembler syntax and OS X specific information.
- Book I: PowerPC User Instruction Set Architecture by IBM: This book defines the instructions, registers, etc., typically used by application programs.
- Programming Environments Manual for 32-bit Implementations of the PowerPC Architecture by Freescale: Dense, huge huge reference. Has a ton of stuff that's not useful unless you're writing an entire operating system, but this is where I usually end up when I want a detailed explanation of what an instruction does or how it works.
News & Community
- ppcnerds.org: Very Linux/FOSS oriented
- ppczone.org
- IBM Developerworks Power Zone: Plenty of interesting articles, white papers, and other resources.
- IBM's PowerPC Blog: PPC enters the Blogosphere
- IBM's PowerPC Newsletter: PowerPC news and articles.

