From: Giacomo Travaglini Date: Tue, 13 Feb 2018 13:55:36 +0000 (+0000) Subject: arch-arm: Add AArch32 SVC Semihosting interface X-Git-Tag: v19.0.0.0~2278 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=26b03914d7dbcf6b6c8c0a9c08d4e3ff81365376;p=gem5.git arch-arm: Add AArch32 SVC Semihosting interface AArch32 Svc instruction is now able to issue Arm Semihosting commands as the AArch64 counterpart in either Arm and Thumb mode. Change-Id: Ibe47ac23d0c26f3f819cc0e2b3ee874b5cdbb3d3 Signed-off-by: Giacomo Travaglini Reviewed-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/8371 Maintainer: Andreas Sandberg --- diff --git a/src/arch/arm/isa/insts/misc.isa b/src/arch/arm/isa/insts/misc.isa index cf3d0e00f..566ea4b9d 100644 --- a/src/arch/arm/isa/insts/misc.isa +++ b/src/arch/arm/isa/insts/misc.isa @@ -40,15 +40,26 @@ let {{ svcCode = ''' - fault = std::make_shared(machInst, imm); + ThreadContext *tc = xc->tcBase(); + + const auto semihost_imm = Thumb? 0xAB : 0x123456; + + if (ArmSystem::haveSemihosting(tc) && imm == semihost_imm) { + R0 = ArmSystem::callSemihosting32(tc, R0, R1); + } else { + fault = std::make_shared(machInst, imm); + } ''' svcIop = InstObjParams("svc", "Svc", "ImmOp", { "code": svcCode, - "predicate_test": predicateTest }, - ["IsSyscall", "IsNonSpeculative", "IsSerializeAfter"]) + "predicate_test": predicateTest, + "thumb_semihost": '0xAB', + "arm_semihost": '0x123456' }, + ["IsSyscall", "IsNonSpeculative", + "IsSerializeAfter"]) header_output = ImmOpDeclare.subst(svcIop) - decoder_output = ImmOpConstructor.subst(svcIop) + decoder_output = SemihostConstructor.subst(svcIop) exec_output = PredOpExecute.subst(svcIop) smcCode = '''