mirror of https://github.com/xemu-project/xemu.git
target/arm: Tidy sve_exception_el for CPACR_EL1 access
Extract entire fields for ZEN and FPEN, rather than testing specific bits. This makes it easier to follow the code versus the ARM spec. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Zenghui Yu <yuzenghui@huawei.com> Message-id: 20220127063428.30212-3-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
63888fa78b
commit
7701cee545
|
@ -6154,30 +6154,28 @@ int sve_exception_el(CPUARMState *env, int el)
|
||||||
uint64_t hcr_el2 = arm_hcr_el2_eff(env);
|
uint64_t hcr_el2 = arm_hcr_el2_eff(env);
|
||||||
|
|
||||||
if (el <= 1 && (hcr_el2 & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) {
|
if (el <= 1 && (hcr_el2 & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) {
|
||||||
bool disabled = false;
|
/* Check CPACR.ZEN. */
|
||||||
|
switch (extract32(env->cp15.cpacr_el1, 16, 2)) {
|
||||||
/* The CPACR.ZEN controls traps to EL1:
|
case 1:
|
||||||
* 0, 2 : trap EL0 and EL1 accesses
|
if (el != 0) {
|
||||||
* 1 : trap only EL0 accesses
|
break;
|
||||||
* 3 : trap no accesses
|
}
|
||||||
*/
|
/* fall through */
|
||||||
if (!extract32(env->cp15.cpacr_el1, 16, 1)) {
|
case 0:
|
||||||
disabled = true;
|
case 2:
|
||||||
} else if (!extract32(env->cp15.cpacr_el1, 17, 1)) {
|
|
||||||
disabled = el == 0;
|
|
||||||
}
|
|
||||||
if (disabled) {
|
|
||||||
/* route_to_el2 */
|
/* route_to_el2 */
|
||||||
return hcr_el2 & HCR_TGE ? 2 : 1;
|
return hcr_el2 & HCR_TGE ? 2 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check CPACR.FPEN. */
|
/* Check CPACR.FPEN. */
|
||||||
if (!extract32(env->cp15.cpacr_el1, 20, 1)) {
|
switch (extract32(env->cp15.cpacr_el1, 20, 2)) {
|
||||||
disabled = true;
|
case 1:
|
||||||
} else if (!extract32(env->cp15.cpacr_el1, 21, 1)) {
|
if (el != 0) {
|
||||||
disabled = el == 0;
|
break;
|
||||||
}
|
}
|
||||||
if (disabled) {
|
/* fall through */
|
||||||
|
case 0:
|
||||||
|
case 2:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue