arch-arm: Add haveEL pseudocode function
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 27 Nov 2017 18:10:17 +0000 (18:10 +0000)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Tue, 28 Nov 2017 12:00:30 +0000 (12:00 +0000)
This patch introduces the ARM pseudocode haveEL function
into gem5.

Change-Id: I0d96070959e8e13773eb7fa9964894ec0ff2cac2
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/6162
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

src/arch/arm/system.cc
src/arch/arm/system.hh

index 1fe706079f7183cbcdfe7b4144c8dd92e029196d..097a87b2b19141c722ef71e9b8a1d096be5ec7a2 100644 (file)
@@ -225,6 +225,23 @@ ArmSystem::highestEL(ThreadContext *tc)
     return FullSystem? getArmSystem(tc)->highestEL() : EL1;
 }
 
+bool
+ArmSystem::haveEL(ThreadContext *tc, ExceptionLevel el)
+{
+    switch (el) {
+      case EL0:
+      case EL1:
+        return true;
+      case EL2:
+        return haveVirtualization(tc);
+      case EL3:
+        return haveSecurity(tc);
+      default:
+        warn("Unimplemented Exception Level\n");
+        return false;
+    }
+}
+
 Addr
 ArmSystem::resetAddr64(ThreadContext *tc)
 {
index b81ec05f9f8c508a740b1915e275087ef2fc0261..46103f42c9dff091eb3125a6d4d7100b1ce46f0e 100644 (file)
@@ -259,8 +259,11 @@ class ArmSystem : public System
      */
     static ExceptionLevel highestEL(ThreadContext *tc);
 
-    /** Returns the reset address if the highest implemented exception level for
-     * the system of a specific thread context is 64 bits (ARMv8)
+    /** Return true if the system implements a specific exception level */
+    static bool haveEL(ThreadContext *tc, ExceptionLevel el);
+
+    /** Returns the reset address if the highest implemented exception level
+     * for the system of a specific thread context is 64 bits (ARMv8)
      */
     static Addr resetAddr64(ThreadContext *tc);