https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122639

--- Comment #2 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot 
Uni-Bielefeld.DE> ---
> --- Comment #1 from Iain Buclaw <ibuclaw at gcc dot gnu.org> ---
> Thanks Rainer.
>
> What's the value of the e(a/b/c/d)x registers after calling cpuid (stored in
> the `a` array)?

I've instead looked directly at %eax etc. immediately after the cpuid
insn:

: x/i $pc
=> 0xb4d05ec <_D4core5cpuid18getcacheinfoCPUID2FNbNiNeZv+28>:   cpuid
(gdb) 
0x0b4d05f2      531                 "cpuid" : "=a" (a[0]), "=b" (a[1]), "=c"
(a[2]), "=d" (a[3]) : "a" (2);
1: x/i $pc
=> 0xb4d05f2 <_D4core5cpuid18getcacheinfoCPUID2FNbNiNeZv+34>:   
    mov    %ecx,0x8(%esp)
(gdb) p/x $eax
$31 = 0x0
(gdb) p/x $ebx
$32 = 0x0
(gdb) p/x $ecx
$33 = 0x0
(gdb) p/x $edx
$34 = 0x0

because gdb seems to be a bit confused:

gdb) stepi
541                 if (a[0]==0x0000_7001 && a[3]==0x80 && a[1]==0 && a[2]==0)
{
1: x/i $pc
=> 0xb4d05fa <_D4core5cpuid18getcacheinfoCPUID2FNbNiNeZv+42>:   
    cmp    $0x7001,%eax
(gdb) p/x a
$40 = {0xfe5c2bc0, 0x0, 0x0, 0x0}

a[0], unlike the rest, doesn't match %eax.

Reply via email to