From 7df83c94da53f8d04367cb472be8f7f947f94234 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Fri, 1 Dec 2017 16:25:55 +0000 Subject: arch-arm: Fixed WFE/WFI trapping behaviour This patch fixes the WFx trapping behaviour by introducing the arm arm v8 pseudocode functions: checkForWFxTrap32 and checkForWFxTrap64 Change-Id: I3db0d78b5c4ad46860e6d199c2f2fc7b41842840 Signed-off-by: Giacomo Travaglini Reviewed-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/6622 Maintainer: Andreas Sandberg --- src/arch/arm/insts/static_inst.hh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/arch/arm/insts/static_inst.hh') diff --git a/src/arch/arm/insts/static_inst.hh b/src/arch/arm/insts/static_inst.hh index 7ca1a84b6..9aed77c21 100644 --- a/src/arch/arm/insts/static_inst.hh +++ b/src/arch/arm/insts/static_inst.hh @@ -364,6 +364,11 @@ class ArmStaticInst : public StaticInst mnemonic, true); } + // Utility function used by checkForWFxTrap32 and checkForWFxTrap64 + // Returns true if processor has to trap a WFI/WFE instruction. + bool isWFxTrapping(ThreadContext *tc, + ExceptionLevel targetEL, bool isWfe) const; + /** * Trap an access to Advanced SIMD or FP registers due to access * control bits. @@ -405,6 +410,29 @@ class ArmStaticInst : public StaticInst NSACR nsacr, FPEXC fpexc, bool fpexc_check, bool advsimd) const; + /** + * Check if WFE/WFI instruction execution in aarch32 should be trapped. + * + * See aarch32/exceptions/traps/AArch32.checkForWFxTrap in the + * ARM ARM psueodcode library. + */ + Fault checkForWFxTrap32(ThreadContext *tc, + ExceptionLevel tgtEl, bool isWfe) const; + + /** + * Check if WFE/WFI instruction execution in aarch64 should be trapped. + * + * See aarch64/exceptions/traps/AArch64.checkForWFxTrap in the + * ARM ARM psueodcode library. + */ + Fault checkForWFxTrap64(ThreadContext *tc, + ExceptionLevel tgtEl, bool isWfe) const; + + /** + * WFE/WFI trapping helper function. + */ + Fault trapWFx(ThreadContext *tc, CPSR cpsr, SCR scr, bool isWfe) const; + /** * Get the new PSTATE from a SPSR register in preparation for an * exception return. -- cgit v1.2.3