target/arm: Enforce FP access to FPCR/FPSR
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20180211205848.4568-3-richard.henderson@linaro.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
5d1e699988
commit
fe03d45f9e
@ -1714,7 +1714,7 @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ARMCPRegInfo type field bits. If the SPECIAL bit is set this is a
|
/* ARMCPRegInfo type field bits. If the SPECIAL bit is set this is a
|
||||||
* special-behaviour cp reg and bits [15..8] indicate what behaviour
|
* special-behaviour cp reg and bits [11..8] indicate what behaviour
|
||||||
* it has. Otherwise it is a simple cp reg, where CONST indicates that
|
* it has. Otherwise it is a simple cp reg, where CONST indicates that
|
||||||
* TCG can assume the value to be constant (ie load at translate time)
|
* TCG can assume the value to be constant (ie load at translate time)
|
||||||
* and 64BIT indicates a 64 bit wide coprocessor register. SUPPRESS_TB_END
|
* and 64BIT indicates a 64 bit wide coprocessor register. SUPPRESS_TB_END
|
||||||
@ -1735,24 +1735,25 @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
|
|||||||
* need to be surrounded by gen_io_start()/gen_io_end(). In particular,
|
* need to be surrounded by gen_io_start()/gen_io_end(). In particular,
|
||||||
* registers which implement clocks or timers require this.
|
* registers which implement clocks or timers require this.
|
||||||
*/
|
*/
|
||||||
#define ARM_CP_SPECIAL 1
|
#define ARM_CP_SPECIAL 0x0001
|
||||||
#define ARM_CP_CONST 2
|
#define ARM_CP_CONST 0x0002
|
||||||
#define ARM_CP_64BIT 4
|
#define ARM_CP_64BIT 0x0004
|
||||||
#define ARM_CP_SUPPRESS_TB_END 8
|
#define ARM_CP_SUPPRESS_TB_END 0x0008
|
||||||
#define ARM_CP_OVERRIDE 16
|
#define ARM_CP_OVERRIDE 0x0010
|
||||||
#define ARM_CP_ALIAS 32
|
#define ARM_CP_ALIAS 0x0020
|
||||||
#define ARM_CP_IO 64
|
#define ARM_CP_IO 0x0040
|
||||||
#define ARM_CP_NO_RAW 128
|
#define ARM_CP_NO_RAW 0x0080
|
||||||
#define ARM_CP_NOP (ARM_CP_SPECIAL | (1 << 8))
|
#define ARM_CP_NOP (ARM_CP_SPECIAL | 0x0100)
|
||||||
#define ARM_CP_WFI (ARM_CP_SPECIAL | (2 << 8))
|
#define ARM_CP_WFI (ARM_CP_SPECIAL | 0x0200)
|
||||||
#define ARM_CP_NZCV (ARM_CP_SPECIAL | (3 << 8))
|
#define ARM_CP_NZCV (ARM_CP_SPECIAL | 0x0300)
|
||||||
#define ARM_CP_CURRENTEL (ARM_CP_SPECIAL | (4 << 8))
|
#define ARM_CP_CURRENTEL (ARM_CP_SPECIAL | 0x0400)
|
||||||
#define ARM_CP_DC_ZVA (ARM_CP_SPECIAL | (5 << 8))
|
#define ARM_CP_DC_ZVA (ARM_CP_SPECIAL | 0x0500)
|
||||||
#define ARM_LAST_SPECIAL ARM_CP_DC_ZVA
|
#define ARM_LAST_SPECIAL ARM_CP_DC_ZVA
|
||||||
|
#define ARM_CP_FPU 0x1000
|
||||||
/* Used only as a terminator for ARMCPRegInfo lists */
|
/* Used only as a terminator for ARMCPRegInfo lists */
|
||||||
#define ARM_CP_SENTINEL 0xffff
|
#define ARM_CP_SENTINEL 0xffff
|
||||||
/* Mask of only the flag bits in a type field */
|
/* Mask of only the flag bits in a type field */
|
||||||
#define ARM_CP_FLAG_MASK 0xff
|
#define ARM_CP_FLAG_MASK 0x10ff
|
||||||
|
|
||||||
/* Valid values for ARMCPRegInfo state field, indicating which of
|
/* Valid values for ARMCPRegInfo state field, indicating which of
|
||||||
* the AArch32 and AArch64 execution states this register is visible in.
|
* the AArch32 and AArch64 execution states this register is visible in.
|
||||||
|
@ -3356,10 +3356,12 @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
|
|||||||
.writefn = aa64_daif_write, .resetfn = arm_cp_reset_ignore },
|
.writefn = aa64_daif_write, .resetfn = arm_cp_reset_ignore },
|
||||||
{ .name = "FPCR", .state = ARM_CP_STATE_AA64,
|
{ .name = "FPCR", .state = ARM_CP_STATE_AA64,
|
||||||
.opc0 = 3, .opc1 = 3, .opc2 = 0, .crn = 4, .crm = 4,
|
.opc0 = 3, .opc1 = 3, .opc2 = 0, .crn = 4, .crm = 4,
|
||||||
.access = PL0_RW, .readfn = aa64_fpcr_read, .writefn = aa64_fpcr_write },
|
.access = PL0_RW, .type = ARM_CP_FPU,
|
||||||
|
.readfn = aa64_fpcr_read, .writefn = aa64_fpcr_write },
|
||||||
{ .name = "FPSR", .state = ARM_CP_STATE_AA64,
|
{ .name = "FPSR", .state = ARM_CP_STATE_AA64,
|
||||||
.opc0 = 3, .opc1 = 3, .opc2 = 1, .crn = 4, .crm = 4,
|
.opc0 = 3, .opc1 = 3, .opc2 = 1, .crn = 4, .crm = 4,
|
||||||
.access = PL0_RW, .readfn = aa64_fpsr_read, .writefn = aa64_fpsr_write },
|
.access = PL0_RW, .type = ARM_CP_FPU,
|
||||||
|
.readfn = aa64_fpsr_read, .writefn = aa64_fpsr_write },
|
||||||
{ .name = "DCZID_EL0", .state = ARM_CP_STATE_AA64,
|
{ .name = "DCZID_EL0", .state = ARM_CP_STATE_AA64,
|
||||||
.opc0 = 3, .opc1 = 3, .opc2 = 7, .crn = 0, .crm = 0,
|
.opc0 = 3, .opc1 = 3, .opc2 = 7, .crn = 0, .crm = 0,
|
||||||
.access = PL0_R, .type = ARM_CP_NO_RAW,
|
.access = PL0_R, .type = ARM_CP_NO_RAW,
|
||||||
|
@ -1631,6 +1631,9 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if ((ri->type & ARM_CP_FPU) && !fp_access_check(s)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) {
|
if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) {
|
||||||
gen_io_start();
|
gen_io_start();
|
||||||
|
Loading…
Reference in New Issue
Block a user