August 18, 2010 // 7:05 pm
- Today Disane
has made available a guide to reversing on PS3 Linux using the GNU Toolchain.
Prerequisites for it include computer science, assembly and C knowledge along with having available the GNU toolchain for the Cell Processor installed on PS3 Linux.
• IBM Introduction to PowerPC assembly
• MacTech PPC assembly introduction
• IBM's article series (1-4) on PowerPC assembly
• Beginners guide to PPC32 assembly
• MacTech PPC Function Calls
• PPC ABI
• IBM developers guide to the PPC architecture
• PPC compiler writers guide
Official PPC32-64 Docs:
Cell Processor SPU assembly:
• IBM SPU assembly article series
• About the SPU ABI
• Cell BE Linux ABI
• Cell Processor ABI
We are also going to use the following documentations when we are reversing SPU code:
• SPU language specification
• SPU Instruction Set Architecture
So now that we are through the introduction. Let's get down and dirty. The first thing we need is an application we can reverse. Well, we could try and reverse existing applications compiled on our PPC64 Linux but that would take too much time and besides this is not a book. So we are going to start with something very basic.
The application we are going to reverse today is the all times classic "Guessing Game" written in C. The idea is simple. The computer generates a number between 1 and 10 and the player has to guess which number has the computer generated. Simple, right? In C probably yes but in PPC and SPU assembly this could be a real challenge even for experienced programmers.
Well we are not going to write the game in PPC and SPU assembly simply because of two reasons. The first one is that C is portable code. We can compile our C code to run on the PPU or on the SPU. Cool, what's the other reason? Well the other reason is that this is a tutorial on reversing SPU and PPU code and not an assembly tutorial.
About the sample code I'm going to show you. We are not going to use classes or anything fancy this is a classic C (sequential programming 101) so no Object Oriented Programming introduced. No exceptions to invoke or anything fancy. We are going to use one single Game Loop to keep the game going until the player wins (yeah you can't lose in this game, but you can modify it if you want, the possibilities are endless).
Alright so let's fire up Linux on our PS3 and open up the Terminal. I don't know about you, but I've got Ubuntu 10.4 on my machine. Locate a nice spot like ~/Projects/Reversing/guessing_game/ (use cd command to get to you home directory then mkdir to create the directories you need) and here we can create a text document using gedit or nano (type in gedit or nano).
The rest of the Guide to Reversing on PS3 Linux Using the GNU Toolchain can be found HERE
or linked above!