Changeset 60741 in vbox
- Timestamp:
- Apr 28, 2016 1:22:07 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 106932
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/APICAll.cpp
r60740 r60741 414 414 * @param rcNotFound What to return when no bit is set. 415 415 */ 416 static int apicGetLastSetBit(volatile const XAPIC256BITREG *pReg, int rcNotFound) 417 { 418 unsigned const cBitsPerFragment = sizeof(pReg->u[0].u32Reg) * 8; 419 ssize_t const cFragments = RT_ELEMENTS(pReg->u); 416 static int apicGetHighestSetBit(volatile const XAPIC256BITREG *pReg, int rcNotFound) 417 { 418 ssize_t const cFragments = RT_ELEMENTS(pReg->u); 419 unsigned const uFragmentShift = 5; 420 AssertCompile(1 << uFragmentShift == sizeof(pReg->u[0].u32Reg) * 8); 420 421 for (ssize_t i = cFragments - 1; i >= 0; i--) 421 422 { … … 425 426 unsigned idxSetBit = ASMBitLastSetU32(uFragment); 426 427 --idxSetBit; 427 idxSetBit += (i * cBitsPerFragment);428 idxSetBit |= i << uFragmentShift; 428 429 return idxSetBit; 429 430 } … … 504 505 if (pXApicPage->svr.u.fApicSoftwareEnable) 505 506 { 506 int const irrv = apicGet LastSetBit(&pXApicPage->irr, -1 /* rcNotFound */);507 int const irrv = apicGetHighestSetBit(&pXApicPage->irr, -1 /* rcNotFound */); 507 508 if (irrv >= 0) 508 509 { … … 1081 1082 /* See Intel spec 10.8.3.1 "Task and Processor Priorities". */ 1082 1083 PXAPICPAGE pXApicPage = VMCPU_TO_XAPICPAGE(pVCpu); 1083 uint8_t const uIsrv = apicGet LastSetBit(&pXApicPage->isr, 0 /* rcNotFound */);1084 uint8_t const uIsrv = apicGetHighestSetBit(&pXApicPage->isr, 0 /* rcNotFound */); 1084 1085 uint8_t uPpr; 1085 1086 if (XAPIC_TPR_GET_TP(pXApicPage->tpr.u8Tpr) >= XAPIC_PPR_GET_PP(uIsrv)) … … 1157 1158 1158 1159 PXAPICPAGE pXApicPage = VMCPU_TO_XAPICPAGE(pVCpu); 1159 int isrv = apicGet LastSetBit(&pXApicPage->isr, -1 /* rcNotFound */);1160 int isrv = apicGetHighestSetBit(&pXApicPage->isr, -1 /* rcNotFound */); 1160 1161 if (isrv >= 0) 1161 1162 { … … 2107 2108 { 2108 2109 PCXAPICPAGE pXApicPage = VMCPU_TO_CXAPICPAGE(pVCpu); 2109 int const irrv = apicGet LastSetBit(&pXApicPage->irr, -1);2110 int const irrv = apicGetHighestSetBit(&pXApicPage->irr, -1); 2110 2111 if (irrv >= 0) 2111 2112 { … … 2315 2316 && pXApicPage->svr.u.fApicSoftwareEnable) 2316 2317 { 2317 int const irrv = apicGet LastSetBit(&pXApicPage->irr, -1);2318 int const irrv = apicGetHighestSetBit(&pXApicPage->irr, -1); 2318 2319 if (RT_LIKELY(irrv >= 0)) 2319 2320 {
Note:
See TracChangeset
for help on using the changeset viewer.