Emulating a CPU in software is quite a trick. A programmer has to fool the operating system and the software running on top of the operating system into believing that it is on genuine hardware. This requires meticulously emulating every single instruction and mode that the CPU has to offer, which is immensely complex. SourceForge.net’s Novembers 2004 project of the month is PearPC, a PowerPC emulator. Its emulation is robust enough to allow Mac OS X to run on top of it (although slowly). The emulator runs under many hardware platforms and operating systems, including Windows and Linux, so if you want to run OS X or Linux PPC on an Intel platform, you can do it! PearPC, is one of the top 100 projects on SourceForge.net, boasting over a half a million downloads since its inception on SF.net. The SF.net team is proud to make PearPC, November 2004, project of the month.
Description of project:
PearPC is a platform indepedent PowerPC architecture emulator. It’s currently the only one that emulates enough hardware to run Mac OS X on a non-PowerPC architecture, and it can also run other OSes.
- OS: All 32-bit Microsoft Windows (95/98/NT/2000/XP), all POSIX (Linux/BSD/UNIX-like OSes), BeOS
- Environment: Win32 (Microsoft Windows), X11 applications
- Language: English with some German mished in as Easter eggs
- License: GPL
- Hardware requirements: Minimum 486 processor and 128 MB RAM. It’s especially optimized for x86 hardware, and I’d recommend a fast processor, but it works on other processors, too.
- Programming Language: Assembly, C, C++
- Development Status: 3 – Alpha, 4 – Beta
- Intended Audience: Developers, end users/desktop
- Topic: Emulators
Why and how did you get started?
Sebastian: I started PearPC around January 2003 as a just-for-fun project to learn a little bit about the PowerPC architecture. I wanted to know why there was no PowerPC emulator capable of booting Mac OS X.
Daniel: I got started because I saw the project on Slashdot. I got ahold of it, thought it was really cool, and then noticed that it didn’t have AltiVec support. Since I have done some AltiVec/SSE programming, and I’ve also worked on emulators, I thought I’d give it a shot. I’ve been working on getting the JITC AltiVec core to work ever since, and I still have only a fraction of the instructions emulated. It’s a very involved process getting a JITC emulation core to work; anyone who claims to have done it in anything less than a year would be a liar. Just to code up the generic core for the AltiVec core took me approximately 48 hours of work time. Getting it to work without any visible flaws took another two or three months.
What is the software’s intended audience?
Daniel: I see my work as getting the Mac OS X operating system out to people who just can’t afford the systems, or just don’t see the initial investment as a justifiable cost. Another target is those who are working on hobby OSes, since PearPC will allow them to test their OSes on a PowerPC architecture without threatening an existing system.
How many people do you believe are using your software?
This is hard to estimate. Guessing from the downloads I’d say 50,000 or more, since you can freely distribute PearPC.
What are a couple of notable examples of how people are using your software?
Most people are using PearPC for running Mac OS X on PCs. Typical usage is for testing Web sites with the Mac Internet Explorer or Safari, or porting/testing programs to Mac OS. But it could also be used as a OS development tool.
What gave you an indication that your project was becoming successful?
What has been your biggest surprise?
Sebastian: I was quite surprised that there are really so many people interested in the emulator. PearPC was merely meant as a hobbyist program, but it now has a huge community with dedicated sides like http://pearpc.net and lots of happy users.
What has been your biggest challenge?
Getting the code to work bug-free. It’s very frustrating. The primary core has about two years of progress on it, so it’s already pretty mature, but the AltiVec core is very new, and it still has a long way to go.
Why do you think your project has been so well received?
It fills a hole that’s been itching to be filled, and it’s never been done before to this level. It’s just amazing to anyone who actually sees it in action.
Where do you see your project going?
We’re going to make this project really good, and well-developed. It should be the best available high-speed emulator. I don’t imagine that a commercial company could match the maturity of our project in any viable timeframe to make it profitable.
What’s on your project wish list?
Sebastian: Improved emulation speed and support for more hardware. And a nice user interface, but that’s low priority for me.
Daniel: Well, our HWMMU project would be awesome. Having the hardware run the MMU would be great, because it would offload a significant amount of computational workload from the host processor. Sound and more native video rendering would be great, too. We have people working on both of these.
If you could change something about the project, what would it be?
Sebastian: It would be nice if I had written cleaner and more documented code right from the beginning. And it’s quite sad that I don’t have the time to answer all the requests I get by email. I recommend people ask questions in the forums or on the mailing lists.
How do you coordinate the project?
We use the SourceForge.net project page to keep track of bugs, RFEs, etc. Most of the development talk is coordinated over the pearpc-devel mailing list. And the current CVS is constantly tested by the community. Anyone who wants to work on something at this time is allowed to do so. Once Sebastian is satisfied with a patch, he’ll fold it into the main branch.
Do you work on the project full-time, or do you have another job?
Sebastian: I’m a computer science student at the RWTH Aachen, Germany.
Daniel: I spend a lot of time at my job.
If you work on the project part-time, how much time would you say you spend, per week, on it?
Sebastian: Perhaps 15 hours. But it depends; there are weeks when I spend more time with PearPC, and sometimes weeks when I don’t touch it at all.
Daniel: One to two hours a day, mostly just keeping in contact with people.
What is your development environment like?
Sebastian: I mainly use a Gentoo KDE GNU/Linux system running on an 1GHz Athlon processor. When I’m at my parents’ I use 233MHz Pentium II running Windows 98. Most of the programming work is done via the Midnight Commander.
Daniel: I have two machines — a 550MHz PowerBook G4 sitting next to an AthlonXP 3200+ desktop. The PowerBook is my reference platform. I run SUSE Linux and GNOME on the desktop for development. I use vi and make to do all my development. I do have Windows XP, but I use it only for gaming.
- Around Summer 2003: Linux boots the first time
- Around November 2003: Darwin/PPC boots the first time
- Around December 2003: Mac OS X boots the first time
- Around January 2004: Started with the just-in-time compiler
- 05/09/2004: First official release after creating the SourceForge.net project
- 13/06/2004: Version 0.2: BeOS support, RTL8139 emulation, speedups, …
- 12/08/2004: Version 0.3: accurate timers, idle-sleep, …
- Already in CVS: AltiVec emulation, support for native CD-ROMs/DVD-ROMs
- Initial efforts: Sound emulation, faster speed
How can others contribute?
They should pick something they want to improve, ask on the mailing list if somebody else is already working on it, and then start to implement it. We especially apreciate people who write good and detailed bug reports.