Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/27246 )
Change subject: arm: Teach gem5 to recognize the gem5 semihosting immediate
values.
......................................................................
arm: Teach gem5 to recognize the gem5 semihosting immediate values.
These give access to the gem5 extension calls, currently only the pseudo
ops.
Change-Id: I60ece82f1f084791971a2de0b54be2f0d9da243e
---
M src/arch/arm/isa/insts/misc.isa
M src/arch/arm/isa/insts/misc64.isa
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/arch/arm/isa/insts/misc.isa
b/src/arch/arm/isa/insts/misc.isa
index 88c473d..9522547 100644
--- a/src/arch/arm/isa/insts/misc.isa
+++ b/src/arch/arm/isa/insts/misc.isa
@@ -40,10 +40,14 @@
svcCode = '''
ThreadContext *tc = xc->tcBase();
- const auto semihost_imm = Thumb? 0xAB : 0x123456;
-
- if (ArmSystem::haveSemihosting(tc) && imm == semihost_imm) {
+ bool have_semi = ArmSystem::haveSemihosting(tc);
+ if (have_semi && Thumb && imm == 0xAB) {
+ // Enable gem5 extensions since we can't distinguish in thumb.
+ ArmSystem::callSemihosting32(tc, true);
+ } else if (have_semi && imm == 0x123456) {
ArmSystem::callSemihosting32(tc);
+ } else if (have_semi && imm == 0x5d57) {
+ ArmSystem::callSemihosting32(tc, true);
} else {
fault = std::make_shared<SupervisorCall>(machInst, imm);
}
diff --git a/src/arch/arm/isa/insts/misc64.isa
b/src/arch/arm/isa/insts/misc64.isa
index e2cfb41..bd90378 100644
--- a/src/arch/arm/isa/insts/misc64.isa
+++ b/src/arch/arm/isa/insts/misc64.isa
@@ -185,8 +185,11 @@
hltCode = '''
ThreadContext *tc = xc->tcBase();
- if (ArmSystem::haveSemihosting(tc) && imm == 0xF000) {
+ bool have_semi = ArmSystem::haveSemihosting(tc);
+ if (imm == 0xF000 && have_semi) {
ArmSystem::callSemihosting64(tc);
+ } else if (imm == 0x5d57 && have_semi) {
+ ArmSystem::callSemihosting64(tc, true);
} else {
// HLT instructions aren't implemented, so treat them as undefined
// instructions.
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/27246
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I60ece82f1f084791971a2de0b54be2f0d9da243e
Gerrit-Change-Number: 27246
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev