You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If cpuid is supported, and leaf is zero, then the first tuple argument
contains the highest leaf value that cpuid supports. For leafs
containing sub-leafs, the second tuple argument contains the
highest-supported sub-leaf value.
The second sentence is invalid. The function basically does CPUID(EAX=leaf, ECX=0) and returns (EAX, EBX). I haven't found any leaf that behaves like described. Here are some variable subleaf CPUIDs, and how to determine which subleafs are valid (see Intel SDM, CPUID instruction):
0x0b: repeat until you get ECX[15:08]=0
0x0d: valid for every bit index set in EAX/EDX when ECX=0
0x12: undefined, but practically until you get EAX[03:00]=0
So, none of these return “the highest-supported sub-leaf value” in EBX.
Return highest supported input value for cpuid instruction. ext can
be either 0x0 or 0x80000000 to return highest supported value for
basic or extended cpuid information. Function returns 0 if cpuid
is not supported or whatever cpuid returns in eax register. If sig
pointer is non-null, then first four bytes of the signature
(as found in ebx register) are returned in location pointed by sig.
This does seem to accurately describe the function's behavior, but it's clearly not what Rust documents.
It's not entirely clear to me where this function comes from. It doesn't appear in the Intel Intrisics Guide or the Intel SDM. You practically need to read the documentation anyway to understand any CPUID output, so it's not clear why Rust includes this function which is just a different way to call __cpuid.
The documentation for
__get_cpuid_max
states:The second sentence is invalid. The function basically does CPUID(EAX=
leaf
, ECX=0) and returns (EAX, EBX). I haven't found any leaf that behaves like described. Here are some variable subleaf CPUIDs, and how to determine which subleafs are valid (see Intel SDM, CPUID instruction):0x0b
: repeat until you get ECX[15:08]=00x0d
: valid for every bit index set in EAX/EDX when ECX=00x12
: undefined, but practically until you get EAX[03:00]=0So, none of these return “the highest-supported sub-leaf value” in EBX.
The GCC source code does have it and states:
This does seem to accurately describe the function's behavior, but it's clearly not what Rust documents.
It's not entirely clear to me where this function comes from. It doesn't appear in the Intel Intrisics Guide or the Intel SDM. You practically need to read the documentation anyway to understand any CPUID output, so it's not clear why Rust includes this function which is just a different way to call
__cpuid
.cc @gnzlbg
The text was updated successfully, but these errors were encountered: