Changeset 1210 in vbox
- Timestamp:
- Mar 5, 2007 12:36:53 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 19136
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/HWACCM.cpp
r914 r1210 251 251 252 252 /* Disable mapping of the hypervisor into the shadow page table. */ 253 PGMR3RemoveMappingsFromShwPD(pVM); 253 PGMR3ChangeShwPDMappings(pVM, false); 254 255 /* Disable the switcher */ 256 VMMR3DisableSwitcher(pVM); 254 257 } 255 258 -
trunk/src/VBox/VMM/PGM.cpp
r873 r1210 3384 3384 3385 3385 /** 3386 * Inform PGM we don't wish any mappingto be put into the shadow page table. (necessary for e.g. VMX)3386 * Inform PGM if we want all mappings to be put into the shadow page table. (necessary for e.g. VMX) 3387 3387 * 3388 3388 * @returns VBox status code. 3389 3389 * @param pVM VM handle. 3390 * /3391 PGMR3DECL(int) PGMR3RemoveMappingsFromShwPD(PVM pVM) 3392 { 3393 3394 pVM->pgm.s.fDisableMappings = true;3390 * @param fEnable Enable or disable shadow mappings 3391 */ 3392 PGMR3DECL(int) PGMR3ChangeShwPDMappings(PVM pVM, bool fEnable) 3393 { 3394 pVM->pgm.s.fDisableMappings = fEnable; 3395 3395 3396 3396 size_t cb; … … 3402 3402 AssertRCReturn(rc, rc); 3403 3403 3404 VMMR3DisableSwitcher(pVM);3405 3404 return VINF_SUCCESS; 3406 3405 } -
trunk/src/VBox/VMM/VMM.cpp
r1027 r1210 149 149 #include <VBox/version.h> 150 150 #include <VBox/x86.h> 151 #include <VBox/hwaccm.h> 151 152 #include <iprt/assert.h> 152 153 #include <iprt/alloc.h> … … 2913 2914 } 2914 2915 2916 /* execute the switch. */ 2917 VMMR3DECL(int) VMMDoHwAccmTest(PVM pVM) 2918 { 2919 uint32_t i; 2920 2921 if (!HWACCMR3IsAllowed(pVM)) 2922 { 2923 RTPrintf("VMM: Hardware accelerated test now available!\n"); 2924 return VERR_ACCESS_DENIED; 2925 } 2926 2927 /* 2928 * These forced actions are not necessary for the test and trigger breakpoints too. 2929 */ 2930 VM_FF_CLEAR(pVM, VM_FF_TRPM_SYNC_IDT); 2931 VM_FF_CLEAR(pVM, VM_FF_SELM_SYNC_TSS); 2932 2933 /* Enable mapping of the hypervisor into the shadow page table. */ 2934 PGMR3ChangeShwPDMappings(pVM, true); 2935 2936 /* 2937 * Setup stack for calling VMMGCEntry(). 2938 */ 2939 RTGCPTR GCPtrEP; 2940 int rc = PDMR3GetSymbolGC(pVM, VMMGC_MAIN_MODULE_NAME, "VMMGCEntry", &GCPtrEP); 2941 if (VBOX_SUCCESS(rc)) 2942 { 2943 RTPrintf("VMM: VMMGCEntry=%VGv\n", GCPtrEP); 2944 /* 2945 * Profile switching. 2946 */ 2947 RTPrintf("VMM: profiling switcher...\n"); 2948 Log(("VMM: profiling switcher...\n")); 2949 uint64_t TickMin = ~0; 2950 uint64_t tsBegin = RTTimeNanoTS(); 2951 uint64_t TickStart = ASMReadTSC(); 2952 for (i = 0; i < 1000000; i++) 2953 { 2954 CPUMHyperSetCtxCore(pVM, NULL); 2955 CPUMSetHyperESP(pVM, pVM->vmm.s.pbGCStackBottom); /* Clear the stack. */ 2956 CPUMPushHyper(pVM, 0); 2957 CPUMPushHyper(pVM, VMMGC_DO_TESTCASE_HWACCM_NOP); 2958 CPUMPushHyper(pVM, pVM->pVMGC); 2959 CPUMPushHyper(pVM, 3 * sizeof(RTGCPTR)); /* stack frame size */ 2960 CPUMPushHyper(pVM, GCPtrEP); /* what to call */ 2961 CPUMSetHyperEIP(pVM, pVM->vmm.s.pfnGCCallTrampoline); 2962 2963 PCPUMCTX pHyperCtx, pGuestCtx; 2964 2965 CPUMQueryHyperCtxPtr(pVM, &pHyperCtx); 2966 CPUMQueryGuestCtxPtr(pVM, &pGuestCtx); 2967 2968 /* Copy the hypervisor context to make sure we have a valid guest context. */ 2969 *pGuestCtx = *pHyperCtx; 2970 2971 uint64_t TickThisStart = ASMReadTSC(); 2972 rc = SUPCallVMMR0(pVM->pVMR0, VMMR0_DO_HWACC_RUN, NULL); 2973 uint64_t TickThisElapsed = ASMReadTSC() - TickThisStart; 2974 if (VBOX_FAILURE(rc)) 2975 { 2976 Log(("VMM: GC returned fatal %Vra in iteration %d\n", rc, i)); 2977 VMMR3FatalDump(pVM, rc); 2978 return rc; 2979 } 2980 if (TickThisElapsed < TickMin) 2981 TickMin = TickThisElapsed; 2982 } 2983 uint64_t TickEnd = ASMReadTSC(); 2984 uint64_t tsEnd = RTTimeNanoTS(); 2985 2986 uint64_t Elapsed = tsEnd - tsBegin; 2987 uint64_t PerIteration = Elapsed / (uint64_t)i; 2988 uint64_t cTicksElapsed = TickEnd - TickStart; 2989 uint64_t cTicksPerIteration = cTicksElapsed / (uint64_t)i; 2990 2991 RTPrintf("VMM: %8d cycles in %11llu ns (%11lld ticks), %10llu ns/iteration (%11lld ticks) Min %11lld ticks\n", 2992 i, Elapsed, cTicksElapsed, PerIteration, cTicksPerIteration, TickMin); 2993 Log(("VMM: %8d cycles in %11llu ns (%11lld ticks), %10llu ns/iteration (%11lld ticks) Min %11lld ticks\n", 2994 i, Elapsed, cTicksElapsed, PerIteration, cTicksPerIteration, TickMin)); 2995 2996 rc = VINF_SUCCESS; 2997 } 2998 else 2999 AssertMsgFailed(("Failed to resolved VMMGC.gc::VMMGCEntry(), rc=%Vrc\n", rc)); 3000 3001 return rc; 3002 } -
trunk/src/VBox/VMM/VMMGC/VMMGC.cpp
r1027 r1210 98 98 99 99 /* 100 * Testcase executes a privileged instruction to force a world switch. (in both SVM & VMX) 101 */ 102 case VMMGC_DO_TESTCASE_HWACCM_NOP: 103 ASMRdMsr_Low(MSR_IA32_SYSENTER_CS); 104 return 0; 105 106 /* 100 107 * Delay for ~100us. 101 108 */ -
trunk/src/VBox/VMM/VMMInternal.h
r988 r1210 360 360 /** Testcase for checking interrupt masking.. */ 361 361 VMMGC_DO_TESTCASE_INTERRUPT_MASKING, 362 /** Switching testing and profiling stub. */ 363 VMMGC_DO_TESTCASE_HWACCM_NOP, 362 364 363 365 /** The usual 32-bit hack. */ -
trunk/src/VBox/VMM/testcase/Makefile
r167 r1210 31 31 PROGRAMS += tstAsmStructs tstAsmStructsGC 32 32 endif 33 PROGRAMS += tstVMM 33 PROGRAMS += tstVMM tstVMM-HwAccm 34 34 ifdef VBOX_WITH_TESTCASES 35 35 PROGRAMS += tstCFGM tstSSM tstMMHyperHeap tstVMM-2 tstVMREQ tstMicro tstCompiler tstVMMR0CallHost-1 … … 120 120 tstVMM_TEMPLATE = VBOXR3EXE 121 121 tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME) 122 123 tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp 124 tstVMM-HwAccm_TEMPLATE = VBOXR3EXE 125 tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME) 122 126 123 127 tstVMM-2_SOURCES = tstVMM-2.cpp
Note:
See TracChangeset
for help on using the changeset viewer.