arch-arm: Fix EL2 target exception level for SP alignment fault.
authorJordi Vaquero <jordi.vaquero@metempsy.com>
Mon, 13 Jan 2020 09:47:55 +0000 (10:47 +0100)
committerJordi Vaquero <jordi.vaquero@metempsy.com>
Mon, 20 Jan 2020 14:04:11 +0000 (14:04 +0000)
This commit fixes the target exception Level EL2 for alignmemt fault, it
is based on HCR_EL2.tge bit.

Change-Id: Ief78b2aa0c86f1c3d9a5d3ca00121d163a9d6a86
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24303
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/arm/faults.cc
src/arch/arm/faults.hh

index 5a7b8e8eaf70c3d15be699d7b40915a83bbf3c90..bd38fdccb1546949e1e8ad81360f61e85c6507dd 100644 (file)
@@ -1541,6 +1541,14 @@ PCAlignmentFault::routeToHyp(ThreadContext *tc) const
 SPAlignmentFault::SPAlignmentFault()
 {}
 
+bool
+SPAlignmentFault::routeToHyp(ThreadContext *tc) const
+{
+    assert(from64);
+    HCR hcr  = tc->readMiscRegNoEffect(MISCREG_HCR_EL2);
+    return EL2Enabled(tc) && hcr.tge==1;
+}
+
 SystemError::SystemError()
 {}
 
index 3f61bc7221af72360b3923666fbb0b7e55796a28..508fd034ee24edf8a98dc95be3c04793e4426ea5 100644 (file)
@@ -571,6 +571,7 @@ class SPAlignmentFault : public ArmFaultVals<SPAlignmentFault>
 {
   public:
     SPAlignmentFault();
+    bool routeToHyp(ThreadContext *tc) const override;
 };
 
 /// System error (AArch64 only)