1 |
Hi, |
2 |
|
3 |
I'm looking for someone having AVX-512 capable CPU, for the purpose of |
4 |
XSAVE support development in LLDB. If you have such a CPU, could you |
5 |
compile and run the following program, and send me the output? If you |
6 |
could in the future provide me with a shell account (unprivileged user |
7 |
is sufficient) to build and test LLDB, that'd be even better. |
8 |
|
9 |
The program is meant to grab offsets and sizes of XSAVE components. It |
10 |
should run unprivileged. However, it might require a new-ish kernel. |
11 |
TIA. |
12 |
|
13 |
--- |
14 |
|
15 |
#include <stdio.h> |
16 |
#include <stdint.h> |
17 |
#include <inttypes.h> |
18 |
|
19 |
#include <cpuid.h> |
20 |
|
21 |
int main() |
22 |
{ |
23 |
int i; |
24 |
uint32_t eax, ebx, ecx, edx; |
25 |
uint64_t xcr0; |
26 |
|
27 |
asm volatile( |
28 |
"xorq %%rcx, %%rcx\n\t" |
29 |
"xgetbv\n\t" |
30 |
: "=a"(eax), "=d"(edx) |
31 |
: |
32 |
: |
33 |
); |
34 |
|
35 |
printf("XCR0: EAX = %08" PRIx32 "; EDX = %08" PRIx32 "\n", eax, edx); |
36 |
xcr0 = ((uint64_t)edx << 32) | eax; |
37 |
|
38 |
if (!__get_cpuid_count(0x0D, 0, &eax, &ebx, &ecx, &edx)) |
39 |
return 0; |
40 |
|
41 |
printf("0Dh(0): EAX = %08" PRIx32 "; EDX = %08" PRIx32 "\n", eax, edx); |
42 |
printf("0Dh(0): ECX = %" PRId32 "; EBX = %" PRId32 "\n", ecx, ebx); |
43 |
|
44 |
for (i = 2; i < 64; ++i) |
45 |
{ |
46 |
if (!(xcr0 & ((uint64_t)1 << i))) |
47 |
continue; |
48 |
|
49 |
__cpuid_count(0x0D, i, eax, ebx, ecx, edx); |
50 |
printf("0Dh(%d): EAX = %" PRId32 "; EBX = %" PRId32 "; ECX = %" |
51 |
PRIx32 "\n", i, eax, ebx, ecx); |
52 |
} |
53 |
} |
54 |
|
55 |
|
56 |
|
57 |
-- |
58 |
Best regards, |
59 |
Michał Górny |