QEMU crash during cpu reset (MIPS regression)
Resetting a MIPS cpu currently does not work, because important entries in env (CPUMIPSState) are filled with 0 at the beginning of function cpu_reset.
At system start, these values are set in cpu_mips_register.
After reset, env->nb_tlb == 0 results in a division by zero crash of QEMU.
We can either re-arrange the entries in CPUMIPSState (move those which must not be zero'ed to the end), or cpu_reset must call cpu_mips_register.
Which solution is better?
Stefan
Quoted 5 lines
We can either re-arrange the entries in CPUMIPSState (move those which must not be zero'ed to the end), or
cpu_resetmust callcpu_mips_register.Which solution is better?
ARM uses the latter solution.
IMHO it's better to do that than try and extend the hacks were some fields are left untouched by a reset.
Paul
Quoted 4 lines · Paul Brook
Quoted 4 lines
We can either re-arrange the entries in CPUMIPSState (move those which must not be zero'ed to the end), or
cpu_resetmust callcpu_mips_register.
Quoted 9 lines
Quoted 1 line
Which solution is better?
ARM uses the latter solution.
IMHO it's better to do that than try and extend the hacks were some fields are
left untouched by a reset.Paul
I had just implemented this 2nd solution. It was not sufficient because env->irq was also zero'ed, so Linux starts after reset without the MIPS timer interrupt which is not good :-).
Re-arranging env->irq is not a nice solution but it helped.
Stefan
Quoted 6 lines · Stefan Weil
Resetting a MIPS cpu currently does not work, because important entries in env (CPUMIPSState) are filled with 0 at the beginning of function
cpu_reset.At system start, these values are set in
cpu_mips_register.
Quoted 8 lines
After reset,
env->nb_tlb== 0 results in a division by zero crash of QEMU.We can either re-arrange the entries in CPUMIPSState (move those which must not be zero'ed to the end), or
cpu_resetmust callcpu_mips_register.Which solution is better?
I solved the same issue on Sparc side by not zeroing most of the state. This is in line with the real Sparc hardware.