Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Intel corner

Detecting Rosetta

Are we running under emulation?

Issue: 5.1 (September/October 2006)
Author: Christian Schmitz, cSchmitz-at-rbdeveloper.com
Article Description: No description available.
Article Length (in bytes): 5,960
Starting Page Number: 44
RBD Number: 5119
Resource File(s):

Download Icon 5119.sit Updated: Friday, September 29, 2006 at 11:34 AM
Download Icon 5119.zip Updated: Friday, September 29, 2006 at 11:34 AM

Related Link(s): None
Known Limitations: None

Excerpt of article text...

Recently someone asked about how to detect whether or not the application is running using Rosetta. Rosetta is Apple's name for the PowerPC emulator in Mac OS X which enables Macs with Intel CPUs to run PowerPC applications.

Knowing, from inside your application, whether the CPU is emulated or not is quite useful. You may have platform-dependent code in external libraries and need to load the correct one. Or you may need to use different code depending on whether or not the application is running under emulation.

How to check for Rosetta

There are several ways to detect Rosetta. Most of them query some specific setting from the operation system to check for a certain value. Apple describes a way in their documentation which checks for the presence of a specific key. The approach we take here is to check for a special value in a kernel variable. The kernel variable, labeled "model", contains the model name of the machine. While this variable will be model-specific on an actual PowerPC Mac, under emulation the variable will always be the same. Inside Rosetta we always get the model name "PowerMac" while on a PowerMac G5 the value is "PowerMac8,3", where the eight is for the eighth generation and the three is for the third release. On an iBook G4 the value is, for example, "PowerBook6,7".

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com