Changeset 71031 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Feb 15, 2018 4:47:13 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r70978 r71031 4752 4752 } 4753 4753 4754 #ifndef IN_RC 4755 /** 4756 * Interface used by NEM to check what to do on a memory access exit. 4757 * 4758 * @returns VBox status code. 4759 * @param pVM The cross context VM structure. 4760 * @param pVCpu The cross context per virtual CPU structure. 4761 * @param GCPhys The guest physical address. We'll apply A20 masking 4762 * to this since most of the native hypervisor APIs 4763 * doesn't seem to implement A20 masking. 4764 * @param pInfo Where to return the page information. This is 4765 * initialized even on failure. 4766 * @param pfnChecker Page in-sync checker callback. 4767 * @param pvUser User argument to pass to pfnChecker. 4768 */ 4769 VMM_INT_DECL(int) PGMPhysNemQueryPageInfo(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, PPGMPHYSNEMPAGEINFO pInfo, 4770 PFNPGMPHYSNEMQUERYCHECKER pfnChecker, void *pvUser) 4771 { 4772 pgmLock(pVM); 4773 PGM_A20_APPLY_TO_VAR(pVCpu, GCPhys); 4774 4775 PPGMPAGE pPage; 4776 int rc = pgmPhysGetPageEx(pVM, GCPhys, &pPage); 4777 if (RT_SUCCESS(rc)) 4778 { 4779 /* Fill in the info. */ 4780 pInfo->HCPhys = PGM_PAGE_GET_HCPHYS(pPage); 4781 pInfo->u2NemState = PGM_PAGE_GET_NEM_STATE(pPage); 4782 pInfo->fHasHandlers = PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage) ? 1 : 0; 4783 PGMPAGETYPE const enmType = (PGMPAGETYPE)PGM_PAGE_GET_TYPE(pPage); 4784 pInfo->enmType = enmType; 4785 /** @todo Consider merging pgmPhysPageCalcNemProtection into the switch below. */ 4786 pInfo->fNemProt = pgmPhysPageCalcNemProtection(pPage, enmType); 4787 switch (PGM_PAGE_GET_STATE(pPage)) 4788 { 4789 case PGM_PAGE_STATE_ALLOCATED: 4790 pInfo->fZeroPage = 0; 4791 break; 4792 4793 case PGM_PAGE_STATE_ZERO: 4794 pInfo->fZeroPage = 1; 4795 break; 4796 4797 case PGM_PAGE_STATE_WRITE_MONITORED: 4798 pInfo->fZeroPage = 0; 4799 break; 4800 4801 case PGM_PAGE_STATE_SHARED: 4802 pInfo->fZeroPage = 0; 4803 break; 4804 4805 case PGM_PAGE_STATE_BALLOONED: 4806 pInfo->fZeroPage = 1; 4807 break; 4808 4809 default: 4810 pInfo->fZeroPage = 1; 4811 AssertFailedStmt(rc = VERR_PGM_PHYS_PAGE_GET_IPE); 4812 } 4813 4814 /* Call the checker and update NEM state. */ 4815 rc = pfnChecker(pVM, pVCpu, GCPhys, pInfo, pvUser); 4816 PGM_PAGE_SET_NEM_STATE(pPage, pInfo->u2NemState); 4817 4818 /* Done. */ 4819 pgmUnlock(pVM); 4820 } 4821 else 4822 { 4823 pgmUnlock(pVM); 4824 4825 pInfo->HCPhys = NIL_RTHCPHYS; 4826 pInfo->fNemProt = NEM_PAGE_PROT_NONE; 4827 pInfo->u2NemState = 0; 4828 pInfo->fHasHandlers = 0; 4829 pInfo->fZeroPage = 0; 4830 pInfo->enmType = PGMPAGETYPE_INVALID; 4831 } 4832 4833 return rc; 4834 4835 } 4836 #endif /* !IN_RC */ 4837
Note:
See TracChangeset
for help on using the changeset viewer.