Changeset 25803 in vbox
- Timestamp:
- Jan 13, 2010 2:16:12 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56570
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp
r24953 r25803 1072 1072 pCpuId = &pVM->cpum.s.GuestCpuIdDef; 1073 1073 1074 bool fHasMoreCaches = (*pEcx == 0);1074 uint32_t cCurrentCacheIndex = *pEcx; 1075 1075 1076 1076 *pEax = pCpuId->eax; … … 1088 1088 1089 1089 if ( iLeaf == 4 1090 && fHasMoreCaches1090 && cCurrentCacheIndex < 3 1091 1091 && pVM->cpum.s.enmGuestCpuVendor == CPUMCPUVENDOR_INTEL) 1092 1092 { 1093 /* Report L0 data cache, Linux'es num_cpu_cores() requires 1094 * that to be non-0 to detect core count correctly. */ 1095 *pEax |= (1 << 5) /* level 1 */ | 1 /* 1 - data cache, 2 - i-cache, 3 - unified */ ; 1096 *pEbx = 63 /* linesize 64 */ ; 1093 uint32_t type, level, sharing, linesize, 1094 partitions, associativity, sets, cores; 1095 1096 /* For type: 1 - data cache, 2 - i-cache, 3 - unified */ 1097 partitions = 1; 1098 /* Those are only to shut up compiler, as they will always 1099 get overwritten, and compiler should be able to figure that out */ 1100 sets = associativity = sharing = level = 1; 1101 cores = pVM->cCpus > 32 ? 32 : pVM->cCpus; 1102 switch (cCurrentCacheIndex) 1103 { 1104 case 0: 1105 type = 1; 1106 level = 1; 1107 sharing = 1; 1108 linesize = 64; 1109 associativity = 8; 1110 sets = 64; 1111 break; 1112 case 1: 1113 level = 1; 1114 type = 2; 1115 sharing = 1; 1116 linesize = 64; 1117 associativity = 8; 1118 sets = 64; 1119 break; 1120 case 2: 1121 level = 2; 1122 type = 3; 1123 sharing = 2; 1124 linesize = 64; 1125 associativity = 24; 1126 sets = 4096; 1127 break; 1128 } 1129 1130 *pEax |= ((cores - 1) << 26) | 1131 ((sharing - 1) << 14) | 1132 (level << 5) | 1133 1; 1134 *pEbx = (linesize - 1) | 1135 ((partitions - 1) << 12) | 1136 ((associativity - 1) << 22); /* -1 encoding */ 1137 *pEcx = sets - 1; 1097 1138 } 1098 1139 … … 2076 2117 return enmMode; 2077 2118 } 2078
Note:
See TracChangeset
for help on using the changeset viewer.