- Timestamp:
- May 20, 2008 11:09:40 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/hwacc_svm.h
r8943 r8948 565 565 SVM_EVENT EventInject; 566 566 /** Offset 0xB0 - Host CR3 for nested paging. */ 567 uint64_t u64 HostCR3;567 uint64_t u64NestedPagingCR3; 568 568 /** Offset 0xB8 - LBR Virtualization. */ 569 569 uint64_t u64LBRVirt; -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r8945 r8948 255 255 /* Note: CR8 reads will refer to V_TPR, so no need to catch them. */ 256 256 /** @note CR0 & CR4 can be safely read when guest and shadow copies are identical. */ 257 pVMCB->ctrl.u16InterceptRdCRx = RT_BIT(0) | RT_BIT(3) | RT_BIT(4); 257 if (!pVM->hwaccm.s.svm.fNestedPaging) 258 pVMCB->ctrl.u16InterceptRdCRx = RT_BIT(0) | RT_BIT(3) | RT_BIT(4); 259 else 260 pVMCB->ctrl.u16InterceptRdCRx = RT_BIT(0); 258 261 259 262 /* 260 263 * CR0/3/4 writes must be intercepted for obvious reasons. 261 264 */ 262 pVMCB->ctrl.u16InterceptWrCRx = RT_BIT(0) | RT_BIT(3) | RT_BIT(4) | RT_BIT(8); 265 if (!pVM->hwaccm.s.svm.fNestedPaging) 266 pVMCB->ctrl.u16InterceptWrCRx = RT_BIT(0) | RT_BIT(3) | RT_BIT(4) | RT_BIT(8); 267 else 268 pVMCB->ctrl.u16InterceptWrCRx = RT_BIT(0) | RT_BIT(8); 263 269 264 270 /* Intercept all DRx reads and writes. */ … … 583 589 val &= ~(X86_CR0_CD|X86_CR0_NW); 584 590 585 val |= X86_CR0_PG; /* Paging is always enabled; even when the guest is running in real mode or PE without paging. */ 586 val |= X86_CR0_WP; /* Must set this as we rely on protect various pages and supervisor writes must be caught. */ 591 /* Note: WP is not relevant in nested paging mode as we catch accesses on the (host) physical level. */ 592 /* Note: In nested paging mode the guest is allowed to run with paging disabled; the guest physical to host physical translation is still active. */ 593 if (!pVM->hwaccm.s.svm.fNestedPaging) 594 { 595 val |= X86_CR0_PG; /* Paging is always enabled; even when the guest is running in real mode or PE without paging. */ 596 val |= X86_CR0_WP; /* Must set this as we rely on protect various pages and supervisor writes must be caught. */ 597 } 587 598 pVMCB->guest.u64CR0 = val; 588 599 } … … 593 604 { 594 605 /* Save our shadow CR3 register. */ 595 pVMCB->guest.u64CR3 = PGMGetHyperCR3(pVM); 606 if (!pVM->hwaccm.s.svm.fNestedPaging) 607 pVMCB->guest.u64CR3 = PGMGetHyperCR3(pVM); 608 else 609 pVMCB->guest.u64CR3 = pCtx->cr3; 596 610 } 597 611 … … 599 613 { 600 614 val = pCtx->cr4; 601 switch(pVM->hwaccm.s.enmShadowMode) 602 { 603 case PGMMODE_REAL: 604 case PGMMODE_PROTECTED: /* Protected mode, no paging. */ 605 AssertFailed(); 606 return VERR_PGM_UNSUPPORTED_HOST_PAGING_MODE; 607 608 case PGMMODE_32_BIT: /* 32-bit paging. */ 609 break; 610 611 case PGMMODE_PAE: /* PAE paging. */ 612 case PGMMODE_PAE_NX: /* PAE paging with NX enabled. */ 613 /** @todo use normal 32 bits paging */ 614 val |= X86_CR4_PAE; 615 break; 616 617 case PGMMODE_AMD64: /* 64-bit AMD paging (long mode). */ 618 case PGMMODE_AMD64_NX: /* 64-bit AMD paging (long mode) with NX enabled. */ 619 AssertFailed(); 620 return VERR_PGM_UNSUPPORTED_HOST_PAGING_MODE; 621 622 default: /* shut up gcc */ 623 AssertFailed(); 624 return VERR_PGM_UNSUPPORTED_HOST_PAGING_MODE; 615 if (!pVM->hwaccm.s.svm.fNestedPaging) 616 { 617 switch(pVM->hwaccm.s.enmShadowMode) 618 { 619 case PGMMODE_REAL: 620 case PGMMODE_PROTECTED: /* Protected mode, no paging. */ 621 AssertFailed(); 622 return VERR_PGM_UNSUPPORTED_HOST_PAGING_MODE; 623 624 case PGMMODE_32_BIT: /* 32-bit paging. */ 625 break; 626 627 case PGMMODE_PAE: /* PAE paging. */ 628 case PGMMODE_PAE_NX: /* PAE paging with NX enabled. */ 629 /** @todo use normal 32 bits paging */ 630 val |= X86_CR4_PAE; 631 break; 632 633 case PGMMODE_AMD64: /* 64-bit AMD paging (long mode). */ 634 case PGMMODE_AMD64_NX: /* 64-bit AMD paging (long mode) with NX enabled. */ 635 AssertFailed(); 636 return VERR_PGM_UNSUPPORTED_HOST_PAGING_MODE; 637 638 default: /* shut up gcc */ 639 AssertFailed(); 640 return VERR_PGM_UNSUPPORTED_HOST_PAGING_MODE; 641 } 625 642 } 626 643 pVMCB->guest.u64CR4 = val; … … 703 720 unsigned cResume = 0; 704 721 722 Assert(!pVM->hwaccm.s.svm.fNestedPaging); 723 705 724 STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatEntry, x); 706 725 … … 788 807 STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatInGC, x); 789 808 790 /* Enable nested paging (disabled each time after #VMEXIT). */809 /* Enable nested paging if necessary (disabled each time after #VMEXIT). */ 791 810 pVMCB->ctrl.NestedPaging.n.u1NestedPaging = pVM->hwaccm.s.svm.fNestedPaging; 792 811 … … 922 941 Log(("ctrl.EventInject.u32ErrorCode %x\n", pVMCB->ctrl.EventInject.n.u32ErrorCode)); 923 942 924 Log(("ctrl.u64 HostCR3 %VX64\n", pVMCB->ctrl.u64HostCR3));943 Log(("ctrl.u64NestedPagingCR3 %VX64\n", pVMCB->ctrl.u64NestedPagingCR3)); 925 944 Log(("ctrl.u64LBRVirt %VX64\n", pVMCB->ctrl.u64LBRVirt)); 926 945
Note:
See TracChangeset
for help on using the changeset viewer.