@@ -198,12 +198,23 @@ void AddAllCPUID(CSHA512& hasher)
198
198
AddCPUID (hasher, 0 , 0 , ax, bx, cx, dx); // Returns max leaf in ax
199
199
uint32_t max = ax;
200
200
for (uint32_t leaf = 1 ; leaf <= max; ++leaf) {
201
+ uint32_t maxsub = 0 ;
201
202
for (uint32_t subleaf = 0 ;; ++subleaf) {
202
203
AddCPUID (hasher, leaf, subleaf, ax, bx, cx, dx);
203
- // Iterate over subleaves for leaf 4, 11, 13
204
- if (leaf != 4 && leaf != 11 && leaf != 13 ) break ;
205
- if ((leaf == 4 || leaf == 13 ) && ax == 0 ) break ;
206
- if (leaf == 11 && (cx & 0xFF00 ) == 0 ) break ;
204
+ // Iterate subleafs for leaf values 4, 7, 11, 13
205
+ if (leaf == 4 ) {
206
+ if ((ax & 0x1f ) == 0 ) break ;
207
+ } else if (leaf == 7 ) {
208
+ if (subleaf == 0 ) maxsub = ax;
209
+ if (subleaf == maxsub) break ;
210
+ } else if (leaf == 11 ) {
211
+ if ((cx & 0xff00 ) == 0 ) break ;
212
+ } else if (leaf == 13 ) {
213
+ if (ax == 0 && bx == 0 && cx == 0 && dx == 0 ) break ;
214
+ } else {
215
+ // For any other leaf, stop after subleaf 0.
216
+ break ;
217
+ }
207
218
}
208
219
}
209
220
// Iterate over all extended leaves
0 commit comments