Merge pull request #2 from ughoavgfhw/master

Fix two bugs around monitor/mwait
This commit is contained in:
Stanislav Shwartsman 2022-07-14 08:37:39 +03:00 committed by GitHub
commit 5e49bfd41f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -304,7 +304,14 @@ BX_CPU_C::tickle_read_linear(unsigned s, bx_address laddr)
bx_TLB_entry *tlbEntry = BX_DTLB_ENTRY_OF(laddr, 0);
if (tlbEntry->lpf == lpf) {
// See if the TLB entry privilege level allows us read access from this CPL
if (isReadOK(tlbEntry, USER_PL)) return;
if (isReadOK(tlbEntry, USER_PL)) {
BX_CPU_THIS_PTR address_xlation.paddress1 = tlbEntry->ppf | PAGE_OFFSET(laddr);
BX_CPU_THIS_PTR address_xlation.pages = 1;
#if BX_SUPPORT_MEMTYPE
BX_CPU_THIS_PTR address_xlation.memtype1 = tlbEntry->get_memtype();
#endif
return;
}
}
#if BX_SUPPORT_X86_64

View File

@ -394,7 +394,7 @@ void BX_CPU_C::TLB_flush(void)
#if BX_SUPPORT_MONITOR_MWAIT
// invalidating of the TLB might change translation for monitored page
// and cause subsequent MWAIT instruction to wait forever
BX_CPU_THIS_PTR monitor.reset_monitor();
BX_CPU_THIS_PTR wakeup_monitor();
#endif
// break all links bewteen traces
@ -415,7 +415,7 @@ void BX_CPU_C::TLB_flushNonGlobal(void)
#if BX_SUPPORT_MONITOR_MWAIT
// invalidating of the TLB might change translation for monitored page
// and cause subsequent MWAIT instruction to wait forever
BX_CPU_THIS_PTR monitor.reset_monitor();
BX_CPU_THIS_PTR wakeup_monitor();
#endif
// break all links bewteen traces
@ -435,7 +435,7 @@ void BX_CPU_C::TLB_invlpg(bx_address laddr)
#if BX_SUPPORT_MONITOR_MWAIT
// invalidating of the TLB entry might change translation for monitored
// page and cause subsequent MWAIT instruction to wait forever
BX_CPU_THIS_PTR monitor.reset_monitor();
BX_CPU_THIS_PTR wakeup_monitor();
#endif
// break all links bewteen traces