Welcome! Log In Create A New Profile


JIT compiler for E-UAE WII

Posted by oibaf 
JIT compiler for E-UAE WII
February 01, 2014 02:26PM
I am trying to include a JIT compiler in UAE Wii using the code taken from this project:


I am in touch with the author of the code but until now I did not succeed in getting a working code.

A Program (Illegal instruction and Privileged instruction) or a DSI exception is raised as soon as the compiling starts.
The compiler loads the code to be executed in a cache which memalign allocates in MEM2 (I checked that there is no memory left in MEM1).

My question is: Can the code to be executed in MEM2?
My doubt comes from the fact that dol loaders I looked at load the executable code in MEM1.

Before executing the code I call a DCFlushRange on the instruction cache. The coder of the JIT compiler suggested me to also add "ICInvalidateRange" to be sure that the cache is invalidated.

Is this additional instruction necessary? And Why?

As far as I understand DCFlushRange already invalidates the cache.

If I use this additional instruction the Wii hangs with a strange noise.

Thanks in advance for the help.

Edited 1 time(s). Last edit at 02/01/2014 02:27PM by oibaf.
Re: JIT compiler for E-UAE WII
February 22, 2014 01:40AM
Code can be executed from MEM2.
If you are placing new code in memory you should use DCFlushRange followed by ICInvalidateRange. The first function makes sure the new code is flushed from the CPU's data cache to the physical memory, the second function removes any old instructions for that memory region from the CPU's instruction cache.

One problem that can occur when placing dynamic code in MEM2 is if the dynamic code tries to call non-dynamic functions (which will be in MEM1), the branch offset will be larger than +/- 32MB which means a simple branch instruction cannot be used for the call.
Re: JIT compiler for E-UAE WII
February 23, 2014 11:32PM
Thanks a lot.
Sorry, only registered users may post in this forum.

Click here to login