Changeset 7730 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Apr 3, 2008 4:30:35 PM (17 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp
r7650 r7730 639 639 } 640 640 641 CPUMDECL(void) CPUMSetGuestEFER(PVM pVM, uint64_t val) 642 { 643 pVM->cpum.s.Guest.msrEFER = val; 644 } 641 645 642 646 CPUMDECL(uint32_t) CPUMGetGuestIDTR(PVM pVM, uint16_t *pcbLimit) … … 686 690 return pVM->cpum.s.Guest.ldtr; 687 691 } 688 689 692 690 693 CPUMDECL(uint32_t) CPUMGetGuestCR0(PVM pVM) … … 851 854 } 852 855 return VINF_SUCCESS; 856 } 857 858 CPUMDECL(uint64_t) CPUMGetGuestEFER(PVM pVM) 859 { 860 return pVM->cpum.s.Guest.msrEFER; 853 861 } 854 862 -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r7728 r7730 1622 1622 PGM_BTH_DECL(int, CheckPageFault)(PVM pVM, uint32_t uErr, PSHWPDE pPdeDst, PGSTPDE pPdeSrc, RTGCUINTPTR GCPtrPage) 1623 1623 { 1624 bool fWriteProtect = !!(CPUMGetGuestCR0(pVM) & X86_CR0_WP); 1625 bool fUserLevelFault = !!(uErr & X86_TRAP_PF_US); 1626 bool fWriteFault = !!(uErr & X86_TRAP_PF_RW); 1624 bool fWriteProtect = !!(CPUMGetGuestCR0(pVM) & X86_CR0_WP); 1625 bool fUserLevelFault = !!(uErr & X86_TRAP_PF_US); 1626 bool fWriteFault = !!(uErr & X86_TRAP_PF_RW); 1627 # if PGM_WITH_NX(PGM_GST_TYPE) 1628 bool fNoExecuteBitValid = !!(CPUMGetGuestEFER(pVM) & MSR_K6_EFER_NXE); 1629 # endif 1627 1630 1628 1631 STAM_PROFILE_START(&pVM->pgm.s.CTXMID(Stat, DirtyBitTracking), a); … … 1639 1642 if ( (uErr & X86_TRAP_PF_RSVD) 1640 1643 || !pPdpeSrc->n.u1Present 1641 || ((uErr & X86_TRAP_PF_ID) && pPdpeSrc->n.u1NoExecute) 1644 # if PGM_WITH_NX(PGM_GST_TYPE) 1645 || (fNoExecuteBitValid && (uErr & X86_TRAP_PF_ID) && pPdpeSrc->n.u1NoExecute) 1646 # endif 1642 1647 || (fWriteFault && !pPdpeSrc->n.u1Write && (fUserLevelFault || fWriteProtect)) 1643 1648 || (fUserLevelFault && !pPdpeSrc->n.u1User) ) … … 1685 1690 if ( (uErr & X86_TRAP_PF_RSVD) 1686 1691 || !pPdeSrc->n.u1Present 1687 # 1688 || ( (uErr & X86_TRAP_PF_ID) && pPdeSrc->n.u1NoExecute)1689 # 1692 # if PGM_WITH_NX(PGM_GST_TYPE) 1693 || (fNoExecuteBitValid && (uErr & X86_TRAP_PF_ID) && pPdeSrc->n.u1NoExecute) 1694 # endif 1690 1695 || (fWriteFault && !pPdeSrc->n.u1Write && (fUserLevelFault || fWriteProtect)) 1691 1696 || (fUserLevelFault && !pPdeSrc->n.u1User) ) -
trunk/src/VBox/VMM/VMMAll/PGMAllGst.h
r7728 r7730 150 150 return VINF_SUCCESS; 151 151 152 #elif PGM_GST_TYPE == PGM_TYPE_32BIT \ 153 || PGM_GST_TYPE == PGM_TYPE_PAE \ 154 || PGM_GST_TYPE == PGM_TYPE_AMD64 155 156 #if PGM_GST_TYPE == PGM_TYPE_AMD64 152 #elif PGM_GST_TYPE == PGM_TYPE_AMD64 157 153 /* later */ 154 /* check level 3 & 4 bits as well (r/w, u/s, nxe) */ 158 155 AssertFailed(); 159 156 return VERR_NOT_IMPLEMENTED; 160 #endif 161 157 158 #elif PGM_GST_TYPE == PGM_GST_32BIT || PGM_GST_TYPE == PGM_GST_PAE 162 159 163 160 /* 164 161 * Get the PDE. 165 162 */ 166 # if PGM_GST_TYPE == PGM_TYPE_32BIT163 # if PGM_GST_TYPE == PGM_TYPE_32BIT 167 164 const X86PDE Pde = CTXSUFF(pVM->pgm.s.pGuestPD)->a[GCPtr >> X86_PD_SHIFT]; 168 #else /* PAE */ 169 X86PDEPAE Pde; 165 # else /* PAE */ 166 X86PDEPAE Pde; 167 bool fNoExecuteBitValid = !!(CPUMGetGuestEFER(pVM) & MSR_K6_EFER_NXE); 168 169 /* pgmGstGetPaePDE will return 0 if the PDPTE is marked as not present 170 * All the other bits in the PDPTE are only valid in long mode (r/w, u/s, nx) 171 */ 170 172 Pde.u = pgmGstGetPaePDE(&pVM->pgm.s, GCPtr); 171 # endif173 # endif 172 174 173 175 /* … … 203 205 # if PGM_WITH_NX(PGM_GST_TYPE) 204 206 /* The NX bit is determined by a bitwise OR between the PT and PD */ 205 if ( Pde.u & X86_PTE_PAE_NX)206 *p fFlags |= X86_PTE_PAE_NX;207 if (fNoExecuteBitValid) 208 *pFlags |= (Pte.u & Pde.u & X86_PTE_PAE_NX); 207 209 # endif 208 210 } … … 216 218 */ 217 219 if (pfFlags) 220 { 218 221 *pfFlags = (Pde.u & ~(GST_PTE_PG_MASK | X86_PTE_PAT)) 219 222 | ((Pde.u & X86_PDE4M_PAT) >> X86_PDE4M_PAT_SHIFT); 223 # if PGM_WITH_NX(PGM_GST_TYPE) 224 /* The NX bit is determined by a bitwise OR between the PT and PD */ 225 if (fNoExecuteBitValid) 226 *pfFlags |= (Pde.u & X86_PTE_PAE_NX); 227 # endif 228 } 220 229 if (pGCPhys) 221 230 *pGCPhys = (Pde.u & GST_PDE_BIG_PG_MASK) | (GCPtr & (~GST_PDE_BIG_PG_MASK ^ ~GST_PTE_PG_MASK)); /** @todo pse36 */ … … 249 258 #if PGM_GST_TYPE == PGM_TYPE_AMD64 250 259 /* later */ 260 /* check level 3 & 4 bits as well (r/w, u/s, nxe) */ 251 261 AssertFailed(); 252 262 return VERR_NOT_IMPLEMENTED; … … 261 271 PX86PDE pPde = &CTXSUFF(pVM->pgm.s.pGuestPD)->a[GCPtr >> X86_PD_SHIFT]; 262 272 #else /* PAE */ 273 /* pgmGstGetPaePDEPtr will return 0 if the PDPTE is marked as not present 274 * All the other bits in the PDPTE are only valid in long mode (r/w, u/s, nx) 275 */ 263 276 PX86PDEPAE pPde = pgmGstGetPaePDEPtr(&pVM->pgm.s, GCPtr); 264 277 Assert(pPde);
Note:
See TracChangeset
for help on using the changeset viewer.