c++ – How to check AMD/Intel L3 cache size

Question:

How can one find out the size of the L3 cache on different processors using a series of __cpuid(ex) calls?

void __cpuidex(int *regs, int leaf, int attempt)
{
    __asm
    {
        mov ecx, attempt
        mov eax, leaf
        cpuid
        mov esi, regs
        mov [esi], eax
        mov [esi + 4], ebx
        mov [esi + 8], ecx
        mov [esi + 12], edx
    }
}

Answer:

I can offer an alternative way to get L3Cache from SMBIOS (without calling __cpuid(ex) ):

Get the ProcessorInformation structure, it has the L3CacheHandle field, which can be used to get the cache size from the CacheInformation structure.

SMBIOS specification

Scroll to Top