[NTLK] Einstein Xcode project cleanup

Jake Bordens jake at allaboutjake.com
Wed Dec 3 15:16:07 EST 2014

>Ouch. But (just confirming I understand), cjit lets us reconstruct those 
>natively so we don't have to simulate the MMU any more?
>In other words, we don't have to manually rewrite all 18,000+ functions?  

Might want to review Matthias's message 
(http://marc.info/?l=newtontalk&m=140459537002746&w=2) on this subject, 
but I'll give you my understanding.

The cjit decompiler generates calls to the MMU using 
ioCPU->ManagedMemoryRead().  If the requested memory location is readily 
available, then this works fine.  If its a page that needs to be created 
or loaded, then an interrupt is generated that does the processing before 
returning to the original instruction. 

If you try to simulate the code using a compiled function and access a 
protected memory area, the ManagedMemoryRead eventually triggers a 
DataAbort exception, which I believe hands the the processing back to the 
emulator.  In my experimentation, this didn't really seem to work. The way 
I tested this was to cjit generate the code for memcpy() which hits the 
MMU pretty hard.  Then try to install a package which uses memcpy, and you 
should see the DataAborts in the console.  In my testing, the package 
install fails... So I guess something is going wrong as it hands 
processing back to the emulator.

>It would be great if Matthias could check in and let us know how we could 
>help with those.  Don't want to duplicate effort, especially really hard 
>effort!  But at the same time, happy and eager to help in literally any 
>way possible.

I'm sure you've seen Matthias' pages here: 
http://www.elektriktrick.com/NewtOS.html  He goes into how people can help 
on the 'contribute' page.  I'm not sure what tasks have been claimed.

>Funny, I actually had that at one point.  The disassembly in MySQL, and a 
>PHP front-end so you could browse, jump to an address, etc.  I wonder if 
>I kept any of that code... It was pretty gross.

I can post what I have for you to look at.  It is equally cringe inducing, 
I suspect.  I used the cjit decompiler not a real arm disassembler for my 
analysis, since it was easy to find things like MMU access by looking for 
ManagedMemory() calls, etc.

More information about the NewtonTalk mailing list