VirtualBox

Changeset 13565 in vbox for trunk/src


Ignore:
Timestamp:
Oct 24, 2008 5:48:59 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
38439
Message:

#1865: REM (VMM bits) - moved EMFlushREMTBs to REMFlushTBs, deleted dead REMGC.cpp.

Location:
trunk/src
Files:
1 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/EM.cpp

    r13542 r13565  
    748748     * Switch to REM, step instruction, switch back.
    749749     */
    750     int rc = REMR3State(pVM, pVM->em.s.fREMFlushTBs);
     750    int rc = REMR3State(pVM);
    751751    if (VBOX_SUCCESS(rc))
    752752    {
    753753        rc = REMR3Step(pVM);
    754754        REMR3StateBack(pVM);
    755         pVM->em.s.fREMFlushTBs = false;
    756755    }
    757756    LogFlow(("emR3RemStep: returns %Vrc cs:eip=%04x:%08x\n", rc, CPUMGetGuestCS(pVM),  CPUMGetGuestEIP(pVM)));
     
    808807        {
    809808            STAM_PROFILE_START(&pVM->em.s.StatREMSync, b);
    810             rc = REMR3State(pVM, pVM->em.s.fREMFlushTBs);
     809            rc = REMR3State(pVM);
    811810            STAM_PROFILE_STOP(&pVM->em.s.StatREMSync, b);
    812811            if (VBOX_FAILURE(rc))
    813812                break;
    814813            fInREMState = true;
    815             pVM->em.s.fREMFlushTBs = false;
    816814
    817815            /*
  • trunk/src/VBox/VMM/EMInternal.h

    r13265 r13565  
    294294#endif
    295295
    296     /* Set when the translation blocks in the recompiler cache need to be flushed. */
    297     bool                    fREMFlushTBs;
    298 
    299     uint8_t                 u8Padding[GC_ARCH_BITS == 64 ? 5 : 1];
     296    uint8_t                 u8Padding[GC_ARCH_BITS == 64 ? 6 : 2];
    300297
    301298    /** Inhibit interrupts for this instruction. Valid only when VM_FF_INHIBIT_INTERRUPTS is set. */
  • trunk/src/VBox/VMM/HWACCM.cpp

    r13542 r13565  
    3131#include <VBox/trpm.h>
    3232#include <VBox/dbgf.h>
     33#include <VBox/patm.h>
     34#include <VBox/csam.h>
     35#include <VBox/selm.h>
     36#include <VBox/rem.h>
    3337#include <VBox/hwacc_vmx.h>
    3438#include <VBox/hwacc_svm.h>
     
    3741#include <VBox/err.h>
    3842#include <VBox/param.h>
    39 #include <VBox/patm.h>
    40 #include <VBox/csam.h>
    41 #include <VBox/selm.h>
    4243
    4344#include <iprt/assert.h>
     
    604605            *((unsigned char *)pVM->hwaccm.s.vmx.pRealModeTSS + HWACCM_VTX_TSS_SIZE - 2) = 0xff;
    605606
    606             /* Construct a 1024 element page directory with 4 MB pages for the identity mapped page table used in 
     607            /* Construct a 1024 element page directory with 4 MB pages for the identity mapped page table used in
    607608             * real and protected mode without paging with EPT.
    608609             */
     
    616617            /* We convert it here every time as pci regions could be reconfigured. */
    617618            rc = PDMVMMDevHeapR3ToGCPhys(pVM, pVM->hwaccm.s.vmx.pRealModeTSS, &GCPhys);
    618             AssertRC(rc);           
     619            AssertRC(rc);
    619620            LogRel(("HWACCM: Real Mode TSS guest physaddr  = %VGp\n", GCPhys));
    620621
    621622            rc = PDMVMMDevHeapR3ToGCPhys(pVM, pVM->hwaccm.s.vmx.pNonPagingModeEPTPageTable, &GCPhys);
    622             AssertRC(rc);           
     623            AssertRC(rc);
    623624            LogRel(("HWACCM: Non-Paging Mode EPT CR3       = %VGp\n", GCPhys));
    624625
     
    883884    if (CPUMIsGuestInRealModeEx(pCtx))
    884885    {
    885         /* VT-x will not allow high selector bases in v86 mode; fall back to the recompiler in that case. 
     886        /* VT-x will not allow high selector bases in v86 mode; fall back to the recompiler in that case.
    886887         * The base must also be equal to (sel << 4).
    887888         */
     
    914915                 * changed (Fedora4 boot image, reset, boot iso)
    915916                 */
    916                 EMFlushREMTBs(pVM);
     917                REMFlushTBs(pVM);
    917918                return false;
    918919            }
  • trunk/src/VBox/VMM/Makefile.kmk

    r13375 r13565  
    110110        VMMAll/PGMAllPhys.cpp \
    111111        VMMAll/PGMAllPool.cpp \
     112        VMMAll/REMAll.cpp \
    112113        VMMAll/SELMAll.cpp \
    113114        VMMAll/EMAll.cpp \
  • trunk/src/VBox/VMM/PATM/VMMGC/CSAMGC.cpp

    r12989 r13565  
    3333#include <VBox/sup.h>
    3434#include <VBox/mm.h>
     35#include <VBox/rem.h>
    3536#include <VBox/param.h>
    3637#include <iprt/avl.h>
     
    7273
    7374    /* Flush the recompilers translation block cache as the guest seems to be modifying instructions. */
    74     EMFlushREMTBs(pVM);
     75    REMFlushTBs(pVM);
    7576
    7677    pPATMGCState = PATMQueryGCState(pVM);
  • trunk/src/VBox/VMM/REMInternal.h

    r13230 r13565  
    166166    bool                    fInStateSync;
    167167
     168    /** Set when the translation blocks cache need to be flushed. */
     169    bool                    fFlushTBs;
     170
    168171    /** Ignore all that can be ignored. */
    169172    bool                    fIgnoreAll;
     
    245248#ifdef VBOX_WITH_NEW_RECOMPILER
    246249#if GC_ARCH_BITS == 32
    247 #define REM_ENV_SIZE        (HC_ARCH_BITS == 32 ? 0xff00 : 0xff00)
     250# define REM_ENV_SIZE        (HC_ARCH_BITS == 32 ? 0xff00 : 0xff00)
    248251#else
    249 #define REM_ENV_SIZE        (HC_ARCH_BITS == 32 ? 0xff00 : 0xff00)
    250 #endif
     252# define REM_ENV_SIZE        (HC_ARCH_BITS == 32 ? 0xff00 : 0xff00)
     253#endif
     254#else  /* !VBOX_WITH_NEW_RECOMPILER */
     255#if GC_ARCH_BITS == 32
     256# define REM_ENV_SIZE        (HC_ARCH_BITS == 32 ? 0x6550 : 0xb4a0)
    251257#else
    252 #if GC_ARCH_BITS == 32
    253 #define REM_ENV_SIZE        (HC_ARCH_BITS == 32 ? 0x6550 : 0xb4a0)
    254 #else
    255 #define REM_ENV_SIZE        (HC_ARCH_BITS == 32 ? 0x9440 : 0xd4a0)
    256 #endif
    257 #endif // VBOX_WITH_NEW_RECOMILER
     258# define REM_ENV_SIZE        (HC_ARCH_BITS == 32 ? 0x9440 : 0xd4a0)
     259#endif
     260#endif /* !VBOX_WITH_NEW_RECOMILER */
    258261
    259262    /** Recompiler CPU state. */
     
    265268        char                achPadding[REM_ENV_SIZE];
    266269    }                       Env;
    267 #endif
     270#endif /* !REM_INCLUDE_CPU_H */
    268271} REM;
    269272
     
    289292void    remR3CpuId(CPUState *env, unsigned uOperator, void *pvEAX, void *pvEBX, void *pvECX, void *pvEDX);
    290293void    remR3RecordCall(CPUState *env);
    291 #endif
     294#endif /* REM_INCLUDE_CPU_H */
    292295void    remR3TrapClear(PVM pVM);
    293296void    remR3RaiseRC(PVM pVM, int rc);
     
    304307#ifdef VBOX_WITH_STATISTICS
    305308
    306 #define STATS_EMULATE_SINGLE_INSTR          1
    307 #define STATS_QEMU_COMPILATION              2
    308 #define STATS_QEMU_RUN_EMULATED_CODE        3
    309 #define STATS_QEMU_TOTAL                    4
    310 #define STATS_QEMU_RUN_TIMERS               5
    311 #define STATS_TLB_LOOKUP                    6
    312 #define STATS_IRQ_HANDLING                  7
    313 #define STATS_RAW_CHECK                     8
    314 
     309# define STATS_EMULATE_SINGLE_INSTR         1
     310# define STATS_QEMU_COMPILATION             2
     311# define STATS_QEMU_RUN_EMULATED_CODE       3
     312# define STATS_QEMU_TOTAL                   4
     313# define STATS_QEMU_RUN_TIMERS              5
     314# define STATS_TLB_LOOKUP                   6
     315# define STATS_IRQ_HANDLING                 7
     316# define STATS_RAW_CHECK                    8
    315317
    316318void remR3ProfileStart(int statcode);
    317319void remR3ProfileStop(int statcode);
    318 #else
    319 #define remR3ProfileStart(c)
    320 #define remR3ProfileStop(c)
    321 #endif
     320
     321#else  /* !VBOX_WITH_STATISTICS */
     322# define remR3ProfileStart(c)
     323# define remR3ProfileStop(c)
     324#endif /* !VBOX_WITH_STATISTICS */
    322325
    323326/** @} */
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r13561 r13565  
    8383{
    8484    return pVM->em.s.enmState;
    85 }
    86 
    87 
    88 /**
    89  * Flushes the REM translation blocks the next time we execute code there.
    90  *
    91  * @param   pVM         The VM handle.
    92  *
    93  * @todo    This doesn't belong here, it should go in REMAll.cpp!
    94  */
    95 VMMDECL(void) EMFlushREMTBs(PVM pVM)
    96 {
    97     LogFlow(("EMFlushREMTBs\n"));
    98     pVM->em.s.fREMFlushTBs = true;
    9985}
    10086
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r13186 r13565  
    2020 */
    2121
     22/*******************************************************************************
     23*   Defined Constants And Macros                                               *
     24*******************************************************************************/
    2225/** @def PGM_IGNORE_RAM_FLAGS_RESERVED
    2326 * Don't respect the MM_RAM_FLAGS_RESERVED flag when converting to HC addresses.
     
    263266    AssertFatalFailed();
    264267}
    265 
    266268
    267269
     
    11261128    pCache->Entry[iCacheIndex].pbR3   = pbR3;
    11271129}
    1128 #endif
     1130#endif /* IN_RING3 */
    11291131
    11301132/**
     
    12161218                        void *pvSrc = PGMRAMRANGE_GETHCPTR(pRam, off)
    12171219
    1218                         /** @note Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
     1220                        /* Note! Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
    12191221                        rc = pNode->pfnHandlerR3(pVM, GCPhys, pvSrc, pvBuf, cb, PGMACCESSTYPE_READ, pNode->pvUserR3);
    12201222                    }
     
    12641266                        void *pvSrc = PGMRAMRANGE_GETHCPTR(pRam, off)
    12651267
    1266                         /* Note: Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
     1268                        /* Note! Dangerous assumption that HC handlers don't do anything that really requires an EMT lock! */
    12671269                        rc = pNode->pfnHandlerR3(pVM, (RTGCPTR)GCPtr, pvSrc, pvBuf, cb, PGMACCESSTYPE_READ, 0);
    12681270                    }
     
    13851387    return;
    13861388}
     1389
    13871390
    13881391/**
  • trunk/src/VBox/VMM/VMMAll/REMAll.cpp

    r12989 r13565  
    3434#include <iprt/assert.h>
    3535
     36
     37#ifndef IN_RING3
    3638
    3739/**
     
    157159}
    158160
     161#endif /* !IN_RING3 */
     162
     163/**
     164 * Make REM flush all translation block upon the next call to REMR3State().
     165 *
     166 * @param   pVM             Pointer to the shared VM structure.
     167 */
     168VMMDECL(void) REMFlushTBs(PVM pVM)
     169{
     170    LogFlow(("REMFlushTBs: fFlushTBs=%RTbool fInREM=%RTbool fInStateSync=%RTbool\n",
     171             pVM->rem.s.fFlushTBs, pVM->rem.s.fInREM, pVM->rem.s.fInStateSync));
     172    pVM->rem.s.fFlushTBs = true;
     173}
     174
  • trunk/src/recompiler/VBoxREMWrapper.cpp

    r13532 r13565  
    337337static DECLCALLBACKPTR(int, pfnREMR3EmulateInstruction)(PVM);
    338338static DECLCALLBACKPTR(int, pfnREMR3Run)(PVM);
    339 static DECLCALLBACKPTR(int, pfnREMR3State)(PVM, bool fFlushTBs);
     339static DECLCALLBACKPTR(int, pfnREMR3State)(PVM);
    340340static DECLCALLBACKPTR(int, pfnREMR3StateBack)(PVM);
    341341static DECLCALLBACKPTR(void, pfnREMR3StateUpdate)(PVM);
     
    988988    { REMPARMDESC_FLAGS_INT,        sizeof(size_t), NULL }
    989989};
    990 static const REMPARMDESC g_aArgsState[] =
    991 {
    992     { REMPARMDESC_FLAGS_INT,        sizeof(PVM), NULL },
    993     { REMPARMDESC_FLAGS_INT,        sizeof(bool), NULL }
    994 };
    995990
    996991/** @} */
     
    10091004    { "REMR3EmulateInstruction",                (void *)&pfnREMR3EmulateInstruction,                &g_aArgsVM[0],                              RT_ELEMENTS(g_aArgsVM),                                REMFNDESC_FLAGS_RET_INT,    sizeof(int),    NULL },
    10101005    { "REMR3Run",                               (void *)&pfnREMR3Run,                               &g_aArgsVM[0],                              RT_ELEMENTS(g_aArgsVM),                                REMFNDESC_FLAGS_RET_INT,    sizeof(int),    NULL },
    1011     { "REMR3State",                             (void *)&pfnREMR3State,                             &g_aArgsState[0],                           RT_ELEMENTS(g_aArgsState),                             REMFNDESC_FLAGS_RET_INT,    sizeof(int),    NULL },
     1006    { "REMR3State",                             (void *)&pfnREMR3State,                             &g_aArgsVM[0],                              RT_ELEMENTS(g_aArgsVM),                                REMFNDESC_FLAGS_RET_INT,    sizeof(int),    NULL },
    10121007    { "REMR3StateBack",                         (void *)&pfnREMR3StateBack,                         &g_aArgsVM[0],                              RT_ELEMENTS(g_aArgsVM),                                REMFNDESC_FLAGS_RET_INT,    sizeof(int),    NULL },
    10131008    { "REMR3StateUpdate",                       (void *)&pfnREMR3StateUpdate,                       &g_aArgsVM[0],                              RT_ELEMENTS(g_aArgsVM),                                REMFNDESC_FLAGS_RET_VOID,   0,              NULL },
     
    19911986}
    19921987
    1993 REMR3DECL(int) REMR3State(PVM pVM, bool fFlushTBs)
     1988REMR3DECL(int) REMR3State(PVM pVM)
    19941989{
    19951990#ifdef USE_REM_STUBS
     
    19971992#else
    19981993    Assert(VALID_PTR(pfnREMR3State));
    1999     return pfnREMR3State(pVM, fFlushTBs);
     1994    return pfnREMR3State(pVM);
    20001995#endif
    20011996}
  • trunk/src/recompiler/VBoxRecompiler.c

    r13532 r13565  
    741741     * Sync the state and enable single instruction / single stepping.
    742742     */
    743     int rc = REMR3State(pVM, false /* no need to flush the TBs; we always compile. */);
     743    int rc = REMR3State(pVM);
    744744    if (VBOX_SUCCESS(rc))
    745745    {
     
    16321632 *
    16331633 * @param   pVM         VM Handle.
    1634  * @param   fFlushTBs   Flush all translation blocks before executing code
    16351634 *
    16361635 * @remark  The caller has to check for important FFs before calling REMR3Run. REMR3State will
     
    16381637 *          pending that would immediatly interrupt execution.
    16391638 */
    1640 REMR3DECL(int)  REMR3State(PVM pVM, bool fFlushTBs)
     1639REMR3DECL(int)  REMR3State(PVM pVM)
    16411640{
    16421641    Log2(("REMR3State:\n"));
     
    16501649    pVM->rem.s.fInStateSync = true;
    16511650
    1652     if (fFlushTBs)
     1651    /*
     1652     * If we have to flush TBs, do that immediately.
     1653     */
     1654    if (pVM->rem.s.fFlushTBs)
    16531655    {
    16541656        STAM_COUNTER_INC(&gStatFlushTBs);
    16551657        tb_flush(&pVM->rem.s.Env);
     1658        pVM->rem.s.fFlushTBs = false;
    16561659    }
    16571660
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