let {{
svcCode = '''
- fault = std::make_shared<SupervisorCall>(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<SupervisorCall>(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 = '''