On 10/30/26 04:28, Peter Maydell wrote:
In the pre_hvc helper, we have a "bool secure = false" and a FIXME comment that we should use the actual Secure state. This is a signpost to the fact that we're not getting the UNDEF cases right. Specifically, we get most of them correct but are missing the ones related to Secure state:* For A64: HVC must UNDEF at EL1 if EL2 is not enabled in the current Security state * For v8 A32/T32, HVC must UNDEF in Secure state, if EL2 is not enabled in the current Security state * For v7, HVC must UNDEF in Secure state The v7 requirement is identical to the v8 A32/T32 one, since there is no Secure EL2 in v7. This fixes a bug where HVC should have UNDEFed but instead trapped when in Secure state with Secure EL2 disabled. The bug is unlikely to affect real-world code, because only test code puts itself in a situation where HVC should UNDEF and then executes HVC and requires it to UNDEF. This was noticed by Coverity, because the "if (secure && ...)" check was dead code. CID: 1689834 Cc:[email protected] Fixes: 35979d71c401 ("target-arm: A64: Emulate the HVC insn") Signed-off-by: Peter Maydell<[email protected]> --- target/arm/tcg/op_helper.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
Reviewed-by: Richard Henderson <[email protected]> r~
