1 --- coreutils-5.2.0.orig/src/uname.c 2004-01-21 17:27:02.000000000 -0500
2 +++ coreutils-5.2.0/src/uname.c 2004-03-02 00:25:26.508518048 -0500
4 # include <sys/systeminfo.h>
8 +#define cpuid(in,a,b,c,d)\
9 + asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (in));
13 #if HAVE_SYSCTL && HAVE_SYS_SYSCTL_H
14 # include <sys/param.h> /* needed for OpenBSD 3.0 */
15 # include <sys/sysctl.h>
17 if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
24 + element = u.machine;
26 +/******************************************************************************
28 + * Hello, major hack. I shouldn't have to do this. struct utsname should
29 + * have another element with this info in it. There's probably a struct
30 + * somewhere that has this info, I just don't know where it is.
32 + *****************************************************************************/
34 + if( !strcmp( element, "i586" ) || !strcmp( element, "i686" ) ) {
35 + int eax, ebx, ecx, edx, unused;
36 + int model, family, sse;
38 + cpuid(0,unused,ebx,ecx,edx);
39 + cpuid(1,eax,unused,unused,unused);
40 + model = (eax >> 4) & 0xf;
41 + family = (eax >> 8) & 0xf;
44 + case 0x756e6547: // Intel
50 + element="pentium-mmx";
52 + case 6: // PentiumPro - Pentium III
53 + if( model == 1 ) // Pentium Pro
54 + element="pentiumpro";
55 + if( ( model == 3 ) || ( model == 5 ) ||
56 + ( model == 6 ) ) // Pentium II
58 + if( ( model == 7 ) || ( model == 8 ) ||
59 + ( model == 10 ) || ( model == 11 ) ) // These are all Pentium III
62 + case 15: // Pentium4
67 + } // end switch( family )
69 + case 0x68747541: // AMD
72 + if( ( model == 0 ) || ( model == 1 ) ||
73 + ( model == 2 ) || ( model == 3 ) ) // K5
75 + if( ( model == 6 ) || ( model == 7 ) ) // K6
77 + if( model == 8 ) // K6-2
79 + if( model == 9 ) // K6-3
98 + } // end switch( family )
100 + case 0x69727943: // Cyrix
101 + element="i386"; // who knows what cyrix supports, lets be safe
105 + } // end switch(ebx)
111 #ifdef UNAME_PROCESSOR
112 if (element == unknown)
115 if (toprint & PRINT_HARDWARE_PLATFORM)
117 - char const *element = unknown;
118 + char *element = unknown;
119 #if HAVE_SYSINFO && defined SI_PLATFORM
121 static char hardware_platform[257];
123 hardware_platform, sizeof hardware_platform))
124 element = hardware_platform;
130 + element = u.machine;
131 + if (strlen (element) == 4 && element[0] == 'i' && element[2] == '8'
132 + && element[3] == '6')
136 #ifdef UNAME_HARDWARE_PLATFORM
137 if (element == unknown)
145 +/******************************************************************************
147 + * int has_sse( void )
148 + * Checks Athlon CPU's to see if they support SSE.
150 + *****************************************************************************/
154 + unsigned long edx, unused;
156 + cpuid(1,unused,unused,unused,edx);
157 + // I think, I need this tested on a Duron with SSE
158 + // and one without it.
159 + sse = edx & 0x2000000;