Changeset 49981 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Dec 19, 2013 10:59:28 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/CPUMAllMsrs.cpp
r49972 r49981 4730 4730 PCPUMMSRRANGE cpumLookupMsrRange(PVM pVM, uint32_t idMsr) 4731 4731 { 4732 # if 04733 4732 /* 4734 4733 * Binary lookup. 4735 4734 */ 4736 4737 # else 4735 uint32_t cRanges = pVM->cpum.s.GuestInfo.cMsrRanges; 4736 if (!cRanges) 4737 return NULL; 4738 PCPUMMSRRANGE paRanges = pVM->cpum.s.GuestInfo.CTX_SUFF(paMsrRanges); 4739 for (;;) 4740 { 4741 uint32_t i = cRanges / 2; 4742 if (idMsr < paRanges[i].uFirst) 4743 { 4744 if (i == 0) 4745 break; 4746 cRanges = i; 4747 } 4748 else if (idMsr > paRanges[i].uLast) 4749 { 4750 i++; 4751 if (i >= cRanges) 4752 break; 4753 cRanges -= i; 4754 paRanges = &paRanges[i]; 4755 } 4756 else 4757 { 4758 if (paRanges[i].enmRdFn == kCpumMsrRdFn_MsrAlias) 4759 return cpumLookupMsrRange(pVM, paRanges[i].uValue); 4760 return &paRanges[i]; 4761 } 4762 } 4763 4764 # ifdef VBOX_STRICT 4738 4765 /* 4739 * Linear lookup .4766 * Linear lookup to verify the above binary search. 4740 4767 */ 4741 4768 uint32_t cLeft = pVM->cpum.s.GuestInfo.cMsrRanges; … … 4744 4771 { 4745 4772 if (idMsr >= pCur->uFirst && idMsr <= pCur->uLast) 4773 { 4774 AssertFailed(); 4775 if (pCur->enmRdFn == kCpumMsrRdFn_MsrAlias) 4776 return cpumLookupMsrRange(pVM, pCur->uValue); 4746 4777 return pCur; 4778 } 4747 4779 pCur++; 4748 4780 }
Note:
See TracChangeset
for help on using the changeset viewer.