Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How smart is Rosetta?




On Jun 6, 2006, at 3:00 AM, Marc Stibane wrote:


Am 21. Jan 2006 um 18:50:15 schrieb George Warner:

On Sat, 21 Jan 2006 15:54:15 +0000, Richard Bannister <email@hidden>
wrote:

Scenario as follows.

Three players:
  - Program, a Carbon Mach-O PowerPC binary compiled with CodeWarrior.
  - Bundle A, a PowerPC code bundle compiled with CodeWarrior.
  - Bundle B, a Universal Binary code bundle compiled with Xcode.

Program loads a code module from bundle file A. Bundle file A loads a
code module from Bundle file B.

Is code from Bundle B going to be native on an Intel machine, or will
the PowerPC code be run emulated?

It's "all or nothing"; It ether runs completely in Rosetta or completely
native.


Can I launch an Intel-native Unix tool from a PPC PlugIn running inside a PPC app in Rosetta and then use AppleEvents to communicate?
Or, even better, can the Unix tool get its arguments via argc/argv[] and respond via printf(stdout...)?
Which "fine manual" should I read?

Yes, at least to the first question. I'm currently doing this by using LSOpenFSRef to launch an x86-native application, then using CFMessagePorts and POSIX-controlled shared memory to communicate with fairly decent performance. (Altivec on native PPC still blows SSE out of the water.) The global limit on shared memory appears to be 4MB, which is somewhat restrictive for my purposes (image-processing).... Anyway, Rosetta can be detected with the following bit of code:

bool CPSFMactel::IsRosetta() {
bool isRosetta = false;
    char model[32];
    size_t len = sizeof(model);
    int mib[2] = { CTL_HW, HW_MODEL };


    if (sysctl(mib, 2, &model, &len, NULL, 0) == 0) {
isRosetta = (len == 9 && strcmp(model, "PowerMac") == 0);
}


return isRosetta;
}

Hope this helps,

Ben
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: How smart is Rosetta? (From: Marc Stibane <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.