OSDN Git Service

target/arm: Implement FGT trapping infrastructure
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 30 Jan 2023 18:24:45 +0000 (18:24 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 3 Feb 2023 12:59:23 +0000 (12:59 +0000)
commit361c33f6b899a1ddb88a08dc99957419def6086d
tree132f39b2a447e2058bbe472a3638f674eca272cb
parent15126d9ce2858f472d671960db30aed64fd4f694
target/arm: Implement FGT trapping infrastructure

Implement the machinery for fine-grained traps on normal sysregs.
Any sysreg with a fine-grained trap will set the new field to
indicate which FGT register bit it should trap on.

FGT traps only happen when an AArch64 EL2 enables them for
an AArch64 EL1. They therefore are only relevant for AArch32
cpregs when the cpreg can be accessed from EL0. The logic
in access_check_cp_reg() will check this, so it is safe to
add a .fgt marking to an ARM_CP_STATE_BOTH ARMCPRegInfo.

The DO_BIT and DO_REV_BIT macros define enum constants FGT_##bitname
which can be used to specify the FGT bit, eg
   .fgt = FGT_AFSR0_EL1
(We assume that there is no bit name duplication across the FGT
registers, for brevity's sake.)

Subsequent commits will add the .fgt fields to the relevant register
definitions and define the FGT_nnn values for them.

Note that some of the FGT traps are for instructions that we don't
handle via the cpregs mechanisms (mostly these are instruction traps).
Those we will have to handle separately.

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-10-peter.maydell@linaro.org
Message-id: 20230127175507.2895013-10-peter.maydell@linaro.org
target/arm/cpregs.h
target/arm/cpu.h
target/arm/helper.c
target/arm/internals.h
target/arm/op_helper.c
target/arm/translate-a64.c
target/arm/translate.c
target/arm/translate.h