| 188 | } |
| 189 | |
| 190 | void AddAllCPUID(CSHA512& hasher) |
| 191 | { |
| 192 | uint32_t ax, bx, cx, dx; |
| 193 | // Iterate over all standard leaves |
| 194 | AddCPUID(hasher, 0, 0, ax, bx, cx, dx); // Returns max leaf in ax |
| 195 | uint32_t max = ax; |
| 196 | for (uint32_t leaf = 1; leaf <= max && leaf <= 0xFF; ++leaf) { |
| 197 | uint32_t maxsub = 0; |
| 198 | for (uint32_t subleaf = 0; subleaf <= 0xFF; ++subleaf) { |
| 199 | AddCPUID(hasher, leaf, subleaf, ax, bx, cx, dx); |
| 200 | // Iterate subleafs for leaf values 4, 7, 11, 13 |
| 201 | if (leaf == 4) { |
| 202 | if ((ax & 0x1f) == 0) break; |
| 203 | } else if (leaf == 7) { |
| 204 | if (subleaf == 0) maxsub = ax; |
| 205 | if (subleaf == maxsub) break; |
| 206 | } else if (leaf == 11) { |
| 207 | if ((cx & 0xff00) == 0) break; |
| 208 | } else if (leaf == 13) { |
| 209 | if (ax == 0 && bx == 0 && cx == 0 && dx == 0) break; |
| 210 | } else { |
| 211 | // For any other leaf, stop after subleaf 0. |
| 212 | break; |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | // Iterate over all extended leaves |
| 217 | AddCPUID(hasher, 0x80000000, 0, ax, bx, cx, dx); // Returns max extended leaf in ax |
| 218 | uint32_t ext_max = ax; |
| 219 | for (uint32_t leaf = 0x80000001; leaf <= ext_max && leaf <= 0x800000FF; ++leaf) { |
| 220 | AddCPUID(hasher, leaf, 0, ax, bx, cx, dx); |
| 221 | } |
| 222 | } |
| 223 | #endif |
| 224 | } // namespace |
| 225 |
no test coverage detected