mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
target/arm: Implement the HFGITR_EL2.SVC_EL0 and SVC_EL1 traps
Implement the HFGITR_EL2.SVC_EL0 and SVC_EL1 fine-grained traps. These trap execution of the SVC instruction from AArch32 and AArch64. (As usual, AArch32 can only trap from EL0, as fine grained traps are disabled with an AArch32 EL1.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Fuad Tabba <tabba@google.com> Message-id: 20230130182459.3309057-22-peter.maydell@linaro.org Message-id: 20230127175507.2895013-22-peter.maydell@linaro.org
This commit is contained in:
parent
5572f7557f
commit
34a8a07e57
5 changed files with 40 additions and 4 deletions
|
@ -11842,6 +11842,20 @@ ARMMMUIdx arm_mmu_idx(CPUARMState *env)
|
|||
return arm_mmu_idx_el(env, arm_current_el(env));
|
||||
}
|
||||
|
||||
static inline bool fgt_svc(CPUARMState *env, int el)
|
||||
{
|
||||
/*
|
||||
* Assuming fine-grained-traps are active, return true if we
|
||||
* should be trapping on SVC instructions. Only AArch64 can
|
||||
* trap on an SVC at EL1, but we don't need to special-case this
|
||||
* because if this is AArch32 EL1 then arm_fgt_active() is false.
|
||||
* We also know el is 0 or 1.
|
||||
*/
|
||||
return el == 0 ?
|
||||
FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, SVC_EL0) :
|
||||
FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, SVC_EL1);
|
||||
}
|
||||
|
||||
static CPUARMTBFlags rebuild_hflags_common(CPUARMState *env, int fp_el,
|
||||
ARMMMUIdx mmu_idx,
|
||||
CPUARMTBFlags flags)
|
||||
|
@ -11927,6 +11941,9 @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el,
|
|||
|
||||
if (arm_fgt_active(env, el)) {
|
||||
DP_TBFLAG_ANY(flags, FGT_ACTIVE, 1);
|
||||
if (fgt_svc(env, el)) {
|
||||
DP_TBFLAG_ANY(flags, FGT_SVC, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (env->uncached_cpsr & CPSR_IL) {
|
||||
|
@ -12068,6 +12085,9 @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
|
|||
if (FIELD_EX64(env->cp15.fgt_exec[FGTREG_HFGITR], HFGITR_EL2, ERET)) {
|
||||
DP_TBFLAG_A64(flags, FGT_ERET, 1);
|
||||
}
|
||||
if (fgt_svc(env, el)) {
|
||||
DP_TBFLAG_ANY(flags, FGT_SVC, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (cpu_isar_feature(aa64_mte, env_archcpu(env))) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue