From: Giacomo Travaglini Date: Mon, 27 Nov 2017 18:10:17 +0000 (+0000) Subject: arch-arm: Add haveEL pseudocode function X-Git-Tag: v19.0.0.0~2501 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7c1405402c7c53f17e554f584b7e801f1f755034;p=gem5.git arch-arm: Add haveEL pseudocode function This patch introduces the ARM pseudocode haveEL function into gem5. Change-Id: I0d96070959e8e13773eb7fa9964894ec0ff2cac2 Signed-off-by: Giacomo Travaglini Reviewed-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/6162 Maintainer: Andreas Sandberg --- diff --git a/src/arch/arm/system.cc b/src/arch/arm/system.cc index 1fe706079..097a87b2b 100644 --- a/src/arch/arm/system.cc +++ b/src/arch/arm/system.cc @@ -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) { diff --git a/src/arch/arm/system.hh b/src/arch/arm/system.hh index b81ec05f9..46103f42c 100644 --- a/src/arch/arm/system.hh +++ b/src/arch/arm/system.hh @@ -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);