Changeset 13532 in vbox
- Timestamp:
- Oct 23, 2008 12:39:48 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 38381
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/cpum.h
r13198 r13532 890 890 VMMDECL(void) CPUMPushHyper(PVM pVM, uint32_t u32); 891 891 VMMDECL(void) CPUMHyperSetCtxCore(PVM pVM, PCPUMCTXCORE pCtxCore); 892 VMMDECL( int) CPUMQueryGuestCtxPtr(PVM pVM, PCPUMCTX *ppCtx);892 VMMDECL(PCPUMCTX) CPUMQueryGuestCtxPtr(PVM pVM); 893 893 VMMDECL(int) CPUMQueryHyperCtxPtr(PVM pVM, PCPUMCTX *ppCtx); 894 894 VMMDECL(PCCPUMCTXCORE) CPUMGetGuestCtxCore(PVM pVM); -
trunk/src/VBox/VMM/DBGF.cpp
r13005 r13532 558 558 uint32_t eip = CPUMGetGuestEIP(pVM); 559 559 #else 560 PCPUMCTX pCtx; 561 CPUMQueryGuestCtxPtr(pVM, &pCtx); 562 RTGCPTR eip = pCtx->rip + pCtx->csHid.u64Base; 560 PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVM); 561 RTGCPTR eip = pCtx->rip + pCtx->csHid.u64Base; 563 562 #endif 564 563 for (iBp = 0; iBp < RT_ELEMENTS(pVM->dbgf.s.aBreakpoints); iBp++) -
trunk/src/VBox/VMM/EM.cpp
r13413 r13532 132 132 pVM->em.s.fForceRAW = false; 133 133 134 rc = CPUMQueryGuestCtxPtr(pVM, &pVM->em.s.pCtx); 135 AssertMsgRC(rc, ("CPUMQueryGuestCtxPtr -> %Vrc\n", rc)); 134 pVM->em.s.pCtx = CPUMQueryGuestCtxPtr(pVM); 136 135 pVM->em.s.pPatmGCState = PATMR3QueryGCStateHC(pVM); 137 136 AssertMsg(pVM->em.s.pPatmGCState, ("PATMR3QueryGCStateHC failed!\n")); -
trunk/src/VBox/VMM/HWACCM.cpp
r13434 r13532 797 797 PCPUMCTX pCtx; 798 798 799 CPUMQueryGuestCtxPtr(pVM, &pCtx);799 pCtx = CPUMQueryGuestCtxPtr(pVM); 800 800 801 801 /* After a real mode switch to protected mode we must force -
trunk/src/VBox/VMM/PATM/CSAM.cpp
r13144 r13532 2405 2405 0x2F}; /* OpenBSD 4.0 after install */ 2406 2406 2407 rc = CPUMQueryGuestCtxPtr(pVM, &pCtx); 2408 AssertRC(rc); /* can't fail */ 2407 pCtx = CPUMQueryGuestCtxPtr(pVM); 2409 2408 2410 2409 for (unsigned i=0;i<RT_ELEMENTS(aOpenBsdPushCSOffset);i++) -
trunk/src/VBox/VMM/PATM/PATM.cpp
r13144 r13532 419 419 { 420 420 PCPUMCTX pCtx; 421 int rc;422 421 423 422 /* Update CPUMCTX guest context pointer. */ … … 428 427 RTAvloU32DoWithAll(&pVM->patm.s.PatchLookupTreeHC->PatchTree, true, RelocatePatches, (void *)pVM); 429 428 430 rc = CPUMQueryGuestCtxPtr(pVM, &pCtx); 431 AssertRC(rc); 429 pCtx = CPUMQueryGuestCtxPtr(pVM); 432 430 433 431 /* If we are running patch code right now, then also adjust EIP. */ … … 3993 3991 3994 3992 /* Make sure the code selector is wide open; otherwise refuse. */ 3995 CPUMQueryGuestCtxPtr(pVM, &pCtx);3993 pCtx = CPUMQueryGuestCtxPtr(pVM); 3996 3994 if (CPUMGetGuestCPL(pVM, CPUMCTX2CORE(pCtx)) == 0) 3997 3995 { … … 6183 6181 RTRCPTR retaddr; 6184 6182 PCPUMCTX pCtx; 6185 int rc; 6186 6187 rc = CPUMQueryGuestCtxPtr(pVM, &pCtx); 6188 AssertRC(rc); 6183 6184 pCtx = CPUMQueryGuestCtxPtr(pVM); 6189 6185 6190 6186 rc = PGMPhysSimpleReadGCPtr(pVM, &retaddr, pCtx->esp, sizeof(retaddr)); -
trunk/src/VBox/VMM/PATM/VMMAll/PATMAll.cpp
r12989 r13532 71 71 #ifdef PATM_EMULATE_SYSENTER 72 72 PCPUMCTX pCtx; 73 int rc;74 73 75 74 /* Check if the sysenter handler has changed. */ 76 rc = CPUMQueryGuestCtxPtr(pVM, &pCtx); 77 AssertRC(rc); 78 if ( rc == VINF_SUCCESS 79 && pCtx->SysEnter.cs != 0 75 pCtx = CPUMQueryGuestCtxPtr(pVM); 76 if ( pCtx->SysEnter.cs != 0 80 77 && pCtx->SysEnter.eip != 0 81 78 ) … … 301 298 VMMDECL(bool) PATMAreInterruptsEnabled(PVM pVM) 302 299 { 303 PCPUMCTX pCtx = 0; 304 int rc; 305 306 rc = CPUMQueryGuestCtxPtr(pVM, &pCtx); 307 AssertRC(rc); 300 PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVM); 308 301 309 302 return PATMAreInterruptsEnabledByCtxCore(pVM, CPUMCTX2CORE(pCtx)); … … 389 382 VMMDECL(int) PATMSysCall(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu) 390 383 { 391 PCPUMCTX pCtx; 392 int rc; 393 394 rc = CPUMQueryGuestCtxPtr(pVM, &pCtx); 395 AssertRCReturn(rc, VINF_EM_RAW_RING_SWITCH); 384 PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVM); 396 385 397 386 if (pCpu->pCurInstr->opcode == OP_SYSENTER) -
trunk/src/VBox/VMM/TRPM.cpp
r13144 r13532 1343 1343 int rc; 1344 1344 1345 rc = CPUMQueryGuestCtxPtr(pVM, &pCtx); 1346 AssertRC(rc); 1345 pCtx = CPUMQueryGuestCtxPtr(pVM); 1347 1346 Assert(!PATMIsPatchGCAddr(pVM, (RTGCPTR)pCtx->eip)); 1348 1347 Assert(!VM_FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS)); -
trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp
r12989 r13532 452 452 * Queries the pointer to the internal CPUMCTX structure 453 453 * 454 * @returns VBox status code.454 * @returns The CPUMCTX pointer. 455 455 * @param pVM Handle to the virtual machine. 456 * @param ppCtx Receives the CPUMCTX pointer when successful. 457 */ 458 VMMDECL(int) CPUMQueryGuestCtxPtr(PVM pVM, PCPUMCTX *ppCtx) 459 { 460 *ppCtx = &pVM->cpum.s.Guest; 461 return VINF_SUCCESS; 456 */ 457 VMMDECL(PCPUMCTX) CPUMQueryGuestCtxPtr(PVM pVM) 458 { 459 return &pVM->cpum.s.Guest; 462 460 } 463 461 -
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r13447 r13532 2541 2541 uint64_t val; 2542 2542 CPUMCTX *pCtx; 2543 int rc ;2543 int rc = VINF_SUCCESS; 2544 2544 2545 2545 /** @todo According to the Intel manuals, there's a REX version of RDMSR that is slightly different. 2546 2546 * That version clears the high dwords of both RDX & RAX */ 2547 rc = CPUMQueryGuestCtxPtr(pVM, &pCtx); 2548 AssertRC(rc); 2547 pCtx = CPUMQueryGuestCtxPtr(pVM); 2549 2548 2550 2549 /* Get the current privilege level. */ … … 2669 2668 uint64_t val; 2670 2669 CPUMCTX *pCtx; 2671 int rc;2672 2670 2673 2671 /* Note: works the same in 32 and 64 bits modes. */ 2674 rc = CPUMQueryGuestCtxPtr(pVM, &pCtx); 2675 AssertRC(rc); 2672 pCtx = CPUMQueryGuestCtxPtr(pVM); 2676 2673 2677 2674 /* Get the current privilege level. */ … … 2689 2686 { 2690 2687 case MSR_IA32_APICBASE: 2691 rc = PDMApicSetBase(pVM, val); 2688 { 2689 int rc = PDMApicSetBase(pVM, val); 2692 2690 AssertRC(rc); 2693 2691 break; 2692 } 2694 2693 2695 2694 case MSR_IA32_CR_PAT: -
trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp
r13517 r13532 77 77 78 78 /** Maximum ASID allowed. */ 79 uint32_t uMaxASID;79 uint32_t uMaxASID; 80 80 81 81 struct … … 128 128 } cpuid; 129 129 130 HWACCMSTATE enmHwAccmState;131 132 bool fSuspended;130 HWACCMSTATE enmHwAccmState; 131 132 volatile bool fSuspended; 133 133 } HWACCMR0Globals; 134 134 … … 530 530 531 531 /* Make sure we don't touch hwaccm after we've disabled hwaccm in preparation of a suspend. */ 532 if ( HWACCMR0Globals.fSuspended)532 if (ASMAtomicReadBool(&HWACCMR0Globals.fSuspended)) 533 533 return VERR_HWACCM_SUSPEND_PENDING; 534 534 … … 686 686 687 687 if (enmEvent == RTPOWEREVENT_SUSPEND) 688 HWACCMR0Globals.fSuspended = true;688 ASMAtomicWriteBool(&HWACCMR0Globals.fSuspended, true); 689 689 690 690 if (HWACCMR0Globals.enmHwAccmState == HWACCMSTATE_ENABLED) … … 720 720 } 721 721 if (enmEvent == RTPOWEREVENT_RESUME) 722 HWACCMR0Globals.fSuspended = false;722 ASMAtomicWriteBool(&HWACCMR0Globals.fSuspended, false); 723 723 } 724 724 … … 742 742 743 743 /* Make sure we don't touch hwaccm after we've disabled hwaccm in preparation of a suspend. */ 744 if ( HWACCMR0Globals.fSuspended)744 if (ASMAtomicReadBool(&HWACCMR0Globals.fSuspended)) 745 745 return VERR_HWACCM_SUSPEND_PENDING; 746 746 … … 800 800 801 801 /* Make sure we don't touch hwaccm after we've disabled hwaccm in preparation of a suspend. */ 802 AssertReturn(! HWACCMR0Globals.fSuspended, VERR_HWACCM_SUSPEND_PENDING);802 AssertReturn(!ASMAtomicReadBool(&HWACCMR0Globals.fSuspended), VERR_HWACCM_SUSPEND_PENDING); 803 803 804 804 /* Terminate a VT-x or AMD-V VM. */ … … 818 818 819 819 /* Make sure we don't touch hwaccm after we've disabled hwaccm in preparation of a suspend. */ 820 AssertReturn(! HWACCMR0Globals.fSuspended, VERR_HWACCM_SUSPEND_PENDING);820 AssertReturn(!ASMAtomicReadBool(&HWACCMR0Globals.fSuspended), VERR_HWACCM_SUSPEND_PENDING); 821 821 822 822 #ifdef LOG_ENABLED … … 842 842 843 843 /* Make sure we can't enter a session after we've disabled hwaccm in preparation of a suspend. */ 844 AssertReturn(!HWACCMR0Globals.fSuspended, VERR_HWACCM_SUSPEND_PENDING); 845 846 rc = CPUMQueryGuestCtxPtr(pVM, &pCtx); 847 if (VBOX_FAILURE(rc)) 848 return rc; 844 AssertReturn(!ASMAtomicReadBool(&HWACCMR0Globals.fSuspended), VERR_HWACCM_SUSPEND_PENDING); 845 846 pCtx = CPUMQueryGuestCtxPtr(pVM); 849 847 850 848 /* Always load the guest's FPU/XMM state on-demand. */ … … 894 892 int rc; 895 893 896 AssertReturn(!HWACCMR0Globals.fSuspended, VERR_HWACCM_SUSPEND_PENDING); 897 898 rc = CPUMQueryGuestCtxPtr(pVM, &pCtx); 899 if (VBOX_FAILURE(rc)) 900 return rc; 894 AssertReturn(!ASMAtomicReadBool(&HWACCMR0Globals.fSuspended), VERR_HWACCM_SUSPEND_PENDING); 895 896 pCtx = CPUMQueryGuestCtxPtr(pVM); 901 897 902 898 /* Note: It's rather tricky with longjmps done by e.g. Log statements or the page fault handler. … … 939 935 Assert(!VM_FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL)); 940 936 Assert(HWACCMR0Globals.aCpuInfo[idCpu].fConfigured); 941 AssertReturn(!HWACCMR0Globals.fSuspended, VERR_HWACCM_SUSPEND_PENDING); 942 943 rc = CPUMQueryGuestCtxPtr(pVM, &pCtx); 944 if (VBOX_FAILURE(rc)) 945 return rc; 937 AssertReturn(!ASMAtomicReadBool(&HWACCMR0Globals.fSuspended), VERR_HWACCM_SUSPEND_PENDING); 938 939 pCtx = CPUMQueryGuestCtxPtr(pVM); 946 940 947 941 return HWACCMR0Globals.pfnRunGuestCode(pVM, pCtx); … … 955 949 VMMR0DECL(bool) HWACCMR0SuspendPending() 956 950 { 957 return HWACCMR0Globals.fSuspended;951 return ASMAtomicReadBool(&HWACCMR0Globals.fSuspended); 958 952 } 959 953 -
trunk/src/VBox/VMM/VMMTests.cpp
r12975 r13532 532 532 533 533 CPUMQueryHyperCtxPtr(pVM, &pHyperCtx); 534 CPUMQueryGuestCtxPtr(pVM, &pGuestCtx);534 pGuestCtx = CPUMQueryGuestCtxPtr(pVM); 535 535 536 536 /* Copy the hypervisor context to make sure we have a valid guest context. */ -
trunk/src/recompiler/VBoxREMWrapper.cpp
r13375 r13532 495 495 static const REMPARMDESC g_aArgsCPUMQueryGuestCtxPtr[] = 496 496 { 497 { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL }, 498 { REMPARMDESC_FLAGS_INT, sizeof(PCPUMCTX *), NULL } 497 { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL } 499 498 }; 500 499 static const REMPARMDESC g_aArgsCSAMR3MonitorPage[] = … … 1058 1057 { "CPUMGetGuestCS", (void *)(uintptr_t)&CPUMGetGuestCS, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(RTSEL), NULL }, 1059 1058 { "CPUMGetGuestSS", (void *)(uintptr_t)&CPUMGetGuestSS, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(RTSEL), NULL }, 1060 { "CPUMQueryGuestCtxPtr", (void *)(uintptr_t)&CPUMQueryGuestCtxPtr, &g_aArgsCPUMQueryGuestCtxPtr[0], RT_ELEMENTS(g_aArgsCPUMQueryGuestCtxPtr), REMFNDESC_FLAGS_RET_INT, sizeof( int),NULL },1059 { "CPUMQueryGuestCtxPtr", (void *)(uintptr_t)&CPUMQueryGuestCtxPtr, &g_aArgsCPUMQueryGuestCtxPtr[0], RT_ELEMENTS(g_aArgsCPUMQueryGuestCtxPtr), REMFNDESC_FLAGS_RET_INT, sizeof(PCPUMCTX), NULL }, 1061 1060 { "CSAMR3MonitorPage", (void *)(uintptr_t)&CSAMR3MonitorPage, &g_aArgsCSAMR3MonitorPage[0], RT_ELEMENTS(g_aArgsCSAMR3MonitorPage), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1062 1061 { "CSAMR3UnmonitorPage", (void *)(uintptr_t)&CSAMR3UnmonitorPage, &g_aArgsCSAMR3UnmonitorPage[0], RT_ELEMENTS(g_aArgsCSAMR3UnmonitorPage), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, -
trunk/src/recompiler/VBoxRecompiler.c
r13375 r13532 279 279 280 280 /* ctx. */ 281 int rc = CPUMQueryGuestCtxPtr(pVM, &pVM->rem.s.pCtx); 282 if (VBOX_FAILURE(rc)) 283 { 284 AssertMsgFailed(("Failed to obtain guest ctx pointer. rc=%Vrc\n", rc)); 285 return rc; 286 } 281 pVM->rem.s.pCtx = CPUMQueryGuestCtxPtr(pVM); 287 282 AssertMsg(MMR3PhysGetRamSize(pVM) == 0, ("Init order have changed! REM depends on notification about ALL physical memory registrations\n")); 288 283 … … 327 322 * Register the saved state data unit. 328 323 */ 329 rc = SSMR3RegisterInternal(pVM, "rem", 1, REM_SAVED_STATE_VERSION, sizeof(uint32_t) * 10,330 NULL, remR3Save, NULL,331 NULL, remR3Load, NULL);324 int rc = SSMR3RegisterInternal(pVM, "rem", 1, REM_SAVED_STATE_VERSION, sizeof(uint32_t) * 10, 325 NULL, remR3Save, NULL, 326 NULL, remR3Load, NULL); 332 327 if (VBOX_FAILURE(rc)) 333 328 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.