4: Deterministic cache parameters for each level
| 516 | |
| 517 | // 4: Deterministic cache parameters for each level |
| 518 | FEXCore::CPUID::FunctionResults CPUIDEmu::Function_04h(uint32_t Leaf) const { |
| 519 | FEXCore::CPUID::FunctionResults Res {}; |
| 520 | constexpr uint32_t CacheType_Data = 1; |
| 521 | constexpr uint32_t CacheType_Instruction = 2; |
| 522 | constexpr uint32_t CacheType_Unified = 3; |
| 523 | |
| 524 | if (Leaf == 0) { |
| 525 | // Report L1D |
| 526 | uint32_t CoreCount = Cores - 1; |
| 527 | |
| 528 | Res.eax = CacheType_Data | // Cache type |
| 529 | (0b001 << 5) | // Cache level |
| 530 | (1 << 8) | // Self initializing cache level |
| 531 | (0 << 9) | // Fully associative |
| 532 | (0 << 14) | // Maximum number of addressable IDs for logical processors sharing this cache (With SMT this would be 1) |
| 533 | (CoreCount << 26); // Maximum number of addressable IDs for processor cores in the physical package |
| 534 | |
| 535 | Res.ebx = (63 << 0) | // Line Size - 1 : Claiming 64 byte |
| 536 | (0 << 12) | // Physical Line partitions |
| 537 | (7 << 22); // Associativity - 1 : Claiming 8 way |
| 538 | |
| 539 | // 32KB |
| 540 | Res.ecx = 63; // Number of sets - 1 : Claiming 64 sets |
| 541 | |
| 542 | Res.edx = (0 << 0) | // Write-back invalidate |
| 543 | (0 << 1) | // Cache inclusiveness - Includes lower caches |
| 544 | (0 << 2); // Complex cache indexing - 0: Direct, 1: Complex |
| 545 | } else if (Leaf == 1) { |
| 546 | // Report L1I |
| 547 | uint32_t CoreCount = Cores - 1; |
| 548 | |
| 549 | Res.eax = CacheType_Instruction | // Cache type |
| 550 | (0b001 << 5) | // Cache level |
| 551 | (1 << 8) | // Self initializing cache level |
| 552 | (0 << 9) | // Fully associative |
| 553 | (0 << 14) | // Maximum number of addressable IDs for logical processors sharing this cache (With SMT this would be 1) |
| 554 | (CoreCount << 26); // Maximum number of addressable IDs for processor cores in the physical package |
| 555 | |
| 556 | Res.ebx = (63 << 0) | // Line Size - 1 : Claiming 64 byte |
| 557 | (0 << 12) | // Physical Line partitions |
| 558 | (7 << 22); // Associativity - 1 : Claiming 8 way |
| 559 | |
| 560 | // 32KB |
| 561 | Res.ecx = 63; // Number of sets - 1 : Claiming 64 sets |
| 562 | |
| 563 | Res.edx = (0 << 0) | // Write-back invalidate |
| 564 | (0 << 1) | // Cache inclusiveness - Includes lower caches |
| 565 | (0 << 2); // Complex cache indexing - 0: Direct, 1: Complex |
| 566 | } else if (Leaf == 2) { |
| 567 | // Report L2 |
| 568 | uint32_t CoreCount = Cores - 1; |
| 569 | |
| 570 | Res.eax = CacheType_Unified | // Cache type |
| 571 | (0b010 << 5) | // Cache level |
| 572 | (1 << 8) | // Self initializing cache level |
| 573 | (0 << 9) | // Fully associative |
| 574 | (0 << 14) | // Maximum number of addressable IDs for logical processors sharing this cache |
| 575 | (CoreCount << 26); // Maximum number of addressable IDs for processor cores in the physical package |
nothing calls this directly
no outgoing calls
no test coverage detected