- Timestamp:
- Dec 4, 2008 1:14:29 PM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGMMap.cpp
r14755 r14979 761 761 PPGM pPGM = &pVM->pgm.s; 762 762 763 /* If mappings are not supposed to be put in the shadow page table, then this function is a nop. */ 764 if (!pgmMapAreMappingsEnabled(&pVM->pgm.s)) 765 return; 766 767 Assert(PGMGetGuestMode(pVM) <= PGMMODE_PAE_NX); 763 Assert(!pgmMapAreMappingsEnabled(&pVM->pgm.s) || PGMGetGuestMode(pVM) <= PGMMODE_PAE_NX); 768 764 769 765 /* … … 780 776 */ 781 777 #ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY 782 if (pPGM->pShw32BitPdR3->a[iNewPDE].n.u1Present) 778 if ( pgmMapAreMappingsEnabled(&pVM->pgm.s) 779 && pPGM->pShw32BitPdR3->a[iNewPDE].n.u1Present) 783 780 pgmPoolFree(pVM, pPGM->pShw32BitPdR3->a[iNewPDE].u & X86_PDE_PG_MASK, PGMPOOL_IDX_PD, iNewPDE); 784 781 #endif … … 788 785 pPGM->pInterPD->a[iNewPDE] = Pde; 789 786 #ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY 790 pPGM->pShw32BitPdR3->a[iNewPDE] = Pde; 787 if (pgmMapAreMappingsEnabled(&pVM->pgm.s)) 788 pPGM->pShw32BitPdR3->a[iNewPDE] = Pde; 791 789 #endif 792 790 /* … … 796 794 unsigned iPDE = iNewPDE * 2 % 512; 797 795 #ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY 798 if (pPGM->apShwPaePDsR3[iPD]->a[iPDE].n.u1Present) 796 if ( pgmMapAreMappingsEnabled(&pVM->pgm.s) 797 && pPGM->apShwPaePDsR3[iPD]->a[iPDE].n.u1Present) 799 798 pgmPoolFree(pVM, pPGM->apShwPaePDsR3[iPD]->a[iPDE].u & X86_PDE_PAE_PG_MASK, PGMPOOL_IDX_PAE_PD, iNewPDE * 2); 800 799 #endif … … 803 802 pPGM->apInterPaePDs[iPD]->a[iPDE] = PdePae0; 804 803 #ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY 805 pPGM->apShwPaePDsR3[iPD]->a[iPDE] = PdePae0; 804 if (pgmMapAreMappingsEnabled(&pVM->pgm.s)) 805 pPGM->apShwPaePDsR3[iPD]->a[iPDE] = PdePae0; 806 806 #endif 807 807 iPDE++; 808 808 #ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY 809 if (pPGM->apShwPaePDsR3[iPD]->a[iPDE].n.u1Present) 809 if ( pgmMapAreMappingsEnabled(&pVM->pgm.s) 810 && pPGM->apShwPaePDsR3[iPD]->a[iPDE].n.u1Present) 810 811 pgmPoolFree(pVM, pPGM->apShwPaePDsR3[iPD]->a[iPDE].u & X86_PDE_PAE_PG_MASK, PGMPOOL_IDX_PAE_PD, iNewPDE * 2 + 1); 811 812 #endif … … 814 815 pPGM->apInterPaePDs[iPD]->a[iPDE] = PdePae1; 815 816 #ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY 816 pPGM->apShwPaePDsR3[iPD]->a[iPDE] = PdePae1; 817 818 /* Set the PGM_PDFLAGS_MAPPING flag in the page directory pointer entry. (legacy PAE guest mode) */ 819 pPGM->pShwPaePdptR3->a[iPD].u |= PGM_PLXFLAGS_MAPPING; 817 if (pgmMapAreMappingsEnabled(&pVM->pgm.s)) 818 { 819 pPGM->apShwPaePDsR3[iPD]->a[iPDE] = PdePae1; 820 821 /* Set the PGM_PDFLAGS_MAPPING flag in the page directory pointer entry. (legacy PAE guest mode) */ 822 pPGM->pShwPaePdptR3->a[iPD].u |= PGM_PLXFLAGS_MAPPING; 823 } 820 824 #endif 821 825 } -
trunk/src/VBox/VMM/VMMSwitcher.cpp
r14845 r14979 615 615 { 616 616 Assert(offSrc < pSwitcher->cbCode); 617 # if defined(RT_OS_DARWIN) && defined(VBOX_WITH_HYBIRD_32BIT_KERNEL)617 # if defined(RT_OS_DARWIN) && defined(VBOX_WITH_HYBIRD_32BIT_KERNEL) 618 618 *uSrc.pu16 = 0x80; /* KERNEL64_CS from i386/seg.h */ 619 # else619 # else 620 620 AssertFatalMsgFailed(("FIX_HC_64BIT_CS not implemented for this host\n")); 621 #endif 621 # endif 622 break; 623 } 624 625 /* 626 * 64-bit HC pointer to the CPUM instance data (no argument). 627 */ 628 case FIX_HC_64BIT_CPUM: 629 { 630 Assert(offSrc < pSwitcher->cbCode); 631 *uSrc.pu64 = pVM->pVMR0 + RT_OFFSETOF(VM, cpum); 622 632 break; 623 633 } … … 635 645 } 636 646 637 /* 638 * 64-bit HC pointer to the CPUM instance data (no argument).639 */640 case FIX_HC_64BIT_CPUM:641 {642 Assert(offSrc < pSwitcher->cbCode);643 *uSrc.pu64 = pVM->pVMR0 + RT_OFFSETOF(VM, cpum);644 break;645 } 647 #if defined(RT_ARCH_X86) && defined(VBOX_WITH_64_BITS_GUESTS) 648 case FIX_GC_64_BIT_CPUM_OFF: 649 { 650 uint32_t offCPUM = *u.pu32++; 651 Assert(offCPUM < sizeof(pVM->cpum)); 652 *uSrc.pu64 = (uint32_t)(VM_RC_ADDR(pVM, &pVM->cpum) + offCPUM); 653 break; 654 } 655 #endif 646 656 647 657 /* -
trunk/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac
r14254 r14979 388 388 DEBUG_CHAR('4') 389 389 390 ; 3. Load 32-bitintermediate page table.390 ; 3. Load intermediate page table. 391 391 FIXUP SWITCHER_FIX_INTER_CR3_GC, 1 392 392 mov edx, 0ffffffffh -
trunk/src/VBox/VMM/VMMSwitcher/LegacyandAMD64.mac
r14900 r14979 151 151 152 152 CPUM_FROM_CPUMCPU(edx) 153 ; Load new gdt so we can do far jump after going into 64 bits mode153 ; Load new gdt so we can do a far jump after going into 64 bits mode 154 154 lgdt [edx + CPUM.Hyper.gdtr] 155 155 … … 224 224 ; 64-bit pCpum address. 225 225 NAME(pCpumIC): 226 FIXUP FIX_ HC_64BIT_CPUM, 0226 FIXUP FIX_GC_64_BIT_CPUM_OFF, 0, 0 227 227 dq 0ffffffffffffffffh 228 228 … … 234 234 ; Load CPUM pointer into rdx 235 235 mov rdx, [NAME(pCpumIC) wrt rip] 236 236 237 237 mov rax, cs 238 238 mov ds, rax 239 239 mov es, rax 240 mov fs, rax 241 mov gs, rax 242 240 243 241 ; Setup stack; use the lss_esp, ss pair for lss 244 DEBUG_CHAR('7')245 mov rsp, 0246 mov eax, [rdx + CPUM.Hyper.esp]247 mov [rdx + CPUM.Hyper.lss_esp], eax248 lss esp, [rdx + CPUM.Hyper.lss_esp]242 ;; DEBUG_CHAR('7') 243 ;; mov rsp, 0 244 ;; mov eax, [rdx + CPUM.Hyper.esp] 245 ;; mov [rdx + CPUM.Hyper.lss_esp], eax 246 ;; lss esp, [rdx + CPUM.Hyper.lss_esp] 249 247 250 248 ; call the hypervisor function with rdx=pCpumCpu 251 mov eax, [rdx + r8 + CPUM.Hyper.eip]252 CPUMCPU_FROM_CPUM(rdx)253 call rax249 ;; mov eax, [rdx + r8 + CPUM.Hyper.eip] 250 ;; CPUMCPU_FROM_CPUM(rdx) 251 ;; call rax 254 252 255 253 ; Load CPUM pointer into rdx 256 254 mov rdx, [NAME(pCpumIC) wrt rip] 257 CPUMCPU_FROM_CPUM(rdx)255 ;; CPUMCPU_FROM_CPUM(rdx) 258 256 259 257 ; Save the return code 260 mov [rdx + CPUMCPU.u32RetCode], eax258 ;; mov [rdx + CPUMCPU.u32RetCode], eax 261 259 262 260 ; now let's switch back … … 320 318 ALIGNCODE(16) 321 319 BEGINPROC VMMGCGuestToHostAsm 322 CPUMCPU_FROM_CPUM(rdx) 323 FIXUP FIX_INTER_AMD64_CR3, 1 324 mov rax, 0ffffffffh 325 mov cr3, rax 326 ;; We're now in the intermediate memory context! 320 ;; We're still in the intermediate memory context! 327 321 328 322 ;; … … 393 387 GLOBALNAME ICExitTarget 394 388 DEBUG_CHAR('8') 395 FIXUP FIX_HC_CPUM_OFF, 1, 0 389 390 ; load the hypervisor data selector into ds & es 391 FIXUP FIX_HYPER_DS, 1 392 mov eax, 0ffffh 393 mov ds, eax 394 mov es, eax 395 396 FIXUP FIX_GC_CPUM_OFF, 1, 0 396 397 mov edx, 0ffffffffh 397 398 CPUMCPU_FROM_CPUM(edx) … … 400 401 401 402 ;; now we're in host memory context, let's restore regs 402 403 FIXUP FIX_HC_CPUM_OFF, 1, 0 404 mov edx, 0ffffffffh 405 CPUMCPU_FROM_CPUM(edx) 406 407 403 408 ; activate host gdt and idt 404 409 lgdt [edx + CPUMCPU.Host.gdtr] … … 418 423 DEBUG_CHAR('2') 419 424 lldt [edx + CPUMCPU.Host.ldtr] 425 420 426 ; Restore segment registers 421 427 mov eax, [edx + CPUMCPU.Host.ds] -
trunk/src/VBox/VMM/VMMSwitcher/VMMSwitcher.h
r14771 r14979 64 64 #define FIX_GC_APIC_BASE_32BIT 34 65 65 #define FIX_HC_64BIT_NOCHECK 35 66 #define FIX_GC_64_BIT_CPUM_OFF 36 66 67 #define FIX_THE_END 255 67 68 /** @} */ -
trunk/src/VBox/VMM/VMMSwitcher/VMMSwitcher.mac
r14771 r14979 108 108 %define FIX_GC_APIC_BASE_32BIT 34 109 109 %define FIX_HC_64BIT_NOCHECK 35 110 %define FIX_GC_64_BIT_CPUM_OFF 36 110 111 %define FIX_THE_END 255 111 112 ;/** @} */
Note:
See TracChangeset
for help on using the changeset viewer.