site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Shantonu Sen ssen@apple.com Sent from my Mac Pro On Apr 23, 2008, at 10:01 AM, Bob Murphy wrote: Here are a few things I've discovered: And any advice will be gratefully appreciated. - Bob _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/ssen%40apple.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This doesn't seem like a kernel issue, and Rosetta is not part of Darwin. You might have better luck contacting the author or development team of mach_star. However, I will leave you with this thought experiment: Do you believe that ./osfmk/ppc/status.c is compiled into the Intel I386 kernel running on Intel-based Macintosh? Has anybody gotten Jonathan Rentzsch's mach_star system to work with Rosetta? The latest versions of mach_star, modified by Bertrand Guihéneuf and others, work fine if the target process's executable is a PPC exe running on a PPC chip, or an x86 exe running on an x86 chip. However, code injection doesn't work for a PPC exe running under Rosetta. I've been trying to get this to work, but have run into some problems, and was hoping that either somebody has succeeded at this, or can at least provide some pointers. - A PPC source exe that works fine at injecting particular PPC target exes on a PowerMac G5, fails when running in Rosetta on a MacBook. - Most of the injection process (allocating memory in the target process, etc.) succeeds. Where things fail is inside thread_create_running(). When you feed it a PPC_THREAD_STATE thread state flavor when running on an x86 CPU, it returns an error code of KERN_INVALID_ARGUMENT. This happens no matter whether the calling process is an x86 or PPC exe. - It looks like things are failing in xnu, in machine_thread_set_state(). This is a routine that sets up the thread based on register contents and so on. In recent kernels, there are two versions of this, one for x86 (osfmk/i386/pcb.c) and one for PPC (osfmk/ppc/status.c). Each of these has a switch block that handles the allowable thread state flavors for the hardware. And if you try to use a thread state flavor for PPC in an x86 kernel (or vice versa), the switch block hits the default and returns KERN_INVALID_ARGUMENT. There may be other places code injection on Rosetta will also fail; I haven't determined that yet. The only solution I've been able to think of so far is to abstract the PPC thread setup code from osfmk/ppc/status.c and do it in my injector. But if there's an easier, or proven, way to accomplish the task, that would be better. This email sent to ssen@apple.com This email sent to site_archiver@lists.apple.com