CPUID update to update

Robert Lunnon bobl at optushome.com.au
Tue Feb 10 07:48:34 CST 2004


For anyone who is using my previously submitted patch here is an update. It 
fixes the latent file descriptor leak, and patches a hole where have_cpuid 
was retained from the legacy code (Dunno how I missed that one) this ended up 
diving into the middle of the cpuid machine code where have_cpuid is defined 
(For different reasons).

Since my original submission is not being incorporated into the wine codebase, 
I am posting here instead. It just might be useful for someone out there...



bash-2.05$ diff -c  cpu.orig.c cpu.c
*** cpu.orig.c  Tue Feb 10 23:31:27 2004
--- cpu.c       Tue Feb 10 23:39:15 2004
***************
*** 116,122 ****
         {
              if (strstr(line,"processor") )count++;
          }
!       if(count>0) return count;
      }

  #endif /* linux*/
--- 116,126 ----
         {
              if (strstr(line,"processor") )count++;
          }
!           fclose(f);
!      if(count>0)
!       {
!          return count;
!       }
      }

  #endif /* linux*/
***************
*** 193,202 ****
        "\tandl $2097152,%%eax\n"
        "\tandl $2097152,%%ebx\n"
        "\txorl %%eax,%%ebx\n"
!       "\tjnz have_cpuid\n"
        "\tclrl %%ebx\n"
        "\tjmp endcpuid\n"
!       "have_cpuid:\tmovl %%ecx,%%eax\n"
        "\tcpuid\n"
        "endcpuid:\n"
        "\tmovl %%ebx,%0\n"
--- 197,206 ----
        "\tandl $2097152,%%eax\n"
        "\tandl $2097152,%%ebx\n"
        "\txorl %%eax,%%ebx\n"
!       "\tjnz have_cpuid_inst\n"
        "\tclrl %%ebx\n"
        "\tjmp endcpuid\n"
!       "have_cpuid_inst:\tmovl %%ecx,%%eax\n"
        "\tcpuid\n"
        "endcpuid:\n"
        "\tmovl %%ebx,%0\n"
***************
*** 713,721 ****
        cpuid_t cpuId;
        unsigned int regs[4], regs2[4];

!       if (!have_cpuid())
!               regs[0] = 0;                    /* No cpuid support -- skip 
the rest */
!       else
                cpuId= CPUID_GetId();
  /* get standard cpuid level and vendor name */
        if (cpuId.family!=0)
--- 717,723 ----
        cpuid_t cpuId;
        unsigned int regs[4], regs2[4];

!
                cpuId= CPUID_GetId();
  /* get standard cpuid level and vendor name */
        if (cpuId.family!=0)



More information about the wine-devel mailing list