Bug 12896

Summary: Incorrect CPU model display at boot time
Product: Base System Reporter: Thao et Hubert Tournier <hubert.tournier>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 3.2-RELEASE   
Hardware: Any   
OS: Any   

Description Thao et Hubert Tournier 1999-07-31 09:20:00 UTC
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>

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 ;-)
How-To-Repeat: 
Reboot. It's systematic.
Comment 1 wilko freebsd_committer freebsd_triage 2000-04-20 22:21:15 UTC
State Changed
From-To: open->closed

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>