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

--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Erich Eckner from comment #4)
> Created attachment 50871 [details]
> cpuid probing
> 
> Does the attached program yield, what you need? (Sry, I'm quite unfamiliar
> with asm in gcc)
> 
> It gives:
> 
> 00000001 746e6543 736c7561 48727561 
> 000006d0 00000800 00004181 a7c9bbff 
> 
> and
> 
> 0000000a 746e6543 736c7561 48727561 
> 000006fa 00010800 008863a9 afc9fbff 
> 
> on the two machines, respectively.

Erich, if you still have access to those CPUs, could you retry with:
#include <stdio.h>

static void cpuid( unsigned int ax, unsigned int cx, unsigned int *p )
{
  unsigned int flags;

  __asm __volatile
    ("movl %%ebx, %%esi\n\t"
     "cpuid\n\t"
      "xchgl %%ebx, %%esi"
      : "=a" (p[0]), "=S" (p[1]),
      "=c" (p[2]), "=d" (p[3])
      : "0" (ax), "2" (cx));
}

int main() {
  unsigned int regs[4];
  for (int j=0; j<=18; j++) {
    int k = j > 10 ? -__INT_MAX__ - 1 + (j - 11) : j;
    cpuid( k, regs, 0 );
    printf("%d %d ", k, 0);
    for (int i=0; i<4; i++) {
      printf("%08x ", regs[i]);
    }
    printf("\n");
    cpuid( k, regs, 1 );
    printf("%d %d ", k, 1);
    for (int i=0; i<4; i++) {
      printf("%08x ", regs[i]);
    }
    printf("\n");
  }
  return 0;
}

Thanks.

I've posted a different patch to gcc-patches:
https://gcc.gnu.org/pipermail/gcc-patches/2023-February/611632.html

Reply via email to