allow linking of traces cross 4K page boundary

This commit is contained in:
Stanislav Shwartsman 2013-06-23 21:12:03 +00:00
parent 91b3417e57
commit c42afb0a2d
4 changed files with 8 additions and 12 deletions

View File

@ -254,23 +254,19 @@ BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::linkTrace(bxInstruction_c *i)
bxInstruction_c *next = i->getNextTrace();
if (next) {
bx_address eipBiased = RIP + BX_CPU_THIS_PTR eipPageBias;
if (eipBiased >= BX_CPU_THIS_PTR eipPageWindowSize) {
prefetch();
}
BX_EXECUTE_INSTRUCTION(next);
return;
}
bx_address eipBiased = RIP + BX_CPU_THIS_PTR eipPageBias;
if (eipBiased >= BX_CPU_THIS_PTR eipPageWindowSize) {
/*
prefetch();
eipBiased = RIP + BX_CPU_THIS_PTR eipPageBias;
*/
// You would like to have the prefetch() instead of this return; statement and link also
// branches that cross page boundary but this potentially could cause functional failure.
// An OS might modify the page tables and invalidate the TLB but it won't affect Bochs
// execution because of a trace linked into another old trace with data before the page
// invalidation. The case would be detected if doing prefetch() properly.
return;
}
InstrICache_Increment(iCacheLookups);

View File

@ -168,7 +168,7 @@ BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::CALL_Jw(bxInstruction_c *i)
BX_INSTR_UCNEAR_BRANCH(BX_CPU_ID, BX_INSTR_IS_CALL, PREV_RIP, EIP);
BX_NEXT_TRACE(i);
BX_LINK_TRACE(i);
}
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::CALL16_Ap(bxInstruction_c *i)

View File

@ -166,7 +166,7 @@ BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::CALL_Jd(bxInstruction_c *i)
BX_INSTR_UCNEAR_BRANCH(BX_CPU_ID, BX_INSTR_IS_CALL, PREV_RIP, EIP);
BX_NEXT_TRACE(i);
BX_LINK_TRACE(i);
}
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::CALL32_Ap(bxInstruction_c *i)

View File

@ -125,7 +125,7 @@ BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::CALL_Jq(bxInstruction_c *i)
BX_INSTR_UCNEAR_BRANCH(BX_CPU_ID, BX_INSTR_IS_CALL, PREV_RIP, RIP);
BX_NEXT_TRACE(i);
BX_LINK_TRACE(i);
}
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::CALL_EqR(bxInstruction_c *i)