~ubuntu-branches/ubuntu/vivid/virtualbox-ose/vivid

« back to all changes in this revision

Viewing changes to src/VBox/VMM/PATM/PATM.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2010-03-11 17:16:37 UTC
  • mfrom: (0.3.4 upstream) (0.4.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100311171637-43z64ia3ccpj8vqn
Tags: 3.1.4-dfsg-2ubuntu1
* Merge from Debian unstable (LP: #528561), remaining changes:
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
  - Replace *-source packages with transitional packages for *-dkms
* Fix crash in vboxvideo_drm with kernel 2.6.33 / backported drm code
  (LP: #535297)
* Add a list of linux-headers packages to the apport hook
* Update debian/patches/u02-lp-integration.dpatch with a
  DEP-3 compliant header
* Add ${misc:Depends} to virtualbox-ose-source and virtualbox-ose-guest-source
  Depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
5952
5952
            pCurPatchInstrHC += CpuNew.opsize;
5953
5953
            pCurPatchInstrGC += CpuNew.opsize;
5954
5954
            cbLeft           -= CpuNew.opsize;
 
5955
 
 
5956
            /* Check if we expanded a complex guest instruction into a patch stream (e.g. call) */
 
5957
            if (!cbLeft)
 
5958
            {
 
5959
                /* If the next patch instruction doesn't correspond to the next guest instruction, then we have some extra room to fill. */
 
5960
                if (RTAvlU32Get(&pPatch->patch.Patch2GuestAddrTree, pCurPatchInstrGC - pVM->patm.s.pPatchMemGC) == NULL)
 
5961
                {
 
5962
                    pRec = (PRECPATCHTOGUEST)RTAvlU32GetBestFit(&pPatch->patch.Patch2GuestAddrTree, pCurPatchInstrGC - pVM->patm.s.pPatchMemGC, true);
 
5963
                    if (pRec)
 
5964
                    {
 
5965
                        unsigned cbFiller  = pRec->Core.Key + pVM->patm.s.pPatchMemGC - pCurPatchInstrGC;
 
5966
                        uint8_t *pPatchFillHC = patmPatchGCPtr2PatchHCPtr(pVM, pCurPatchInstrGC);
 
5967
 
 
5968
                        Assert(!pRec->fDirty);
 
5969
 
 
5970
                        Log(("Room left in patched instruction stream (%d bytes)\n", cbFiller));
 
5971
                        if (cbFiller >= SIZEOF_NEARJUMP32)
 
5972
                        {
 
5973
                            pPatchFillHC[0] = 0xE9;
 
5974
                             *(uint32_t *)&pPatchFillHC[1] = cbFiller - SIZEOF_NEARJUMP32;
 
5975
#ifdef DEBUG
 
5976
                            char szBuf[256];
 
5977
                            szBuf[0] = '\0';
 
5978
                            DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs, pCurPatchInstrGC, 0, szBuf, sizeof(szBuf), NULL);
 
5979
                            Log(("FILL:  %s\n", szBuf));
 
5980
#endif
 
5981
                        }
 
5982
                        else
 
5983
                        {
 
5984
                            for (unsigned i = 0; i < cbFiller; i++)
 
5985
                            {
 
5986
                                pPatchFillHC[i] = 0x90; /* NOP */
 
5987
#ifdef DEBUG
 
5988
                                char szBuf[256];
 
5989
                                szBuf[0] = '\0';
 
5990
                                DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs, pCurPatchInstrGC, 0, szBuf, sizeof(szBuf), NULL);
 
5991
                                Log(("FILL:  %s\n", szBuf));
 
5992
#endif
 
5993
                            }
 
5994
                        }
 
5995
                    }
 
5996
                }
 
5997
            }
5955
5998
        }
5956
5999
    }
5957
6000
    else