Searched defs:pcSubLeaves (Results 1 - 1 of 1) sorted by relevance

/vbox/src/VBox/VMM/VMMR3/
H A DCPUMR3CpuId.cpp907 * @param pcSubLeaves Number of sub-leaves accessible via ECX.
911 static bool cpumR3IsEcxRelevantForCpuIdLeaf(uint32_t uLeaf, uint32_t *pcSubLeaves, bool *pfFinalEcxUnchanged)
931 *pcSubLeaves = 1;
996 *pcSubLeaves = cDocLimit + 3;
1000 *pcSubLeaves = UINT32_MAX;
1011 *pcSubLeaves = uSubLeaf + 1 - cRepeats;
1012 if (*pcSubLeaves == 0)
1013 *pcSubLeaves = 1;
840 AssertLogRelReturn(cLeaves < CPUM_CPUID_MAX_LEAVES, VERR_TOO_MANY_CPUID_LEAVES); paLeaves = cpumR3CpuIdEnsureSpace(pVM, ppaLeaves, cLeaves); if (!paLeaves) return VERR_NO_MEMORY; if (i < cLeaves) memmove(&paLeaves[i + 1], &paLeaves[i], (cLeaves - i) * sizeof(paLeaves[0])); *pcLeaves += 1; paLeaves[i] = *pNewLeaf; cpumR3CpuIdAssertOrder(*ppaLeaves, *pcLeaves); return VINF_SUCCESS; } static void cpumR3CpuIdRemoveRange(PCPUMCPUIDLEAF paLeaves, uint32_t *pcLeaves, uint32_t uFirst, uint32_t uLast) { uint32_t cLeaves = *pcLeaves; Assert(uFirst <= uLast); uint32_t iFirst = 0; while ( iFirst < cLeaves && paLeaves[iFirst].uLeaf < uFirst) iFirst++; uint32_t iEnd = iFirst; while ( iEnd < cLeaves && paLeaves[iEnd].uLeaf <= uLast) iEnd++; if (iFirst < iEnd) { if (iEnd < cLeaves) memmove(&paLeaves[iFirst], &paLeaves[iEnd], (cLeaves - iEnd) * sizeof(paLeaves[0])); *pcLeaves = cLeaves -= (iEnd - iFirst); } cpumR3CpuIdAssertOrder(paLeaves, *pcLeaves); } static bool cpumR3IsEcxRelevantForCpuIdLeaf(uint32_t uLeaf, uint32_t *pcSubLeaves, bool *pfFinalEcxUnchanged) { *pfFinalEcxUnchanged = false; uint32_t auCur[4]; uint32_t auPrev[4]; ASMCpuIdExSlow(uLeaf, 0, 0, 0, &auPrev[0], &auPrev[1], &auPrev[2], &auPrev[3]); uint32_t uSubLeaf = 1; for (;;) { ASMCpuIdExSlow(uLeaf, 0, uSubLeaf, 0, &auCur[0], &auCur[1], &auCur[2], &auCur[3]); if (memcmp(auCur, auPrev, sizeof(auCur))) break; uSubLeaf++; if (uSubLeaf >= 64) { *pcSubLeaves = 1; return false; } } uint32_t cRepeats = 0; uSubLeaf = 0; for (;;) { ASMCpuIdExSlow(uLeaf, 0, uSubLeaf, 0, &auCur[0], &auCur[1], &auCur[2], &auCur[3]); if ( auCur[0] == 0 && auCur[1] == 0 && (auCur[2] == 0 || auCur[2] == uSubLeaf) && (auCur[3] == 0 || uLeaf == 0xb ) ) { cRepeats = 0; break; } if ( auCur[0] == auPrev[0] && auCur[1] == auPrev[1] && ( auCur[2] == auPrev[2] || ( auCur[2] == uSubLeaf && auPrev[2] == uSubLeaf - 1) ) && auCur[3] == auPrev[3]) { cRepeats++; if (cRepeats > 4) break; } else cRepeats = 0; if ( uLeaf == 0xb && (auCur[2] & 0xff00) == 0 && (auPrev[2] & 0xff00) == 0) { cRepeats = 0; break; } if (uSubLeaf >= 128) { uint32_t cDocLimit = UINT32_MAX; if (uLeaf == 0x4) cDocLimit = 4; else if (uLeaf == 0x7) cDocLimit = 1; else if (uLeaf == 0xf) cDocLimit = 2; if (cDocLimit != UINT32_MAX) { *pfFinalEcxUnchanged = auCur[2] == uSubLeaf && uLeaf == 0xb; *pcSubLeaves = cDocLimit + 3; return true; } *pcSubLeaves = UINT32_MAX; return true; } uSubLeaf++; memcpy(auPrev, auCur, sizeof(auCur)); } *pfFinalEcxUnchanged = auCur[2] == uSubLeaf && uLeaf == 0xb; *pcSubLeaves = uSubLeaf + 1 - cRepeats; if (*pcSubLeaves == 0) *pcSubLeaves = 1; return true; } VMMR3DECL(int) CPUMR3CpuIdGetLeaf(PVM pVM, PCPUMCPUIDLEAF pLeaf, uint32_t uLeaf, uint32_t uSubLeaf) { PCPUMCPUIDLEAF pcLeaf = cpumR3CpuIdGetLeaf(pVM->cpum.s.GuestInfo.paCpuIdLeavesR3, pVM->cpum.s.GuestInfo.cCpuIdLeaves, uLeaf, uSubLeaf); if (pcLeaf) { memcpy(pLeaf, pcLeaf, sizeof(*pLeaf)); return VINF_SUCCESS; } return VERR_NOT_FOUND; } VMMR3DECL(int) CPUMR3CpuIdInsert(PVM pVM, PCPUMCPUIDLEAF pNewLeaf) { AssertReturn(pVM, VERR_INVALID_PARAMETER); AssertReturn(pNewLeaf, VERR_INVALID_PARAMETER); if ( pNewLeaf->uLeaf == UINT32_C(0x00000000) || pNewLeaf->uLeaf == UINT32_C(0x00000001) || pNewLeaf->uLeaf == UINT32_C(0x80000000) || pNewLeaf->uLeaf == UINT32_C(0x80000001) || pNewLeaf->uLeaf == UINT32_C(0xc0000000) || pNewLeaf->uLeaf == UINT32_C(0xc0000001) ) argument

Completed in 63 milliseconds