[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] target/arm: ensure we use current exception state after S
From: |
Richard Henderson |
Subject: |
Re: [PATCH v2] target/arm: ensure we use current exception state after SCR update |
Date: |
Thu, 12 Dec 2019 06:36:39 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 |
On 12/12/19 3:47 AM, Alex Bennée wrote:
> A write to the SCR can change the effective EL by droppping the system
> from secure to non-secure mode. However if we use a cached current_el
> from before the change we'll rebuild the flags incorrectly. To fix
> this we introduce the ARM_CP_NEWEL CP flag to indicate the new EL
> should be used when recomputing the flags.
>
> Signed-off-by: Alex Bennée <address@hidden>
> Tested-by: Philippe Mathieu-Daudé <address@hidden>
> Cc: Richard Henderson <address@hidden>
> Message-Id: <address@hidden>
>
> ---
> v2
> - don't override a ARM_CP_SPECIAL, use a new flag
> ---
> target/arm/cpu.h | 8 ++++++--
> target/arm/helper.h | 1 +
> target/arm/helper.c | 14 +++++++++++++-
> target/arm/translate.c | 6 +++++-
> 4 files changed, 25 insertions(+), 4 deletions(-)
Reviewed-by: Richard Henderson <address@hidden>
> if (arm_dc_feature(s, ARM_FEATURE_M)) {
> gen_helper_rebuild_hflags_m32(cpu_env, tcg_el);
> } else {
> - gen_helper_rebuild_hflags_a32(cpu_env, tcg_el);
> + if (ri->type & ARM_CP_NEWEL) {
> + gen_helper_rebuild_hflags_a32_newel(cpu_env);
> + } else {
> + gen_helper_rebuild_hflags_a32(cpu_env, tcg_el);
> + }
> }
If you tweak this again, an else if would be appropriate.
r~