User Config: Add option to specify wall clock CNTPCT.
This commit is contained in:
parent
97b9d3e058
commit
41521ed856
5 changed files with 14 additions and 3 deletions
|
@ -200,6 +200,10 @@ struct UserConfig {
|
||||||
/// definite behaviour for some unpredictable instructions.
|
/// definite behaviour for some unpredictable instructions.
|
||||||
bool define_unpredictable_behaviour = false;
|
bool define_unpredictable_behaviour = false;
|
||||||
|
|
||||||
|
/// This tells the translator a wall clock will be used, thus allowing it
|
||||||
|
/// to avoid writting certain unnecessary code only needed for cycle timers.
|
||||||
|
bool wall_clock_cntpct = false;
|
||||||
|
|
||||||
/// This enables the fast dispatcher.
|
/// This enables the fast dispatcher.
|
||||||
bool enable_fast_dispatch = true;
|
bool enable_fast_dispatch = true;
|
||||||
|
|
||||||
|
|
|
@ -651,7 +651,9 @@ void A64EmitX64::EmitA64GetCNTFRQ(A64EmitContext& ctx, IR::Inst* inst) {
|
||||||
|
|
||||||
void A64EmitX64::EmitA64GetCNTPCT(A64EmitContext& ctx, IR::Inst* inst) {
|
void A64EmitX64::EmitA64GetCNTPCT(A64EmitContext& ctx, IR::Inst* inst) {
|
||||||
ctx.reg_alloc.HostCall(inst);
|
ctx.reg_alloc.HostCall(inst);
|
||||||
|
if (!conf.wall_clock_cntpct) {
|
||||||
code.UpdateTicks();
|
code.UpdateTicks();
|
||||||
|
}
|
||||||
Devirtualize<&A64::UserCallbacks::GetCNTPCT>(conf.callbacks).EmitCall(code);
|
Devirtualize<&A64::UserCallbacks::GetCNTPCT>(conf.callbacks).EmitCall(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,7 +233,8 @@ private:
|
||||||
|
|
||||||
// JIT Compile
|
// JIT Compile
|
||||||
const auto get_code = [this](u64 vaddr) { return conf.callbacks->MemoryReadCode(vaddr); };
|
const auto get_code = [this](u64 vaddr) { return conf.callbacks->MemoryReadCode(vaddr); };
|
||||||
IR::Block ir_block = A64::Translate(A64::LocationDescriptor{current_location}, get_code, {conf.define_unpredictable_behaviour});
|
IR::Block ir_block = A64::Translate(A64::LocationDescriptor{current_location}, get_code,
|
||||||
|
{conf.define_unpredictable_behaviour, conf.wall_clock_cntpct});
|
||||||
Optimization::A64CallbackConfigPass(ir_block, conf);
|
Optimization::A64CallbackConfigPass(ir_block, conf);
|
||||||
if (conf.enable_optimizations) {
|
if (conf.enable_optimizations) {
|
||||||
Optimization::A64GetSetElimination(ir_block);
|
Optimization::A64GetSetElimination(ir_block);
|
||||||
|
|
|
@ -120,7 +120,7 @@ bool TranslatorVisitor::MRS(Imm<1> o0, Imm<3> op1, Imm<4> CRn, Imm<4> CRm, Imm<3
|
||||||
return true;
|
return true;
|
||||||
case SystemRegisterEncoding::CNTPCT_EL0:
|
case SystemRegisterEncoding::CNTPCT_EL0:
|
||||||
// HACK: Ensure that this is the first instruction in the block it's emitted in, so the cycle count is most up-to-date.
|
// HACK: Ensure that this is the first instruction in the block it's emitted in, so the cycle count is most up-to-date.
|
||||||
if (!ir.block.empty()) {
|
if (!ir.block.empty() && !options.wall_clock_cntpct) {
|
||||||
ir.block.CycleCount()--;
|
ir.block.CycleCount()--;
|
||||||
ir.SetTerm(IR::Term::LinkBlock{*ir.current_location});
|
ir.SetTerm(IR::Term::LinkBlock{*ir.current_location});
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -26,6 +26,10 @@ struct TranslationOptions {
|
||||||
/// If this is true, we define some behaviour for some instructions.
|
/// If this is true, we define some behaviour for some instructions.
|
||||||
bool define_unpredictable_behaviour = false;
|
bool define_unpredictable_behaviour = false;
|
||||||
|
|
||||||
|
/// This tells the translator a wall clock will be used, thus allowing it
|
||||||
|
/// to avoid writting certain unnecessary code only needed for cycle timers.
|
||||||
|
bool wall_clock_cntpct = false;
|
||||||
|
|
||||||
/// This changes what IR we emit when we translate a hint instruction.
|
/// This changes what IR we emit when we translate a hint instruction.
|
||||||
/// If this is false, we treat the instruction as a NOP.
|
/// If this is false, we treat the instruction as a NOP.
|
||||||
/// If this is true, we emit an ExceptionRaised instruction.
|
/// If this is true, we emit an ExceptionRaised instruction.
|
||||||
|
|
Loading…
Reference in a new issue