From c624912e3e80fca3f5f8eafe7d253128a76acaa1 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 23 Jun 2004 16:09:32 +0000 Subject: [PATCH] * fhandler_proc.cc (format_proc_cpuinfo): Test CPU vendor and print AMD specific 3dnow capabilities. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/fhandler_proc.cc | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index fe1b730ea..7af3e9c83 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2004-06-23 Tomas Ukkonen + + * fhandler_proc.cc (format_proc_cpuinfo): Test CPU vendor and print + AMD specific 3dnow capabilities. + 2004-06-23 Pierre Humblet * fhandler_socket.cc (fhandler_socket::release): Call diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc index 0331314e1..20b6633ea 100644 --- a/winsup/cygwin/fhandler_proc.cc +++ b/winsup/cygwin/fhandler_proc.cc @@ -698,6 +698,14 @@ format_proc_cpuinfo (char *destbuf, size_t maxsize) cpuid (&maxf, &vendor_id[0], &vendor_id[2], &vendor_id[1], 0); maxf &= 0xffff; vendor_id[3] = 0; + + // vendor identification + bool is_amd = false, is_intel = false; + if (!strcmp ((char*)vendor_id, "AuthenticAMD")) + is_amd = true; + else if (!strcmp ((char*)vendor_id, "GenuineIntel")) + is_intel = true; + bufptr += __small_sprintf (bufptr, "vendor_id : %s\n", (char *)vendor_id); unsigned cpu_mhz = 0; if (wincap.is_winnt ()) @@ -865,6 +873,26 @@ format_proc_cpuinfo (char *destbuf, size_t maxsize) print (" tm2"); if (features2 & (1 << 10)) print (" cid"); + + if (is_amd) + { + // uses AMD extended calls to check + // for 3dnow and 3dnow extended support + // (source: AMD Athlon Processor Recognition Application Note) + unsigned int a = 0, b, c, d; + cpuid (&a, &b, &c, &d, 0x80000000); + + if (a >= 0x80000001) // has basic capabilities + { + cpuid (&a, &b, &c, &d, 0x80000001); + + if(d & (1 << 30)) // 31th bit is on + print (" 3dnowext"); + + if(d & (1 << 31)) // 32th bit (highest) is on + print (" 3dnow"); + } + } } else if (wincap.is_winnt ()) {