Chameleon

Chameleon Commit Details

Date:2011-08-14 15:13:43 (12 years 8 months ago)
Author:Azimutz
Commit:1377
Parents: 1376
Message:Last round... i think.
Changes:
M/trunk/i386/boot2/boot.c
M/trunk/i386/libsaio/cpu.c

File differences

trunk/i386/libsaio/cpu.c
490490
491491
492492
493
494
495
496
497
498
499
500
501
502
493
494
495
496
497
498
499
500
501
502
503
503504
504505
505506
p->CPU.FSBFrequency = fsbFrequency;
p->CPU.CPUFrequency = cpuFrequency;
DBG("CPU: Brand String:%s\n",p->CPU.BrandString);
DBG("CPU: Vendor/Family/ExtFamily:0x%x/0x%x/0x%x\n",p->CPU.Vendor, p->CPU.Family, p->CPU.ExtFamily);
DBG("CPU: Model/ExtModel/Stepping:0x%x/0x%x/0x%x\n",p->CPU.Model, p->CPU.ExtModel, p->CPU.Stepping);
DBG("CPU: MaxCoef/CurrCoef:0x%x/0x%x\n",p->CPU.MaxCoef, p->CPU.CurrCoef);
DBG("CPU: MaxDiv/CurrDiv:0x%x/0x%x\n",p->CPU.MaxDiv, p->CPU.CurrDiv);
DBG("CPU: TSCFreq:%dMHz\n",p->CPU.TSCFrequency / 1000000);
DBG("CPU: FSBFreq:%dMHz\n",p->CPU.FSBFrequency / 1000000);
DBG("CPU: CPUFreq:%dMHz\n",p->CPU.CPUFrequency / 1000000);
DBG("CPU: NoCores/NoThreads:%d/%d\n",p->CPU.NoCores, p->CPU.NoThreads);
DBG("CPU: Features:0x%08x\n",p->CPU.Features);
// keep formatted with spaces instead of tabs
DBG("CPU: Brand String: %s\n", p->CPU.BrandString);
DBG("CPU: Vendor/Family/ExtFamily: 0x%x/0x%x/0x%x\n", p->CPU.Vendor, p->CPU.Family, p->CPU.ExtFamily);
DBG("CPU: Model/ExtModel/Stepping: 0x%x/0x%x/0x%x\n", p->CPU.Model, p->CPU.ExtModel, p->CPU.Stepping);
DBG("CPU: MaxCoef/CurrCoef: 0x%x/0x%x\n", p->CPU.MaxCoef, p->CPU.CurrCoef);
DBG("CPU: MaxDiv/CurrDiv: 0x%x/0x%x\n", p->CPU.MaxDiv, p->CPU.CurrDiv);
DBG("CPU: TSCFreq: %dMHz\n", p->CPU.TSCFrequency / 1000000);
DBG("CPU: FSBFreq: %dMHz\n", p->CPU.FSBFrequency / 1000000);
DBG("CPU: CPUFreq: %dMHz\n", p->CPU.CPUFrequency / 1000000);
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();
#endif
trunk/i386/boot2/boot.c
6060
6161
6262
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
9063
9164
9265
9366
9467
9568
69
70
9671
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
9790
9891
9992
......
111104
112105
113106
114
107
115108
116109
117110
......
129122
130123
131124
132
133
125
126
134127
135128
136129
......
251244
252245
253246
254
255
256
257247
258248
259249
260250
251
252
261253
262254
255
263256
264257
265258
......
365358
366359
367360
368
369
370
371
372
373
374
375
376
377
378
361
362
363
364
365
366
367
368
379369
380370
381
371
382372
383373
384
385374
386375
387376
......
390379
391380
392381
393
382
394383
395
384
396385
397386
398387
......
468457
469458
470459
471
460
472461
473462
474463
......
503492
504493
505494
506
495
507496
508497
509498
......
684673
685674
686675
687
676
688677
689678
690679
......
725714
726715
727716
728
729
730
731
717
718
719
720
732721
733722
734723
......
759748
760749
761750
762
763
764
765
766
751
752
753
754
755
767756
768757
769758
#include "platform.h"
#include "modules.h"
long gBootMode; /* defaults to 0 == kBootModeNormal */
bool gOverrideKernel;
static char gBootKernelCacheFile[512];
static char gCacheNameAdler[64 + 256];
char *gPlatformName = gCacheNameAdler;
char gRootDevice[512];
char gMKextName[512];
char gMacOSVersion[8];
bool gEnableCDROMRescan;
bool gScanSingleDrive;
intbvCount = 0;
//intmenucount = 0;
intgDeviceCount = 0;
BVRefbvr;
BVRefmenuBVR;
BVRefbvChain;
booluseGUI;
//static void selectBiosDevice(void);
static unsigned long Adler32(unsigned char *buffer, long length);
static bool checkOSVersion(const char * version);
static bool getOSVersion();
static bool gUnloadPXEOnExit = false;
/*
* How long to wait (in seconds) to load the
* kernel after displaying the "boot:" prompt.
*/
#define kBootErrorTimeout 5
boolgOverrideKernel, gEnableCDROMRescan, gScanSingleDrive, useGUI;
static boolgUnloadPXEOnExit = false;
static chargCacheNameAdler[64 + 256];
char*gPlatformName = gCacheNameAdler;
chargRootDevice[512];
chargMKextName[512];
chargMacOSVersion[8];
static chargBootKernelCacheFile[512];
intbvCount = 0, gDeviceCount = 0;
//intmenucount = 0;
longgBootMode; /* defaults to 0 == kBootModeNormal */
BVRefbvr, menuBVR, bvChain;
static boolcheckOSVersion(const char * version);
static boolgetOSVersion();
static unsigned longAdler32(unsigned char *buffer, long length);
//static voidselectBiosDevice(void);
//==========================================================================
// Zero the BSS.
static void malloc_error(char *addr, size_t size, const char *file, int line)
{
stop("\nMemory allocation error! Addr=0x%x, Size=0x%x, File=%s, Line=%d\n",
stop("\nMemory allocation error! Addr: 0x%x, Size: 0x%x, File: %s, Line: %d\n",
(unsigned)addr, (unsigned)size, file, line);
}
static int ExecKernel(void *binary)
{
entry_t kernelEntry;
int ret;
intret;
entry_tkernelEntry;
bootArgs->kaddr = bootArgs->ksize = 0;
execute_hook("ExecKernel", (void*)binary, NULL, NULL, NULL);
// next boot device on its list.
void common_boot(int biosdev)
{
intstatus;
char *bootFile;
unsigned longadler32;
bool quiet;
bool firstRun = true;
bool instantMenu;
bool rescanPrompt;
char *bootFile;
intstatus;
unsigned intallowBVFlags = kBVFlagSystemVolume | kBVFlagForeignBoot;
unsigned intdenyBVFlags = kBVFlagEFISystem;
unsigned longadler32;
// Set reminder to unload the PXE base code. Neglect to unload
// the base code will result in a hang or kernel panic.
setBootGlobals(bvChain);
// Parse args, load and start kernel.
while (1) {
const char *val;
int len;
int trycache;
long flags, cachetime, kerneltime, exttime, sleeptime, time;
int ret = -1;
void *binary = (void *)kLoadAddr;
bool tryresume;
bool tryresumedefault;
bool forceresume;
bool usecache = false;//true;
while (1)
{
booltryresume, tryresumedefault, forceresume;
boolusecache = false;//true;
const char*val;
intlen, trycache, ret = -1;
longflags, cachetime, kerneltime, exttime, sleeptime, time;
void*binary = (void *)kLoadAddr;
// additional variable for testing alternate kernel image locations on boot helper partitions.
char bootFileSpec[512];
charbootFileSpec[512];
// Initialize globals.
sysConfigValid = false;
gErrors = false;
if (status == -1) continue;
status = processBootOptions();
// Status==1 means to chainboot
// Status == 1 means to chainboot
if ( status ==1 ) break;
// Status==-1 means that the config file couldn't be loaded or that gBootVolume is NULL
// Status == -1 means that the config file couldn't be loaded or that gBootVolume is NULL
if ( status == -1 )
{
// gBootVolume == NULL usually means the user hit escape.
const char *tmp;
BVRef bvr;
if (!getValueForKey(kWakeImage, &val, &len, &bootInfo->chameleonConfig))
val="/private/var/vm/sleepimage";
val = "/private/var/vm/sleepimage";
// Do this first to be sure that root volume is mounted
ret = GetFileInfo(0, val, &flags, &sleeptime);
len--;
val++;
}
strlcpy(gBootKernelCacheFile, val, len+1);
strlcpy(gBootKernelCacheFile, val, len + 1);
}
else {
//Lion
}
// chainboot
if (status==1) {
if (status == 1) {
// if we are already in graphics-mode,
if (getVideoMode() == GRAPHICS_MODE) {
setVideoMode(VGA_TEXT_MODE, 0); // switch back to text mode.
bool getOSVersion()
{
bool valid = false;
config_file_t systemVersion;
const char *val;
int len;
boolvalid = false;
const char*val;
intlen;
config_file_tsystemVersion;
if (!loadConfigFile("System/Library/CoreServices/SystemVersion.plist", &systemVersion))
{
#define NMAX 5000
// NMAX (was 5521) the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1
#define DO1(buf,i){s1 += buf[i]; s2 += s1;}
#define DO2(buf,i)DO1(buf,i); DO1(buf,i+1);
#define DO4(buf,i)DO2(buf,i); DO2(buf,i+2);
#define DO8(buf,i)DO4(buf,i); DO4(buf,i+4);
#define DO16(buf)DO8(buf,0); DO8(buf,8);
#define DO1(buf, i){s1 += buf[i]; s2 += s1;}
#define DO2(buf, i)DO1(buf, i); DO1(buf, i + 1);
#define DO4(buf, i)DO2(buf, i); DO2(buf, i + 2);
#define DO8(buf, i)DO4(buf, i); DO4(buf, i + 4);
#define DO16(buf)DO8(buf, 0); DO8(buf, 8);
unsigned long Adler32(unsigned char *buf, long len)
{

Archive Download the corresponding diff file

Revision: 1377