Changeset 20408 in vbox
- Timestamp:
- Jun 8, 2009 1:50:06 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/em.h
r20399 r20408 166 166 /** @} */ 167 167 168 /** @name REM locking routines 169 * @{ */ 170 VMMDECL(void) EMRemUnlock(PVM pVM); 171 VMMDECL(void) EMRemLock(PVM pVM); 172 VMMDECL(bool) EMRemIsLockOwner(PVM pVM); 173 VMMDECL(int) EMTryEnterRemLock(PVM pVM); 174 /** @} */ 175 168 176 #ifdef IN_RING3 169 177 /** @defgroup grp_em_r3 The EM Host Context Ring-3 API … … 183 191 184 192 VMMR3DECL(void) EMR3ReleaseOwnedLocks(PVM pVM); 185 VMMR3DECL(void) EMR3RemUnlock(PVM pVM);186 VMMR3DECL(void) EMR3RemLock(PVM pVM);187 VMMR3DECL(bool) EMR3RemIsLockOwner(PVM pVM);188 193 189 194 /** -
trunk/src/VBox/VMM/EM.cpp
r20406 r20408 863 863 864 864 /** 865 * Locks REM execution to a single VCpu866 *867 * @param pVM VM handle.868 */869 VMMR3DECL(void) EMR3RemLock(PVM pVM)870 {871 if (!PDMCritSectIsInitialized(&pVM->em.s.CritSectREM))872 return; /* early init */873 874 int rc = PDMCritSectEnter(&pVM->em.s.CritSectREM, VERR_SEM_BUSY);875 AssertMsg(rc == VINF_SUCCESS, ("%Rrc\n", rc));876 }877 878 /**879 * Unlocks REM execution880 *881 * @param pVM VM handle.882 */883 VMMR3DECL(void) EMR3RemUnlock(PVM pVM)884 {885 if (!PDMCritSectIsInitialized(&pVM->em.s.CritSectREM))886 return; /* early init */887 888 PDMCritSectLeave(&pVM->em.s.CritSectREM);889 }890 891 /**892 * Check if this VCPU currently owns the REM lock.893 *894 * @returns bool owner/not owner895 * @param pVM The VM to operate on.896 */897 VMMR3DECL(bool) EMR3RemIsLockOwner(PVM pVM)898 {899 return PDMCritSectIsOwner(&pVM->em.s.CritSectREM);900 }901 902 /**903 865 * Steps recompiled code. 904 866 * … … 913 875 LogFlow(("emR3RemStep: cs:eip=%04x:%08x\n", CPUMGetGuestCS(pVCpu), CPUMGetGuestEIP(pVCpu))); 914 876 915 EMR 3RemLock(pVM);877 EMRemLock(pVM); 916 878 917 879 /* … … 924 886 REMR3StateBack(pVM, pVCpu); 925 887 } 926 EMR 3RemUnlock(pVM);888 EMRemUnlock(pVM); 927 889 928 890 LogFlow(("emR3RemStep: returns %Rrc cs:eip=%04x:%08x\n", rc, CPUMGetGuestCS(pVCpu), CPUMGetGuestEIP(pVCpu))); … … 966 928 967 929 /* Big lock, but you are not supposed to own any lock when coming in here. */ 968 EMR 3RemLock(pVM);930 EMRemLock(pVM); 969 931 970 932 /* … … 1089 1051 STAM_PROFILE_STOP(&pVCpu->em.s.StatREMSync, e); 1090 1052 } 1091 EMR 3RemUnlock(pVM);1053 EMRemUnlock(pVM); 1092 1054 1093 1055 STAM_REL_PROFILE_ADV_STOP(&pVCpu->em.s.StatREMTotal, a); … … 1494 1456 STAM_PROFILE_START(&pVCpu->em.s.StatREMEmu, a); 1495 1457 Log(("EMINS: %04x:%RGv RSP=%RGv\n", pCtx->cs, (RTGCPTR)pCtx->rip, (RTGCPTR)pCtx->rsp)); 1496 EMR 3RemLock(pVM);1458 EMRemLock(pVM); 1497 1459 /* Flush the recompiler TLB if the VCPU has changed. */ 1498 1460 if (pVM->em.s.idLastRemCpu != pVCpu->idCpu) … … 1501 1463 1502 1464 rc = REMR3EmulateInstruction(pVM, pVCpu); 1503 EMR 3RemUnlock(pVM);1465 EMRemUnlock(pVM); 1504 1466 STAM_PROFILE_STOP(&pVCpu->em.s.StatREMEmu, a); 1505 1467 … … 3453 3415 if (VM_FF_IS_PENDING_EXCEPT(pVM, VM_FF_REM_HANDLER_NOTIFY, VM_FF_PGM_NO_MEMORY)) 3454 3416 { 3455 EMR 3RemLock(pVM);3417 EMRemLock(pVM); 3456 3418 REMR3ReplayHandlerNotifications(pVM); 3457 EMR 3RemUnlock(pVM);3419 EMRemUnlock(pVM); 3458 3420 } 3459 3421 -
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r20406 r20408 3357 3357 } 3358 3358 3359 /** 3360 * Locks REM execution to a single VCpu 3361 * 3362 * @param pVM VM handle. 3363 */ 3364 VMMDECL(void) EMRemLock(PVM pVM) 3365 { 3366 if (!PDMCritSectIsInitialized(&pVM->em.s.CritSectREM)) 3367 return; /* early init */ 3368 3369 int rc = PDMCritSectEnter(&pVM->em.s.CritSectREM, VERR_SEM_BUSY); 3370 AssertMsg(rc == VINF_SUCCESS, ("%Rrc\n", rc)); 3371 } 3372 3373 /** 3374 * Unlocks REM execution 3375 * 3376 * @param pVM VM handle. 3377 */ 3378 VMMDECL(void) EMRemUnlock(PVM pVM) 3379 { 3380 if (!PDMCritSectIsInitialized(&pVM->em.s.CritSectREM)) 3381 return; /* early init */ 3382 3383 PDMCritSectLeave(&pVM->em.s.CritSectREM); 3384 } 3385 3386 /** 3387 * Check if this VCPU currently owns the REM lock. 3388 * 3389 * @returns bool owner/not owner 3390 * @param pVM The VM to operate on. 3391 */ 3392 VMMDECL(bool) EMRemIsLockOwner(PVM pVM) 3393 { 3394 return PDMCritSectIsOwner(&pVM->em.s.CritSectREM); 3395 } 3396 3397 /** 3398 * Try to acquire the REM lock. 3399 * 3400 * @returns VBox status code 3401 * @param pVM The VM to operate on. 3402 */ 3403 VMMDECL(int) EMTryEnterRemLock(PVM pVM) 3404 { 3405 return PDMCritSectTryEnter(&pVM->em.s.CritSectREM); 3406 } 3407 -
trunk/src/recompiler/VBoxREMWrapper.cpp
r20406 r20408 1105 1105 { "DISInstr", (void *)(uintptr_t)&DISInstr, &g_aArgsDISInstr[0], RT_ELEMENTS(g_aArgsDISInstr), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL }, 1106 1106 { "EMR3FatalError", (void *)(uintptr_t)&EMR3FatalError, &g_aArgsEMR3FatalError[0], RT_ELEMENTS(g_aArgsEMR3FatalError), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, 1107 { "EMR 3RemLock", (void *)(uintptr_t)&EMR3RemLock,&g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },1108 { "EMR 3RemUnlock", (void *)(uintptr_t)&EMR3RemUnlock,&g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },1109 { "EMR 3RemIsLockOwner", (void *)(uintptr_t)&EMR3RemIsLockOwner,&g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, sizeof(bool), NULL },1107 { "EMRemLock", (void *)(uintptr_t)&EMRemLock, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, 1108 { "EMRemUnlock", (void *)(uintptr_t)&EMRemUnlock, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, 1109 { "EMRemIsLockOwner", (void *)(uintptr_t)&EMRemIsLockOwner, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, sizeof(bool), NULL }, 1110 1110 { "HWACCMR3CanExecuteGuest", (void *)(uintptr_t)&HWACCMR3CanExecuteGuest, &g_aArgsHWACCMR3CanExecuteGuest[0], RT_ELEMENTS(g_aArgsHWACCMR3CanExecuteGuest), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1111 1111 { "IOMIOPortRead", (void *)(uintptr_t)&IOMIOPortRead, &g_aArgsIOMIOPortRead[0], RT_ELEMENTS(g_aArgsIOMIOPortRead), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, -
trunk/src/recompiler/VBoxRecompiler.c
r20406 r20408 2693 2693 REMR3DECL(void) REMR3ReplayHandlerNotifications(PVM pVM) 2694 2694 { 2695 Assert(EMR 3RemIsLockOwner(pVM));2695 Assert(EMRemIsLockOwner(pVM)); 2696 2696 2697 2697 /* … … 2810 2810 #ifdef VBOX_WITH_REM_LOCKING 2811 2811 Assert(!PGMIsLockOwner(pVM)); 2812 EMR 3RemLock(pVM);2812 EMRemLock(pVM); 2813 2813 #endif 2814 2814 /* … … 2834 2834 pVM->rem.s.fIgnoreAll = false; 2835 2835 #ifdef VBOX_WITH_REM_LOCKING 2836 EMR 3RemUnlock(pVM);2836 EMRemUnlock(pVM); 2837 2837 #endif 2838 2838 } … … 2863 2863 2864 2864 #ifdef VBOX_WITH_REM_LOCKING 2865 EMR 3RemLock(pVM);2865 EMRemLock(pVM); 2866 2866 #endif 2867 2867 /* … … 2876 2876 pVM->rem.s.fIgnoreAll = false; 2877 2877 #ifdef VBOX_WITH_REM_LOCKING 2878 EMR 3RemUnlock(pVM);2878 EMRemUnlock(pVM); 2879 2879 #endif 2880 2880 } … … 2901 2901 2902 2902 #ifdef VBOX_WITH_REM_LOCKING 2903 EMR 3RemLock(pVM);2903 EMRemLock(pVM); 2904 2904 #endif 2905 2905 /* … … 2914 2914 pVM->rem.s.fIgnoreAll = false; 2915 2915 #ifdef VBOX_WITH_REM_LOCKING 2916 EMR 3RemUnlock(pVM);2916 EMRemUnlock(pVM); 2917 2917 #endif 2918 2918 } … … 2940 2940 2941 2941 #ifdef VBOX_WITH_REM_LOCKING 2942 EMR 3RemLock(pVM);2942 EMRemLock(pVM); 2943 2943 #endif 2944 2944 if (pVM->rem.s.cHandlerNotifications) … … 2956 2956 pVM->rem.s.fIgnoreAll = false; 2957 2957 #ifdef VBOX_WITH_REM_LOCKING 2958 EMR 3RemUnlock(pVM);2958 EMRemUnlock(pVM); 2959 2959 #endif 2960 2960 } … … 2978 2978 2979 2979 #ifdef VBOX_WITH_REM_LOCKING 2980 EMR 3RemLock(pVM);2980 EMRemLock(pVM); 2981 2981 #endif 2982 2982 if (pVM->rem.s.cHandlerNotifications) … … 3007 3007 pVM->rem.s.fIgnoreAll = false; 3008 3008 #ifdef VBOX_WITH_REM_LOCKING 3009 EMR 3RemUnlock(pVM);3009 EMRemUnlock(pVM); 3010 3010 #endif 3011 3011 } … … 3031 3031 3032 3032 #ifdef VBOX_WITH_REM_LOCKING 3033 EMR 3RemLock(pVM);3033 EMRemLock(pVM); 3034 3034 #endif 3035 3035 if (pVM->rem.s.cHandlerNotifications) … … 3065 3065 } 3066 3066 #ifdef VBOX_WITH_REM_LOCKING 3067 EMR 3RemUnlock(pVM);3067 EMRemUnlock(pVM); 3068 3068 #endif 3069 3069 }
Note:
See TracChangeset
for help on using the changeset viewer.