0x2: movz({{ Rd = (Rt == 0) ? Rs : Rd; }});
0x3: movn({{ Rd = (Rt != 0) ? Rs : Rd; }});
0x4: decode FullSystemInt {
- 0: syscall_se({{ xc->syscall(); }},
- IsSerializeAfter, IsNonSpeculative);
- default: syscall({{ fault = std::make_shared<SystemCallFault>(); }});
+ 0: syscall_se({{
+ fault = std::make_shared<SESyscallFault>();
+ }});
+ default: syscall({{
+ fault = std::make_shared<SystemCallFault>();
+ }});
}
0x7: sync({{ ; }}, IsMemBarrier);
0x5: break({{fault = std::make_shared<BreakpointFault>();}});
55: stfdu({{ Mem_df = Fs; }});
}
- 17: IntOp::sc({{ xc->syscall(); }},
- [ IsSyscall, IsNonSpeculative, IsSerializeAfter ]);
+ 17: IntOp::sc({{ return std::make_shared<SESyscallFault>(); }});
format FloatArithOp {
59: decode A_XO {
// will sign extend it, and there's no easy way to
// specify only checking the first byte.
0xffffffffffffff80:
- SyscallInst::int80('xc->syscall()',
- IsSyscall, IsNonSpeculative,
- IsSerializeAfter);
+ SyscallInst::int80({{
+ return std::make_shared<SESyscallFault>();
+ }});
}
default: Inst::INT(Ib);
}
}
0x05: decode FullSystemInt {
- 0: SyscallInst::syscall('xc->syscall()',
- IsSyscall, IsNonSpeculative,
- IsSerializeAfter);
+ 0: SyscallInst::syscall({{
+ return std::make_shared<SESyscallFault>();
+ }});
default: decode MODE_MODE {
0x0: decode MODE_SUBMODE {
0x0: Inst::SYSCALL_64();
0x2: Inst::RDMSR();
0x3: rdpmc();
0x4: decode FullSystemInt {
- 0: SyscallInst::sysenter('xc->syscall()',
- IsSyscall, IsNonSpeculative,
- IsSerializeAfter);
+ 0: SyscallInst::sysenter({{
+ return std::make_shared<SESyscallFault>();
+ }});
default: sysenter();
}
0x5: sysexit();
panic("Unimpfault: %s", panicStr.c_str());
}
+void
+SESyscallFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
+{
+ tc->syscall();
+ // Move the PC forward since that doesn't happen automatically.
+ TheISA::PCState pc = tc->pcState();
+ inst->advancePC(pc);
+ tc->pcState(pc);
+}
+
void
ReExec::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
StaticInst::nullStaticInstPtr) override;
};
+// A fault to trigger a system call in SE mode.
+class SESyscallFault : public FaultBase
+{
+ const char *name() const override { return "syscall_fault"; }
+
+ void invoke(ThreadContext *tc, const StaticInstPtr &inst=
+ StaticInst::nullStaticInstPtr) override;
+};
+
class ReExec : public FaultBase
{
public: