Changeset 45792 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Apr 28, 2013 4:28:51 PM (12 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r45739 r45792 918 918 919 919 /** 920 * Changing the page flags for a single page in the shadow page tables so as to 921 * make it supervisor and writable. 922 * 923 * This if for dealing with CR0.WP=0 and readonly user pages. 924 * 925 * @returns VBox status code. 926 * @param pVCpu Pointer to the VMCPU. 927 * @param GCPtr Virtual address of the first page in the range. 928 * @param fOpFlags A combination of the PGM_MK_PG_XXX flags. 929 */ 930 int pgmShwMakePageSupervisorAndWritable(PVMCPU pVCpu, RTGCPTR GCPtr, uint32_t fOpFlags) 931 { 932 return pdmShwModifyPage(pVCpu, GCPtr, X86_PTE_RW, ~(uint64_t)X86_PTE_US, fOpFlags); 933 } 934 935 936 /** 920 937 * Gets the shadow page directory for the specified address, PAE. 921 938 * -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r45752 r45792 984 984 if ( !GstWalk.Core.fEffectiveRW 985 985 && (CPUMGetGuestCR0(pVCpu) & (X86_CR0_WP | X86_CR0_PG)) == X86_CR0_PG 986 && CPUMGetGuestCPL(pVCpu) == 0)986 && CPUMGetGuestCPL(pVCpu) > 3) 987 987 { 988 988 Assert((uErr & (X86_TRAP_PF_RW | X86_TRAP_PF_P)) == (X86_TRAP_PF_RW | X86_TRAP_PF_P)); 989 # ifdef PGM_WITH_NETWARE_WP0_HACK 990 if ( GstWalk.Core.fEffectiveUS 991 && !GstWalk.Core.fBigPage) 992 { 993 /* Temorarily change the page to a RW super visor page. We'll trap 994 and switch it back when user mode tries to read from it again. 995 (See further down.) */ 996 Log(("PGM #PF: Netware WP0+RO+US hack: pvFault=%RGp uErr=%#x\n", pvFault, uErr)); 997 rc = pgmShwMakePageSupervisorAndWritable(pVCpu, pvFault, PGM_MK_PG_IS_WRITE_FAULT); 998 PGM_INVL_PG(pVCpu, pvFault); 999 if (rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3) 1000 { 1001 STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eTime2WPEmulation; }); /**< @todo New stat. */ 1002 return rc; 1003 } 1004 Log(("pgmShwMakePageSupervisorAndWritable(%RGv) failed with rc=%Rrc - ignored\n", pvFault, rc)); 1005 } 1006 # endif 989 1007 rc = VBOXSTRICTRC_TODO(PGMInterpretInstruction(pVM, pVCpu, pRegFrame, pvFault)); 990 1008 if (RT_SUCCESS(rc)) … … 1042 1060 } 1043 1061 } 1062 # if defined(PGM_WITH_NETWARE_WP0_HACK) && PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 1063 /* 1064 * Check for Netware WP0+RO+US hack from above and undo it when user 1065 * mode accesses the page again. 1066 */ 1067 else if ( !GstWalk.Core.fEffectiveRW 1068 && GstWalk.Core.fEffectiveUS 1069 && GstWalk.Core.fBigPage 1070 && (CPUMGetGuestCR0(pVCpu) & (X86_CR0_WP | X86_CR0_PG)) == X86_CR0_PG 1071 && CPUMGetGuestCPL(pVCpu) == 3 1072 ) 1073 { 1074 Log(("PGM #PF: Undo netware WP0+RO+US hack: pvFault=%RGp uErr=%#x\n", pvFault, uErr)); 1075 rc = PGM_BTH_NAME(SyncPage)(pVCpu, GstWalk.Pde, pvFault, 1, uErr); 1076 if (RT_SUCCESS(rc)) 1077 { 1078 PGM_INVL_PG(pVCpu, pvFault); 1079 STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eTime2WPEmulation; }); /**< @todo New stat. */ 1080 return VINF_SUCCESS; 1081 } 1082 } 1083 # endif 1084 1044 1085 /** @todo else: why are we here? */ 1045 1086 -
trunk/src/VBox/VMM/include/PGMInternal.h
r45741 r45792 4017 4017 int pgmMapDeactivateCR3(PVM pVM, PPGMPOOLPAGE pShwPageCR3); 4018 4018 4019 int pgmShwMakePageSupervisorAndWritable(PVMCPU pVCpu, RTGCPTR GCPtr, uint32_t fOpFlags); 4019 4020 int pgmShwSyncPaePDPtr(PVMCPU pVCpu, RTGCPTR GCPtr, X86PGPAEUINT uGstPdpe, PX86PDPAE *ppPD); 4020 4021 int pgmShwSyncNestedPageLocked(PVMCPU pVCpu, RTGCPHYS GCPhysFault, uint32_t cPages, PGMMODE enmShwPagingMode);
Note:
See TracChangeset
for help on using the changeset viewer.