]> www.infradead.org Git - qemu-nvme.git/commit
target/openrisc: Use cpu_unwind_state_data for mfspr
authorRichard Henderson <richard.henderson@linaro.org>
Mon, 24 Oct 2022 12:55:26 +0000 (22:55 +1000)
committerRichard Henderson <richard.henderson@linaro.org>
Mon, 31 Oct 2022 21:31:41 +0000 (08:31 +1100)
commitcc30dc441b44ad15f4adfb13d9a68cba6fa39a23
treef916f7faa1a1be4beba2bfa18729abc338e3d0e6
parent5813c5c74a755fd0c1b10be38c6fdf5c54c468e4
target/openrisc: Use cpu_unwind_state_data for mfspr

Since we do not plan to exit, use cpu_unwind_state_data
and extract exactly the data requested.

This is a bug fix, in that we no longer clobber dflag.

Consider:

        l.j       L2         // branch
        l.mfspr   r1, ppc    // delay

L1:     boom
L2:     l.lwa     r3, (r4)

Here, dflag would be set by cpu_restore_state (because that is the current
state of the cpu), but but not cleared by tb_stop on exiting the TB
(because DisasContext has recorded the current value as zero).

The next TB begins at L2 with dflag incorrectly set.  If the load has a
tlb miss, then the exception will be delivered as per a delay slot:
with DSX set in the status register and PC decremented (delay slots
restart by re-executing the branch). This will cause the return from
interrupt to go to L1, and boom!

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
target/openrisc/sys_helper.c