Skip to contentSkip to conversation

QEMU crash during cpu reset (MIPS regression)

Qemu-devel Stefan Weil 3 participants 4 messages May 4, 2007

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
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_reset must call cpu_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

#2 lore raw
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_reset must call cpu_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

#3 lore raw
In reply to Stefan Weil
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_reset must call cpu_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.