[NTLK] Einstein news?

Steven Frank stevenf at panic.com
Thu May 26 11:23:49 EDT 2016

> On May 25, 2016, at 5:27 PM, Jake Bordens <jake at allaboutjake.com> wrote:
> I suspect we'll look back on all the "#if !__has_feature(objc_arc)" stuff soon and think the same as we do about the nibs vs. storyboards, but for now its good to be able to compile it both ways.  ARC should definitely be the default now.

Now that I think about it, I don't think Xcode even ships with the necessary SDKs for pre-ARC versions of OS X any longer, so I'll probably go through and take those conditionals out (and the USE_STORYBOARDS conditionals too) sometime soon.

> I'm not sure if it really helps with leaks because there's a lot of malloc and free going on elsewhere for us to leak.

It won't prevent any leaks from C++ but I guess it's better than nothing.  :)

In other news, I tried to write my first native code injection for a ROM function and it didn't work, and I'm wondering if someone can tell me why.

I tried to pick a function that was short and fairly self-explanatory, just to understand the process of injection, rather than trying to get a big performance win.

I settled on IsSuperMode(), which I assume just checks to see if the CPU is in supervisor mode, and returns 1 in r0 if it is, otherwise 0.

	mrs     r0, cpsr
	and     r0, r0, #31
	cmp     r0, #16
	cmpne   r0, #0
	movne   r0, #1
	moveq   r0, #0
	mov     pc, lr

I added an entry for it in k717006VirtualizationPatches with the ROM address of the function (0x00394410), and added a case for it in the switch() statement in TVirtualizedCalls::Execute() and I can confirm that it was calling my injection when the emulator hit that address.

My injection was basically something like this:

inline void
TVirtualizedCalls::IsSuperMode( void )
	if ( mProcessor->GetMode() == TARMProcessor::kSupervisorMode )
		mProcessor->SetRegister(0, 1);
		mProcessor->SetRegister(0, 0);

I set a breakpoint in there and saw it get hit several times during boot, but eventually the emulator just got into some sort of reset loop and wouldn't boot all the way.  Obviously, I overlooked something, but I'm not sure what.  Any idea?


More information about the NewtonTalk mailing list