summaryrefslogtreecommitdiff
path: root/src/arch/arm/system.cc
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.cc
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.cc')
-rw-r--r--src/arch/arm/system.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/arch/arm/system.cc b/src/arch/arm/system.cc
index 50ac4aeeb..caef6dc8f 100644
--- a/src/arch/arm/system.cc
+++ b/src/arch/arm/system.cc
@@ -44,6 +44,7 @@
#include <iostream>
+#include "arch/arm/semihosting.hh"
#include "base/loader/object_file.hh"
#include "base/loader/symtab.hh"
#include "cpu/thread_context.hh"
@@ -70,6 +71,7 @@ ArmSystem::ArmSystem(Params *p)
_m5opRange(p->m5ops_base ?
RangeSize(p->m5ops_base, 0x10000) :
AddrRange(1, 0)), // Create an empty range if disabled
+ semihosting(p->semihosting),
multiProc(p->multi_proc)
{
// Check if the physical address range is valid
@@ -268,6 +270,28 @@ ArmSystem::haveLargeAsid64(ThreadContext *tc)
return getArmSystem(tc)->haveLargeAsid64();
}
+bool
+ArmSystem::haveSemihosting(ThreadContext *tc)
+{
+ return getArmSystem(tc)->haveSemihosting();
+}
+
+uint64_t
+ArmSystem::callSemihosting64(ThreadContext *tc,
+ uint32_t op, uint64_t param)
+{
+ ArmSystem *sys = getArmSystem(tc);
+ return sys->semihosting->call64(tc, op, param);
+}
+
+uint32_t
+ArmSystem::callSemihosting32(ThreadContext *tc,
+ uint32_t op, uint32_t param)
+{
+ ArmSystem *sys = getArmSystem(tc);
+ return sys->semihosting->call32(tc, op, param);
+}
+
ArmSystem *
ArmSystemParams::create()
{