VirtualBox

Changeset 103885 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Mar 18, 2024 10:19:33 AM (9 months ago)
Author:
vboxsync
Message:

VMM/IEM: Used the cached offBuf in the first memcpy case. Make sure we only read some other variables once as well. bugref:10370

File:
1 edited

Legend:

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

    r103884 r103885  
    857857         * rest simpler.  This is the first part of the cross page/buffer case.
    858858         */
    859         if (pVCpu->iem.s.pbInstrBuf != NULL)
     859        uint8_t const * const pbInstrBuf = pVCpu->iem.s.pbInstrBuf;
     860        if (pbInstrBuf != NULL)
    860861        {
    861862            Assert(cbDst != 0); /* pbInstrBuf shall be NULL in case of a TLB load */
    862             if (offBuf < pVCpu->iem.s.cbInstrBuf)
     863            uint32_t const cbInstrBuf = pVCpu->iem.s.cbInstrBuf;
     864            if (offBuf < cbInstrBuf)
    863865            {
    864                 Assert(offBuf + cbDst > pVCpu->iem.s.cbInstrBuf);
    865                 uint32_t const cbCopy = pVCpu->iem.s.cbInstrBuf - pVCpu->iem.s.offInstrNextByte;
    866                 memcpy(pvDst, &pVCpu->iem.s.pbInstrBuf[offBuf], cbCopy);
     866                Assert(offBuf + cbDst > cbInstrBuf);
     867                uint32_t const cbCopy = cbInstrBuf - offBuf;
     868                memcpy(pvDst, &pbInstrBuf[offBuf], cbCopy);
    867869
    868870                cbDst  -= cbCopy;
Note: See TracChangeset for help on using the changeset viewer.

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