summaryrefslogtreecommitdiff
path: root/src/arch/arm/utility.hh
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2016-06-02 13:41:26 +0100
committerAndreas Sandberg <andreas.sandberg@arm.com>2016-06-02 13:41:26 +0100
commit660fbd543f7c84dec81cd17bdb4ff08f954aec77 (patch)
treea03fb18c83b32031b5331767e3067a026d641775 /src/arch/arm/utility.hh
parentf48ad5b29d6f291b4f3679ff5fb7b5beae10d6fa (diff)
downloadgem5-660fbd543f7c84dec81cd17bdb4ff08f954aec77.tar.xz
arm: Rewrite ERET to behave according to the ARMv8 ARM
The ERET instruction doesn't set PSTATE correctly in some cases (particularly when returning to aarch32 code). Among other things, this breaks EL0 thumb code when using a 64-bit kernel. This changeset updates the ERET implementation to match the ARM ARM. Change-Id: I408e7c69a23cce437859313dfe84e68744b07c98 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Nathanael Premillieu <nathanael.premillieu@arm.com>
Diffstat (limited to 'src/arch/arm/utility.hh')
-rw-r--r--src/arch/arm/utility.hh12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/arch/arm/utility.hh b/src/arch/arm/utility.hh
index 8fb6558be..4b87dcc13 100644
--- a/src/arch/arm/utility.hh
+++ b/src/arch/arm/utility.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2012-2013 ARM Limited
+ * Copyright (c) 2010, 2012-2013, 2016 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -161,6 +161,16 @@ bool ELIs64(ThreadContext *tc, ExceptionLevel el);
bool isBigEndian64(ThreadContext *tc);
+static inline uint8_t
+itState(CPSR psr)
+{
+ ITSTATE it = 0;
+ it.top6 = psr.it2;
+ it.bottom2 = psr.it1;
+
+ return (uint8_t)it;
+}
+
/**
* Removes the tag from tagged addresses if that mode is enabled.
* @param addr The address to be purified.