Chameleon

Chameleon Commit Details

Date:2010-08-06 08:10:44 (8 years 11 months ago)
Author:mozo
Commit:314
Parents: 313
Message:Getting back original Apple's code for CPU brand reading and checking.
Changes:
M/trunk/i386/libsaio/smbios_patcher.c
M/trunk/i386/libsaio/cpu.c

File differences

trunk/i386/libsaio/smbios_patcher.c
272272
273273
274274
275
275
276276
277277
278278
if (Platform.CPU.Vendor == 0x756E6547) // Intel
{
if (!done) {
verbose("CPU is %s, family 0x%x, model 0x%x, brand %s\n", Platform.CPU.BrandString, Platform.CPU.Family, Platform.CPU.Model);
verbose("CPU is %s, family 0x%x, model 0x%x\n", Platform.CPU.BrandString, Platform.CPU.Family, Platform.CPU.Model);
done = true;
}
trunk/i386/libsaio/cpu.c
135135
136136
137137
138
138
139139
140140
141141
142142
143143
144
144
145145
146
146
147147
148
149
150
148
149
150
151151
152152
153
154
153155
154156
155157
/* Copyright: from Apple's XNU cpuid.c */
if (p->CPU.CPUID[CPUID_80][0] > 0x80000004) {
uint32_treg[4];
char str[128], *c;
char str[128], *s;
/*
* The brand string 48 bytes (max), guaranteed to
* be NUL terminated.
*/
do_cpuid(0x80000002, reg);
bcopy((char *)reg, &p->CPU.BrandString[0], 16);
bcopy((char *)reg, &str[0], 16);
do_cpuid(0x80000003, reg);
bcopy((char *)reg, &p->CPU.BrandString[16], 16);
bcopy((char *)reg, &str[16], 16);
do_cpuid(0x80000004, reg);
bcopy((char *)reg, &p->CPU.BrandString[32], 16);
for (c = str; *c != '\0'; c++) {
if (*c != ' ') break;
bcopy((char *)reg, &str[32], 16);
for (s = str; *s != '\0'; s++) {
if (*s != ' ') break;
}
strlcpy(p->CPU.BrandString,s, sizeof(p->CPU.BrandString));
if (!strncmp(p->CPU.BrandString, CPU_STRING_UNKNOWN, min(sizeof(p->CPU.BrandString), strlen(CPU_STRING_UNKNOWN) + 1))) {
/*
* This string means we have a firmware-programmable brand string,

Archive Download the corresponding diff file

Revision: 314