Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Update: cpuctl fails to identify AMD quad-core Phenom processor



I recompiled cpuctl with COPTS="-g -O0" so I could get more details...

Here's what happens when I run it on my quad-core AMD Phenom...

speedy {106} gdb ./cpuctl
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64--netbsd"...
(gdb) set args identify 0
(gdb) run
Starting program: /home/paul/cpuctl identify 0

Program received signal SIGBUS, Bus error.
0x00007f7ffdb8deab in strstr () from /usr/lib/libc.so.12
(gdb) bt
#0  0x00007f7ffdb8deab in strstr () from /usr/lib/libc.so.12
#1  0x0000000000402cdb in amd_family6_probe (ci=0x7f7fffffd8d0)
    at /build/src/usr.sbin/cpuctl/arch/i386.c:1262
#2  0x0000000000402c0e in cpu_probe_features (ci=0x7f7fffffd8d0)
    at /build/src/usr.sbin/cpuctl/arch/i386.c:1222
#3  0x0000000000402f93 in identifycpu (cpuname=0x7f7fffffda80 "cpu0")
    at /build/src/usr.sbin/cpuctl/arch/i386.c:1370
#4  0x0000000000401558 in cpu_identify (argv=0x7f7fffffdb48)
    at /build/src/usr.sbin/cpuctl/cpuctl.c:172
#5  0x0000000000401287 in main (argc=3, argv=0x7f7fffffdb38)
    at /build/src/usr.sbin/cpuctl/cpuctl.c:94
(gdb) fr 1
#1  0x0000000000402cdb in amd_family6_probe (ci=0x7f7fffffd8d0)
    at /build/src/usr.sbin/cpuctl/arch/i386.c:1262
1262                    if ((p = strstr(cpu_brand_string, amd_brand[i])) != 
NULL) {
(gdb) list
1257
1258            if (*cpu_brand_string == '\0')
1259                    return;
1260
1261            for (i = 1; i < sizeof(__arraycount(amd_brand)); i++)
1262                    if ((p = strstr(cpu_brand_string, amd_brand[i])) != 
NULL) {
1263                            ci->ci_brand_id = i;
1264                            strlcpy(amd_brand_name, p, 
sizeof(amd_brand_name));
1265                            break;
1266                    }
(gdb) print cpu_brand_string
$1 = "AMD Phenom(tm) 9600 Quad-Core 
Processor\000\000\000\000\000\000\000\000\000"
(gdb) print i
$1 = 5
(gdb) print amd_brand[i]
$2 = 0x3833006c65746e49 <Address 0x3833006c65746e49 out of bounds>
(gdb)

Here's the definition of amd_brand from src/usr.sbin/cpuctl/arch/i386.c

/*
* AMD processors don't have Brand IDs, so we need these names for probe.
 */
static const char * const amd_brand[] = {
        "",
        "Duron",        /* AMD Duron(tm) */
        "MP",           /* AMD Athlon(tm) MP */
        "XP",           /* AMD Athlon(tm) XP */
        "4"             /* AMD Athlon(tm) 4 */
};

I don't see how the index variable i could be 5 since the only valid indices are 1 thru 4 !!!

----------------------------------------------------------------------
|   Paul Goyette   | PGP DSS Key fingerprint: |  E-mail addresses:   |
| Customer Service | FA29 0E3B 35AF E8AE 6651 |  paul%whooppee.com@localhost   |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette%juniper.net@localhost |
----------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index