Chameleon

Chameleon Commit Details

Date:2011-08-04 19:17:53 (12 years 8 months ago)
Author:Sergey Slice
Commit:1273
Parents: 1272
Message:cpu.c crashes on some cpu
Changes:
M/branches/slice/trunkM/i386/modules/Makefile
M/branches/slice/trunkM/i386/modules/NVRAM/Makefile
M/branches/slice/trunkM/i386/libsaio/cpu.c

File differences

branches/slice/trunkM/i386/libsaio/cpu.c
241241
242242
243243
244
244245
245246
246247
......
251252
252253
253254
255
256
257
258
254259
255260
256261
......
272277
273278
274279
280
281
282
283
275284
276285
277286
......
302311
303312
304313
314
315
316
317
318
319
320
321
322
323
324
325
305326
306327
307328
......
338359
339360
340361
341
362
342363
343364
344365
......
384405
385406
386407
387
408
388409
389410
390411
391
412
413
392414
393415
394416
......
451473
452474
453475
476
477
478
479
480
454481
455482
456483
......
569596
570597
571598
572
599
573600
574601
p->CPU.CPUID[i][2], p->CPU.CPUID[i][3]);
}
}
getchar();
#endif
p->CPU.Vendor= p->CPU.CPUID[CPUID_0][1];
p->CPU.Signature= p->CPU.CPUID[CPUID_1][0];
p->CPU.ExtFamily= bitfield(p->CPU.CPUID[CPUID_1][0], 27, 20);
p->CPU.Model += (p->CPU.ExtModel << 4);
#if DEBUG_CPU
printf("Enter cpuid_info\n");
getchar();
#endif
if (p->CPU.Vendor == CPUID_VENDOR_INTEL &&
p->CPU.Family == 0x06 &&
p->CPU.NoThreads= bitfield(p->CPU.CPUID[CPUID_1][1], 23, 16);// Use previous method for Cores and Threads
p->CPU.NoCores= bitfield(p->CPU.CPUID[CPUID_4][0], 31, 26) + 1;
}
#if DEBUG_CPU
printf("...OK\n");
getchar();
#endif
/* get brand string (if supported) */
/* Copyright: from Apple's XNU cpuid.c */
p->CPU.BrandString[0] = '\0';
}
}
#if DEBUG_CPU
{
inti;
DBG("CPUID Raw Values:\n");
for (i=0; i<CPUID_MAX; i++) {
DBG("%02d: %08x-%08x-%08x-%08x\n", i,
p->CPU.CPUID[i][0], p->CPU.CPUID[i][1],
p->CPU.CPUID[i][2], p->CPU.CPUID[i][3]);
}
}
getchar();
#endif
/* setup features */
if ((bit(23) & p->CPU.CPUID[CPUID_1][3]) != 0) {
cpuFrequency = 0;
if ((p->CPU.Vendor == CPUID_VENDOR_INTEL) && ((p->CPU.Family == 0x06) || (p->CPU.Family == 0x0f))) {
int intelCPU = p->CPU.Model;
//int intelCPU = p->CPU.Model;
if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0c) || (p->CPU.Family == 0x0f && p->CPU.Model >= 0x03)) {
/* Nehalem CPU model */
if (p->CPU.Family == 0x06 && (p->CPU.Model == CPU_MODEL_NEHALEM ||
fsbFrequency = (tscFrequency / bus_ratio_max);
}
//valv: Turbo Ratio Limit
if ((intelCPU != 0x2e) && (intelCPU != 0x2f)) {
/*if ((intelCPU != 0x2e) && (intelCPU != 0x2f)) {
msr = rdmsr64(MSR_TURBO_RATIO_LIMIT);
cpuFrequency = bus_ratio_max * fsbFrequency;
max_ratio = bus_ratio_max * 10;
} else {
} else */
{
cpuFrequency = tscFrequency;
}
if ((getValueForKey(kbusratio, &newratio, &len, &bootInfo->chameleonConfig)) && (len <= 4)) {
}
/* Mobile CPU ? */
//Slice
#if DEBUG_CPU
pause();
#endif
msr = rdmsr64(MSR_IA32_PLATFORM_ID);
DBG("msr(0x%04x): MSR_IA32_PLATFORM_ID 0x%08x\n", MSR_IA32_PLATFORM_ID, msr & 0xffffffff); //__LINE__ - source line number :)
if (msr) {
DBG("CPU: NoCores/NoThreads: %d/%d\n",p->CPU.NoCores, p->CPU.NoThreads);
DBG("CPU: Features: 0x%08x\n",p->CPU.Features);
#if DEBUG_CPU
pause();
getchar();
#endif
}
branches/slice/trunkM/i386/modules/NVRAM/Makefile
11
22
3
34
45
6
57
68
79
MODULE_NAME = NVRAM
MODULE_AUTHOR = Slice
MODULE_VERSION = "1.0.0"
MODULE_COMPAT_VERSION = "1.0.0"
MODULE_DESCRIPTION = NVRAM support (remember values from previous boot)
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
branches/slice/trunkM/i386/modules/Makefile
1111
1212
1313
14
15
14
15
1616
1717
1818
include ${SRCROOT}/Make.rules
# The order of building is important.
SUBDIRS = klibc uClibcxx Resolution KernelPatcher
#HelloWorld Memory NetbookInstaller KextPatcher Networking NVRAM HPET USBFix RamDiskLoader
SUBDIRS = klibc uClibcxx Resolution KernelPatcher NVRAM
#HelloWorld Memory NetbookInstaller KextPatcher Networking HPET USBFix RamDiskLoader
CFLAGS= -Os $(MORECPP) -arch i386 -g -static

Archive Download the corresponding diff file

Revision: 1273