Diff
Not logged in

Differences From Artifact [e2fbcf0dbb]:

To Artifact [c579805e2e]:


799
800
801
802
803
804
805
806

807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822

823
824


825
826
827
828
829




830
831
832
833
834
835
836
837
838
839
840
841
842
799
800
801
802
803
804
805

806

807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822


823
824
825




826
827
828
829

830
831
832
833
834
835
836
837
838
839
840
841







-
+
-















+
-
-
+
+

-
-
-
-
+
+
+
+
-












 *------------------------------------------------------------------------
 *
 * TclWinCPUID --
 *
 *	Get CPU ID information on an Intel box under UNIX (either Linux or Cygwin)
 *
 * Results:
 *	Returns TCL_OK if successful, TCL_ERROR if CPUID is not supported or
 *	Returns TCL_OK if successful, TCL_ERROR if CPUID is not supported.
 *	fails.
 *
 * Side effects:
 *	If successful, stores EAX, EBX, ECX and EDX registers after the CPUID
 *	instruction in the four integers designated by 'regsPtr'
 *
 *----------------------------------------------------------------------
 */

int
TclWinCPUID(
    unsigned int index,		/* Which CPUID value to retrieve. */
    unsigned int *regsPtr)	/* Registers after the CPUID. */
{
    int status = TCL_ERROR;

    /* See: <http://en.wikipedia.org/wiki/CPUID> */
#if defined(HAVE_CPUID) && defined(__CYGWIN__)
    __asm__ __volatile__("pushl %%ebx      \n\t" /* save %ebx */
#if defined(HAVE_CPUID)
    __asm__ __volatile__("mov %%ebx, %%edi     \n\t" /* save %ebx */
                 "cpuid            \n\t"
                 "movl %%ebx, %1   \n\t" /* save what cpuid just put in %ebx */
                 "popl %%ebx       \n\t" /* restore the old %ebx */
                 : "=a"(regsPtr[0]), "=r"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3])
                 : "a"(index)
                 "mov %%ebx, %%esi   \n\t" /* save what cpuid just put in %ebx */
                 "mov %%edi, %%ebx  \n\t" /* restore the old %ebx */
                 : "=a"(regsPtr[0]), "=S"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3])
                 : "a"(index));
                 : "cc");
    status = TCL_OK;
#endif
    return status;
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */