Re: CPUID Patch for IDT Winchip

2019-11-05 Thread tedheadster
On Tue, May 21, 2019 at 11:20 AM Uros Bizjak wrote: > > 2019-05-21 Uroš Bizjak > > * config/i386/cpuid.h (__cpuid): For 32bit targets, zero > %ebx and %ecx bafore calling cpuid with leaf 1 or > non-constant leaf argument. > > Bootstrapped and regression tested on x86_64-linux-gnu {,

Re: CPUID Patch for IDT Winchip

2019-06-03 Thread Maciej W. Rozycki
On Tue, 21 May 2019, Uros Bizjak wrote: > --cut here-- > #include "cpuid.h" > > int main () > { > unsigned int eax, ebx, ecx, edx; > > if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) > __builtin_abort (); > > printf ("%#x, %#x, %#x, %#x\n", eax, ebx, ecx, edx); > return 0; > } > --cut

Re: CPUID Patch for IDT Winchip

2019-05-21 Thread Uros Bizjak
On Tue, May 21, 2019 at 9:46 AM Uros Bizjak wrote: > > On Tue, May 21, 2019 at 12:20 AM tedheadster wrote: > > > > On Mon, May 20, 2019 at 2:57 PM Uros Bizjak wrote: > > > > > > On Mon, May 20, 2019 at 6:12 PM tedheadster wrote: > > > > Did you instead mean "zeroing %EBX and %ECX regs should be

Re: CPUID Patch for IDT Winchip

2019-05-21 Thread Uros Bizjak
On Tue, May 21, 2019 at 12:20 AM tedheadster wrote: > > On Mon, May 20, 2019 at 2:57 PM Uros Bizjak wrote: > > > > On Mon, May 20, 2019 at 6:12 PM tedheadster wrote: > > > Did you instead mean "zeroing %EBX and %ECX regs should be enough"? > > > > Ah, yes. This is what I meant to say. The patch

Re: CPUID Patch for IDT Winchip

2019-05-20 Thread tedheadster
On Mon, May 20, 2019 at 2:57 PM Uros Bizjak wrote: > > On Mon, May 20, 2019 at 6:12 PM tedheadster wrote: > > Did you instead mean "zeroing %EBX and %ECX regs should be enough"? > > Ah, yes. This is what I meant to say. The patch clears %ebx and %ecx. > Uros, your patch worked on real 32-bit h

Re: CPUID Patch for IDT Winchip

2019-05-20 Thread Uros Bizjak
On Mon, May 20, 2019 at 6:12 PM tedheadster wrote: > > On Mon, May 20, 2019 at 11:52 AM Uros Bizjak wrote: > > > How about the attached patch that enables zeroing only for 32bit > > processors, and only for cpuid leaf 1? Usually, __get_cpuid is used > > with a constant leaf argument, so we benefi

Re: CPUID Patch for IDT Winchip

2019-05-20 Thread tedheadster
On Mon, May 20, 2019 at 11:52 AM Uros Bizjak wrote: > How about the attached patch that enables zeroing only for 32bit > processors, and only for cpuid leaf 1? Usually, __get_cpuid is used > with a constant leaf argument, so we benefit from constant propagation > into inline function. Also, accor

Re: CPUID Patch for IDT Winchip

2019-05-20 Thread Uros Bizjak
On Mon, May 20, 2019 at 4:24 PM tedheadster wrote: > > Uros, > > On Mon, May 20, 2019 at 3:29 AM Uros Bizjak wrote: > > The CPUID documentation from Intel Architectures Developer's manual is > > crystal clear on the implementation: > > > > --quote-- > > CPUID—CPU Identification > > > > Returns pr

Re: CPUID Patch for IDT Winchip

2019-05-20 Thread Mike Gilbert
On Sun, May 19, 2019 at 12:10 PM tedheadster wrote: > > I have confirmed that the IDT Winchip 2 does not expressly set %ecx > after a call to cpuid() with %eax = 1, and this causes incorrect > reporting of cpu capabilities. The %ecx register should return 0x0 > (and likely %ebx should too) on this

Re: CPUID Patch for IDT Winchip

2019-05-20 Thread tedheadster
Uros, On Mon, May 20, 2019 at 3:29 AM Uros Bizjak wrote: > The CPUID documentation from Intel Architectures Developer's manual is > crystal clear on the implementation: > > --quote-- > CPUID—CPU Identification > > Returns processor identification and feature > information to the EAX, EBX, ECX, an

Re: CPUID Patch for IDT Winchip

2019-05-20 Thread Uros Bizjak
Hello! > I have confirmed that the IDT Winchip 2 does not expressly set %ecx > after a call to cpuid() with %eax = 1, and this causes incorrect > reporting of cpu capabilities. The %ecx register should return 0x0 > (and likely %ebx should too) on this hardware. This patch proposes a > fix. > > The