First post, by corto
Hi all
This is my first post in this forum in which I already looked for information. I am a developer and a PowerPC fan. I spent much time profiling dosbox on PowerPC and applied some changes using the normal core but as it is very to optimize, I would like to work on the dynrec core.
I compiled with the file "risc_ppc.h" that I found in the archive for the Wii but that crashes at the beginning (gen_return_function is called before gen_run_code and access the stack that is not initialized).
1. First, I would like to understand what do gen_run_code and gen_return_function and exactly how they are used. As the code in a block is called like a C function, I think they are used as prolog and epilog (like with MIPS).
2. When I look at the MIPS function "gen_run_code", I see "jr $a0" that means there is a jump to register $a0 (R4), so that the code to execute is given in $a0 but its value not given explicitely anywhere. And how the code comes back at the end of the code execution ? The epilog had been put at the end of the code ?
3. So please, does anyone could explain the mechanism of all that ?
4. If there is an error in the generated code, is there a possibility to check the content of a block that is under execution ?
5. In the PowerPC part, registers are saved and restored : is it necessary because I suppose the PPC has enough volatile registers, r3 to r8, to use in the translated code ? How are handled nested function calls ? As in the generated PPC code, parameters will be put in r3, r4, ... is there a risk that these registers may be trashed ? The MIPS version doesn't seem to prevent that.
Thanks,
Corto