Skip to contentSkip to conversation

target-arm: correctly UNDEF writes to FPINST/FPINST2 from EL0

PATCH In review Peter Maydell 2 participants 2 messages Oct 10, 2014 – Oct 11, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-arm: correctly UNDEF writes to FPINST/FPINST2 from EL0

The ARM ARM requires that the FPINST and FPINST2 VFP control registers are not accessible to code at EL0. We were already correctly implementing this for reads of these registers; add the missing check for the write code path.

---
 target-arm/translate.c | 3 +++
 1 file changed, 3 insertions(+)
target-arm/translate.c +3 -0
index 8a2994f..d8ee2e4 100644
@@ -3199,6 +3199,9 @@ static int disas_vfp_insn(CPUARMState * env, DisasContext *s, uint32_t insn)
                             break;
                         case ARM_VFP_FPINST:
                         case ARM_VFP_FPINST2:
+                            if (IS_USER(s)) {
+                                return 1;
+                            }
                             tmp = load_reg(s, rd);
                             store_cpu_field(tmp, vfp.xregs[rn]);
                             break;
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Peter Maydell

The ARM ARM requires that the FPINST and FPINST2 VFP control registers are not accessible to code at EL0. We were already correctly implementing this for reads of these registers; add the missing check for the write code path.

Thanks,

Laurent

Quoted 21 lines
---
 target-arm/translate.c | 3 +++
 1 file changed, 3 insertions(+)
target-arm/translate.c +3 -1
index 8a2994f..d8ee2e4 100644
@@ -3199,6 +3199,9 @@ static int disas_vfp_insn(CPUARMState * env, DisasContext *s, uint32_t insn)
                             break;
                         case ARM_VFP_FPINST:
                         case ARM_VFP_FPINST2:
+                            if (IS_USER(s)) {
+                                return 1;
+                            }
                             tmp = load_reg(s, rd);
                             store_cpu_field(tmp, vfp.xregs[rn]);
                             break;
--

1.9.1