From hubert.tournier@online.fr Sat Jul 31 01:17:12 1999
Return-Path: <hubert.tournier@online.fr>
Received: from smtp2.free.fr (smtp2.free.fr [212.27.32.6])
	by hub.freebsd.org (Postfix) with ESMTP id B4C6514D32
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 31 Jul 1999 01:17:08 -0700 (PDT)
	(envelope-from hubert.tournier@online.fr)
Received: from online.fr (paris11-50-21.dial.proxad.net [212.27.50.21])
	by smtp2.free.fr (8.9.3/8.9.3/Debian/GNU) with ESMTP id KAA20062
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 31 Jul 1999 10:16:25 +0200
Message-Id: <37A2B16A.D4159733@online.fr>
Date: Sat, 31 Jul 1999 10:18:50 +0200
From: Thao et Hubert Tournier <hubert.tournier@online.fr>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Incorrect CPU model display at boot time

>Number:         12896
>Category:       kern
>Synopsis:       Incorrect CPU model display at boot time
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jul 31 01:20:00 PDT 1999
>Closed-Date:    Thu Apr 20 14:21:15 PDT 2000
>Last-Modified:  Thu Apr 20 14:22:22 PDT 2000
>Originator:     hubert.tournier@online.fr
>Release:        FreeBSD 3.2-RELEASE i386
>Organization:
home
>Environment:

Only for machines with AMD processors.

>Description:

At boot time, I've the following display :

CPU: \^E (400.91-MHz 586-class CPU)
  Origin = "AuthenticAMD"  Id = 0x58c  Stepping=12
  Features=0x8021bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,PGE,MMX>

instead of :

CPU: AMD K6-2 (400.91-MHz 586-class CPU)
  Origin = "AuthenticAMD"  Id = 0x58c  Stepping=12
  Features=0x8021bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,PGE,MMX>

>How-To-Repeat:

Reboot. It's systematic.

>Fix:

In "/sys/i386/i386/identcpu.c", near line 313, the "cpu_model" variable
is
overwritten with the memcpy functions.

[...]
printcpuinfo(void)
{
	[...]
		do_cpuid(0x80000000, regs);
		nreg = regs[0];
		if (nreg >= 0x80000004) {
			do_cpuid(0x80000002, regs);
			memcpy(cpu_model, regs, sizeof regs);
			do_cpuid(0x80000003, regs);
			memcpy(cpu_model+16, regs, sizeof regs);
			do_cpuid(0x80000004, regs);
			memcpy(cpu_model+32, regs, sizeof regs);
		}
	[...]
}
[...]

Obviously, the cpu_model variable, a string, was not meant to receive
integer values.

As I don't understand the purpose of the do_cpuid function, I just wrap
this
part of the code with the following lines :

{
	char cpu_model_backup[128];
	[...]
	strcpy(cpu_model_backup, cpu_model);
	[block]
	strcpy(cpu_model, cpu_model_backup);
	[...]

It's a kludge but it fixes the problem ;-)

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: wilko 
State-Changed-When: Thu Apr 20 14:21:15 PDT 2000 
State-Changed-Why:  
Problem is fixed in 3.4-stable: 

FreeBSD 3.4-STABLE #1: Wed Apr 12 23:10:24 CEST 2000 
root@yedi.wbnet:/usr/src/sys/compile/YEDI 
Timecounter "i8254"  frequency 1193182 Hz 
Timecounter "TSC"  frequency 399809303 Hz 
CPU: AMD-K6(tm) 3D processor (399.81-MHz 586-class CPU) 
Origin = "AuthenticAMD"  Id = 0x58c  Stepping = 12 
Features=0x8021bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,PGE,MMX> 

>Unformatted:
 X-send-pr-version: 3.2
 
