--- client/hostinfo_unix.C.orig Thu Jul 6 06:22:18 2006 +++ client/hostinfo_unix.C Thu Jul 13 13:10:07 2006 @@ -302,11 +302,58 @@ #endif // linux +#ifdef __FreeBSD__ +#if defined(__i386__) || defined(__amd64__) +#include +#include +#include + +void use_cpuid(HOST_INFO& host) { + u_int p[4]; + int hasMMX, hasSSE, hasSSE2, hasSSE3, has3DNow, has3DNowExt = 0; + + do_cpuid(0x0, p); + + if (p[0] >= 0x1) { + + do_cpuid(0x1, p); + + hasMMX = (p[3] & (1 << 23 )) >> 23; // 0x0800000 + hasSSE = (p[3] & (1 << 25 )) >> 25; // 0x2000000 + hasSSE2 = (p[3] & (1 << 26 )) >> 26; // 0x4000000 + hasSSE3 = (p[2] & (1 << 0 )) >> 0; + } + + do_cpuid(0x80000000, p); + if (p[0]>=0x80000001) { + do_cpuid(0x80000001, p); + hasMMX |= (p[3] & (1 << 23 )) >> 23; // 0x0800000 + has3DNow = (p[3] & (1 << 31 )) >> 31; //0x80000000 + has3DNowExt = (p[3] & (1 << 30 )) >> 30; + } + + host.p_capabilities[0] = '\0'; + if (hasMMX) strncat(host.p_capabilities, "mmx ", 4); + if (hasSSE) strncat(host.p_capabilities, "sse ", 4); + if (hasSSE2) strncat(host.p_capabilities, "sse2 ", 5); + if (hasSSE3) strncat(host.p_capabilities, "sse3 ", 5); + if (has3DNow) strncat(host.p_capabilities, "3dnow ", 6); + if (has3DNowExt) strncat(host.p_capabilities, "3dnowext ", 9); + strip_whitespace(host.p_capabilities); +} +#endif +#endif + // get all relevant host information // int HOST_INFO::get_host_info() { get_filesystem_info(d_total, d_free); +#if defined(__FreeBSD__) +#if defined(__i386__) || defined(__amd64__) + use_cpuid(*this); +#endif +#endif #ifdef linux parse_cpuinfo(*this); #elif defined(__EMX__)