VirtualBox

Changeset 81501 in vbox for trunk


Ignore:
Timestamp:
Oct 24, 2019 1:37:27 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134229
Message:

VMM/IEMAllCImplStrInstr.cpp.h: Fixed a few incorrect uses of OP_SIZE in aligment mask calculations, code thought it was a byte count when it's a bit count. Also added a optimization for 'rep stos' on unassigned pages as some buggy EFI firmware ended up doing that for hundred of MBs, which takes forever when doing it byte-by-byte of course.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplStrInstr.cpp.h

    r80641 r81501  
    551551                /* If unaligned, we drop thru and do the page crossing access
    552552                   below. Otherwise, do the next page. */
    553                 if (!(uVirtAddr & (OP_SIZE - 1)))
     553                if (!(uVirtAddr & (OP_SIZE / 8 - 1)))
    554554                {
    555555                    IEM_CHECK_FF_YIELD_REPSTR_MAYBE_RETURN(pVM, pVCpu, uEFlags);
     
    683683                /* If unaligned, we drop thru and do the page crossing access
    684684                   below. Otherwise, do the next page. */
    685                 if (!(uVirtAddr & (OP_SIZE - 1)))
     685                if (!(uVirtAddr & (OP_SIZE / 8 - 1)))
    686686                {
    687687                    IEM_CHECK_FF_YIELD_REPSTR_MAYBE_RETURN(pVM, pVCpu, uEFlags);
     
    984984                /* If unaligned, we drop thru and do the page crossing access
    985985                   below. Otherwise, do the next page. */
    986                 if (!(uVirtAddr & (OP_SIZE - 1)))
     986                if (!(uVirtAddr & (OP_SIZE / 8 - 1)))
    987987                {
    988988                    IEM_CHECK_FF_YIELD_REPSTR_MAYBE_RETURN(pVM, pVCpu, pVCpu->cpum.GstCtx.eflags.u);
     
    990990                }
    991991                cLeftPage = 0;
     992            }
     993            /* If we got an invalid physical address in the page table, just skip
     994               ahead to the next page or the counter reaches zero.  This crazy
     995               optimization is for a buggy EFI firmware that's driving me nuts. */
     996            else if (rcStrict == VERR_PGM_PHYS_TLB_UNASSIGNED)
     997            {
     998                pVCpu->cpum.GstCtx.ADDR_rCX = uCounterReg -= cLeftPage;
     999                pVCpu->cpum.GstCtx.ADDR_rDI = uAddrReg    += cLeftPage * cbIncr;
     1000                if (uCounterReg == 0)
     1001                    break;
     1002                if (!(uVirtAddr & (OP_SIZE / 8 - 1)))
     1003                {
     1004                    IEM_CHECK_FF_YIELD_REPSTR_MAYBE_RETURN(pVM, pVCpu, pVCpu->cpum.GstCtx.eflags.u);
     1005                    continue;
     1006                }
    9921007            }
    9931008        }
     
    11011116                /* If unaligned, we drop thru and do the page crossing access
    11021117                   below. Otherwise, do the next page. */
    1103                 if (!(uVirtAddr & (OP_SIZE - 1)))
     1118                if (!(uVirtAddr & (OP_SIZE / 8 - 1)))
    11041119                {
    11051120                    IEM_CHECK_FF_YIELD_REPSTR_MAYBE_RETURN(pVM, pVCpu, pVCpu->cpum.GstCtx.eflags.u);
     
    13841399                if (uCounterReg == 0)
    13851400                    break;
    1386                 if (!(uVirtAddr & (OP_SIZE - 1)))
     1401                if (!(uVirtAddr & (OP_SIZE / 8 - 1)))
    13871402                {
    13881403                    IEM_CHECK_FF_YIELD_REPSTR_MAYBE_RETURN(pVM, pVCpu, pVCpu->cpum.GstCtx.eflags.u);
     
    16651680                /* If unaligned, we drop thru and do the page crossing access
    16661681                   below. Otherwise, do the next page. */
    1667                 if (!(uVirtAddr & (OP_SIZE - 1)))
     1682                if (!(uVirtAddr & (OP_SIZE / 8 - 1)))
    16681683                {
    16691684                    IEM_CHECK_FF_YIELD_REPSTR_MAYBE_RETURN(pVM, pVCpu, pVCpu->cpum.GstCtx.eflags.u);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette