summaryrefslogtreecommitdiff
path: root/src/arch/arm/system.hh
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2018-02-08 20:13:13 +0000
committerAndreas Sandberg <andreas.sandberg@arm.com>2018-02-19 14:24:46 +0000
commit6039da55d87fb27b149ac3da0ebce41bb55a3bee (patch)
tree0accdc76afa3790eb04d878d89e5f5158fd25572 /src/arch/arm/system.hh
parent80427ea030b521779521f57b092bc6b4afc86ab2 (diff)
downloadgem5-6039da55d87fb27b149ac3da0ebce41bb55a3bee.tar.xz
arch-arm: Add aarch64 semihosting support
Add basic support for Arm Semihosting 2.0 simulation calls [1]. These calls let the guest system call a simulator or debugger to request OS-like support when running bare metal code. With the exception of SYS_SYSTEM, this implementation supports all of the Semihosting 2.0 specification in aarch64. [1] https://developer.arm.com/docs/100863/latest/preface Change-Id: I08c153c18a4a4fb9f95d318e2a029724935192a7 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jack Travaglini <giacomo.travaglini@arm.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-on: https://gem5-review.googlesource.com/8147 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Diffstat (limited to 'src/arch/arm/system.hh')
-rw-r--r--src/arch/arm/system.hh21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/arch/arm/system.hh b/src/arch/arm/system.hh
index 46103f42c..e7696a4fd 100644
--- a/src/arch/arm/system.hh
+++ b/src/arch/arm/system.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2012-2013, 2015-2017 ARM Limited
+ * Copyright (c) 2010, 2012-2013, 2015-2018 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -122,6 +122,11 @@ class ArmSystem : public System
*/
const AddrRange _m5opRange;
+ /**
+ * True if the Semihosting interface is enabled.
+ */
+ ArmSemihosting *const semihosting;
+
protected:
/**
* Get a boot loader that matches the kernel.
@@ -228,6 +233,9 @@ class ArmSystem : public System
*/
const AddrRange &m5opRange() const { return _m5opRange; }
+ /** Is Arm Semihosting support enabled? */
+ bool haveSemihosting() const { return semihosting != nullptr; }
+
/**
* Returns a valid ArmSystem pointer if using ARM ISA, it fails
* otherwise.
@@ -280,6 +288,17 @@ class ArmSystem : public System
/** Returns true if ASID is 16 bits for the system of a specific thread
* context while in AArch64 (ARMv8) */
static bool haveLargeAsid64(ThreadContext *tc);
+
+ /** Is Arm Semihosting support enabled? */
+ static bool haveSemihosting(ThreadContext *tc);
+
+ /** Make a Semihosting call from aarch64 */
+ static uint64_t callSemihosting64(ThreadContext *tc,
+ uint32_t op, uint64_t param);
+
+ /** Make a Semihosting call from aarch32 */
+ static uint32_t callSemihosting32(ThreadContext *tc,
+ uint32_t op, uint32_t param);
};
class GenericArmSystem : public ArmSystem