Chameleon

Chameleon Commit Details

Date:2011-08-15 22:37:33 (8 years 3 months ago)
Author:ErmaC
Commit:1396
Parents: 1395
Message:Add Bosnian.lproj and sync with trunk
Changes:
A/branches/ErmaC/package/Resources/Bosnian.lproj/Welcome.rtfd/TXT.rtf
A/branches/ErmaC/package/Resources/Bosnian.lproj/Localizable.strings
A/branches/ErmaC/package/Resources/Bosnian.lproj/Conclusion.rtfd
A/branches/ErmaC/package/Resources/Bosnian.lproj/License.rtf
A/branches/ErmaC/package/Resources/Bosnian.lproj/Conclusion.rtfd/TXT.rtf
A/branches/ErmaC/package/Resources/Bosnian.lproj/Description.html
A/branches/ErmaC/package/Resources/Bosnian.lproj/Welcome.rtfd
A/branches/ErmaC/package/Resources/Bosnian.lproj
M/branches/ErmaC/version
M/branches/ErmaC/i386/libsaio/fake_efi.c
M/branches/ErmaC/CREDITS
M/branches/ErmaC/i386/libsaio/fdisk.h
M/branches/ErmaC/i386/boot2/boot.c
M/branches/ErmaC/package/buildpkg.sh
M/branches/ErmaC/i386/libsaio/nvidia.c
M/branches/ErmaC/i386/boot2/boot.h
M/branches/ErmaC/i386/libsaio/ati.c
M/branches/ErmaC/i386/libsaio/stringTable.c
M/branches/ErmaC/i386/libsaio/pci_root.c
M/branches/ErmaC/i386/libsaio/acpi_patcher.c
M/branches/ErmaC/i386/libsaio/saio_types.h
M/branches/ErmaC/i386/boot2/gui.c
M/branches/ErmaC/i386/libsaio/cpu.c

File differences

branches/ErmaC/version
1
1
2.0
2.1_pkg_stuff
branches/ErmaC/i386/libsaio/acpi_patcher.c
8686
8787
8888
89
89
9090
9191
9292
......
205205
206206
207207
208
208
209209
210210
211
211
212212
213
214
213
214
215215
216216
217
218
217
218
219219
220220
221
222
223
224
221
222
223
224
225225
226226
227227
......
239239
240240
241241
242
242
243243
244244
245
245
246246
247247
248248
249249
250
250
251251
252252
253253
254254
255
255
256256
257257
258258
......
260260
261261
262262
263
264
265
266
267
263
264
265
266
267
268268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
269
270
271
272
273
274
275
276
277
278
279
366280
367
368
369
281
282
283
370284
371
372
285
286
373287
374
375
288
289
290
291
292
293
294
376295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
377364
365
366
367
368
369
370
371
372
373
374
375
378376
379377
380378
......
388386
389387
390388
391
389
392390
393391
394392
395393
396
394
397395
398396
399397
}
return NULL;
}
/* The folowing ACPI Table search algo. should be reused anywhere needed:*/
/** The folowing ACPI Table search algo. should be reused anywhere needed:*/
int search_and_get_acpi_fd(const char * filename, const char ** outDirspec)
{
int fd = 0;
0x01, 0x17, 0x50, 0x6D, 0x52, 0x65, 0x66, 0x41, /* ..PmRefA */
0x43, 0x70, 0x75, 0x43, 0x73, 0x74, 0x00, 0x00, /* CpuCst.. */
0x00, 0x10, 0x00, 0x00, 0x49, 0x4E, 0x54, 0x4C, /* ....INTL */
0x31, 0x03, 0x10, 0x20 /* 1.._*/
0x31, 0x03, 0x10, 0x20/* 1.._*/
};
char resource_template_register_fixedhw[] =
char resource_template_register_fixedhw[] =
{
0x11, 0x14, 0x0A, 0x11, 0x82, 0x0C, 0x00, 0x7F,
0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x11, 0x14, 0x0A, 0x11, 0x82, 0x0C, 0x00, 0x7F,
0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x79, 0x00
};
char resource_template_register_systemio[] =
char resource_template_register_systemio[] =
{
0x11, 0x14, 0x0A, 0x11, 0x82, 0x0C, 0x00, 0x01,
0x08, 0x00, 0x00, 0x15, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x79, 0x00,
};
0x08, 0x00, 0x00, 0x15, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x79, 0x00,
};
if (Platform.CPU.Vendor != 0x756E6547) {
verbose ("Not an Intel platform: C-States will not be generated !!!\n");
return NULL;
return NULL;
}
if (acpi_cpu_count == 0)
if (acpi_cpu_count == 0)
get_acpi_cpu_names((void*)dsdt, dsdt->Length);
if (acpi_cpu_count > 0)
if (acpi_cpu_count > 0)
{
bool c2_enabled = false;
bool c3_enabled = false;
bool c4_enabled = false;
bool cst_using_sustemio = false;
bool cst_using_systemio = false;
getBoolForKey(kEnableC2State, &c2_enabled, &bootInfo->chameleonConfig);
getBoolForKey(kEnableC3State, &c3_enabled, &bootInfo->chameleonConfig);
getBoolForKey(kEnableC4State, &c4_enabled, &bootInfo->chameleonConfig);
getBoolForKey(kCSTUsingSystemIO, &cst_using_sustemio, &bootInfo->chameleonConfig);
getBoolForKey(kCSTUsingSystemIO, &cst_using_systemio, &bootInfo->chameleonConfig);
c2_enabled = c2_enabled | (fadt->C2_Latency < 100);
c3_enabled = c3_enabled | (fadt->C3_Latency < 1000);
unsigned char cstates_count = 1 + (c2_enabled ? 1 : 0) + (c3_enabled ? 1 : 0);
struct aml_chunk* root = aml_create_node(NULL);
aml_add_buffer(root, ssdt_header, sizeof(ssdt_header)); // SSDT header
struct aml_chunk* scop = aml_add_scope(root, "\\_PR_");
struct aml_chunk* name = aml_add_name(scop, "CST_");
struct aml_chunk* pack = aml_add_package(name);
aml_add_byte(pack, cstates_count);
aml_add_buffer(root, ssdt_header, sizeof(ssdt_header)); // SSDT header
struct aml_chunk* scop = aml_add_scope(root, "\\_PR_");
struct aml_chunk* name = aml_add_name(scop, "CST_");
struct aml_chunk* pack = aml_add_package(name);
aml_add_byte(pack, cstates_count);
struct aml_chunk* tmpl = aml_add_package(pack);
if (cst_using_sustemio)
{
// C1
resource_template_register_fixedhw[8] = 0x00;
resource_template_register_fixedhw[9] = 0x00;
resource_template_register_fixedhw[18] = 0x00;
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
aml_add_byte(tmpl, 0x01); // C1
aml_add_word(tmpl, 0x0001); // Latency
aml_add_dword(tmpl, 0x000003e8); // Power
uint8_t p_blk_lo, p_blk_hi;
if (c2_enabled) // C2
{
p_blk_lo = acpi_cpu_p_blk + 4;
p_blk_hi = (acpi_cpu_p_blk + 4) >> 8;
tmpl = aml_add_package(pack);
resource_template_register_systemio[11] = p_blk_lo; // C2
resource_template_register_systemio[12] = p_blk_hi; // C2
aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio));
aml_add_byte(tmpl, 0x02); // C2
aml_add_word(tmpl, 0x0040); // Latency
aml_add_dword(tmpl, 0x000001f4); // Power
}
if (c4_enabled) // C4
{
p_blk_lo = acpi_cpu_p_blk + 5;
p_blk_hi = (acpi_cpu_p_blk + 5) >> 8;
tmpl = aml_add_package(pack);
resource_template_register_systemio[11] = p_blk_lo; // C4
resource_template_register_systemio[12] = p_blk_hi; // C4
aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio));
aml_add_byte(tmpl, 0x04); // C4
aml_add_word(tmpl, 0x0080); // Latency
aml_add_dword(tmpl, 0x000000C8); // Power
}
else if (c3_enabled) // C3
{
p_blk_lo = acpi_cpu_p_blk + 5;
p_blk_hi = (acpi_cpu_p_blk + 5) >> 8;
tmpl = aml_add_package(pack);
resource_template_register_systemio[11] = p_blk_lo; // C3
resource_template_register_systemio[12] = p_blk_hi; // C3
aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio));
aml_add_byte(tmpl, 0x03); // C3
aml_add_word(tmpl, 0x0060); // Latency
aml_add_dword(tmpl, 0x0000015e); // Power
}
}
else
{
// C1
resource_template_register_fixedhw[11] = 0x00; // C1
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
aml_add_byte(tmpl, 0x01); // C1
aml_add_word(tmpl, 0x0001); // Latency
aml_add_dword(tmpl, 0x000003e8); // Power
resource_template_register_fixedhw[18] = 0x03;
if (c2_enabled) // C2
{
tmpl = aml_add_package(pack);
resource_template_register_fixedhw[11] = 0x10; // C2
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
aml_add_byte(tmpl, 0x02); // C2
aml_add_word(tmpl, 0x0040); // Latency
aml_add_dword(tmpl, 0x000001f4); // Power
}
if (c4_enabled) // C4
{
tmpl = aml_add_package(pack);
resource_template_register_fixedhw[11] = 0x30; // C4
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
aml_add_byte(tmpl, 0x04); // C4
aml_add_word(tmpl, 0x0080); // Latency
aml_add_dword(tmpl, 0x000000C8); // Power
}
else if (c3_enabled)
{
tmpl = aml_add_package(pack);
resource_template_register_fixedhw[11] = 0x20; // C3
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
aml_add_byte(tmpl, 0x03); // C3
aml_add_word(tmpl, 0x0060); // Latency
aml_add_dword(tmpl, 0x0000015e); // Power
}
}
struct aml_chunk* tmpl = aml_add_package(pack);
if (cst_using_systemio)
{
// C1
resource_template_register_fixedhw[8] = 0x00;
resource_template_register_fixedhw[9] = 0x00;
resource_template_register_fixedhw[18] = 0x00;
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
aml_add_byte(tmpl, 0x01); // C1
aml_add_word(tmpl, 0x0001); // Latency
aml_add_dword(tmpl, 0x000003e8); // Power
// Aliaces
int i;
for (i = 0; i < acpi_cpu_count; i++)
uint8_t p_blk_lo, p_blk_hi;
if (c2_enabled) // C2
{
char name[9];
sprintf(name, "_PR_%c%c%c%c", acpi_cpu_name[i][0], acpi_cpu_name[i][1], acpi_cpu_name[i][2], acpi_cpu_name[i][3]);
p_blk_lo = acpi_cpu_p_blk + 4;
p_blk_hi = (acpi_cpu_p_blk + 4) >> 8;
scop = aml_add_scope(root, name);
aml_add_alias(scop, "CST_", "_CST");
tmpl = aml_add_package(pack);
resource_template_register_systemio[11] = p_blk_lo; // C2
resource_template_register_systemio[12] = p_blk_hi; // C2
aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio));
aml_add_byte(tmpl, 0x02); // C2
aml_add_word(tmpl, 0x0040); // Latency
aml_add_dword(tmpl, 0x000001f4); // Power
}
if (c4_enabled) // C4
{
p_blk_lo = acpi_cpu_p_blk + 5;
p_blk_hi = (acpi_cpu_p_blk + 5) >> 8;
tmpl = aml_add_package(pack);
resource_template_register_systemio[11] = p_blk_lo; // C4
resource_template_register_systemio[12] = p_blk_hi; // C4
aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio));
aml_add_byte(tmpl, 0x04); // C4
aml_add_word(tmpl, 0x0080); // Latency
aml_add_dword(tmpl, 0x000000C8); // Power
}
else if (c3_enabled) // C3
{
p_blk_lo = acpi_cpu_p_blk + 5;
p_blk_hi = (acpi_cpu_p_blk + 5) >> 8;
tmpl = aml_add_package(pack);
resource_template_register_systemio[11] = p_blk_lo; // C3
resource_template_register_systemio[12] = p_blk_hi; // C3
aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio));
aml_add_byte(tmpl, 0x03);// C3
aml_add_word(tmpl, 0x0060);// Latency
aml_add_dword(tmpl, 0x0000015e);// Power
}
}
else
{
// C1
resource_template_register_fixedhw[11] = 0x00; // C1
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
aml_add_byte(tmpl, 0x01);// C1
aml_add_word(tmpl, 0x0001);// Latency
aml_add_dword(tmpl, 0x000003e8);// Power
resource_template_register_fixedhw[18] = 0x03;
if (c2_enabled) // C2
{
tmpl = aml_add_package(pack);
resource_template_register_fixedhw[11] = 0x10; // C2
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
aml_add_byte(tmpl, 0x02);// C2
aml_add_word(tmpl, 0x0040);// Latency
aml_add_dword(tmpl, 0x000001f4);// Power
}
if (c4_enabled) // C4
{
tmpl = aml_add_package(pack);
resource_template_register_fixedhw[11] = 0x30; // C4
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
aml_add_byte(tmpl, 0x04);// C4
aml_add_word(tmpl, 0x0080);// Latency
aml_add_dword(tmpl, 0x000000C8);// Power
}
else if (c3_enabled)
{
tmpl = aml_add_package(pack);
resource_template_register_fixedhw[11] = 0x20; // C3
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
aml_add_byte(tmpl, 0x03);// C3
aml_add_word(tmpl, 0x0060);// Latency
aml_add_dword(tmpl, 0x0000015e);// Power
}
}
// Aliaces
int i;
for (i = 0; i < acpi_cpu_count; i++)
{
char name[9];
sprintf(name, "_PR_%c%c%c%c", acpi_cpu_name[i][0], acpi_cpu_name[i][1], acpi_cpu_name[i][2], acpi_cpu_name[i][3]);
scop = aml_add_scope(root, name);
aml_add_alias(scop, "CST_", "_CST");
}
aml_calculate_size(root);
struct acpi_2_ssdt *ssdt = (struct acpi_2_ssdt *)AllocateKernelMemory(root->Size);
aml_destroy_node(root);
//dumpPhysAddr("C-States SSDT content: ", ssdt, ssdt->Length);
verbose ("SSDT with CPU C-States generated successfully\n");
return ssdt;
}
else
else
{
verbose ("ACPI CPUs not found: C-States not generated !!!\n");
}
branches/ErmaC/i386/libsaio/pci_root.c
4545
4646
4747
48
49
4850
4951
5052
......
7375
7476
7577
76
78
79
80
81
82
83
84
85
86
87
88
89
7790
7891
7992
int getPciRootUID(void)
{
char dsdt_dirSpec[128];
void *new_dsdt;
const char *val;
int len,fsize;
goto out;
}
int fd = search_and_get_acpi_fd("DSDT.aml", &dsdt_filename);
// Try using the file specified with the DSDT option
if (getValueForKey(kDSDT, &dsdt_filename, &len, &bootInfo->chameleonConfig))
{
sprintf(dsdt_dirSpec, dsdt_filename);
}
else
{
sprintf(dsdt_dirSpec, "DSDT.aml");
}
int fd = search_and_get_acpi_fd(dsdt_dirSpec, &dsdt_filename);
// Check booting partition
if (fd<0)
branches/ErmaC/i386/libsaio/fdisk.h
3535
3636
3737
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
5454
5555
5656
57
58
59
57
58
59
6060
6161
6262
#ifndef __LIBSAIO_FDISK_H
#define __LIBSAIO_FDISK_H
#define DISK_BLK00 /* blkno of boot block */
#define DISK_BLK0SZ512 /* size of boot block */
#define DISK_BOOTSZ446 /* size of boot code in boot block */
#define DISK_SIGNATURE0xAA55 /* signature of the boot record */
#define FDISK_NPART4 /* number of entries in fdisk table */
#define FDISK_ACTIVE0x80 /* indicator of active partition */
#define FDISK_NEXTNAME0xA7 /* indicator of NeXT partition */
#define FDISK_DOS120x01 /* 12-bit fat < 10MB dos partition */
#define FDISK_DOS16S0x04 /* 16-bit fat < 32MB dos partition */
#define FDISK_DOSEXT0x05 /* extended dos partition */
#define FDISK_DOS16B0x06 /* 16-bit fat >= 32MB dos partition */
#define FDISK_NTFS0x07 /* NTFS partition */
#define FDISK_SMALLFAT320x0b /* FAT32 partition */
#define FDISK_FAT320x0c /* FAT32 partition */
#define FDISK_DOS16SLBA0x0e
#define FDISK_LINUX0x83
#define DISK_BLK00/* blkno of boot block */
#define DISK_BLK0SZ512/* size of boot block */
#define DISK_BOOTSZ446/* size of boot code in boot block */
#define DISK_SIGNATURE0xAA55/* signature of the boot record */
#define FDISK_NPART4/* number of entries in fdisk table */
#define FDISK_ACTIVE0x80/* indicator of active partition */
#define FDISK_NEXTNAME0xA7/* indicator of NeXT partition */
#define FDISK_DOS120x01/* 12-bit fat < 10MB dos partition */
#define FDISK_DOS16S0x04/* 16-bit fat < 32MB dos partition */
#define FDISK_DOSEXT0x05/* extended dos partition */
#define FDISK_DOS16B0x06/* 16-bit fat >= 32MB dos partition */
#define FDISK_NTFS0x07/* NTFS partition */
#define FDISK_SMALLFAT320x0b /* FAT32 partition */
#define FDISK_FAT320x0c/* FAT32 partition */
#define FDISK_DOS16SLBA 0x0e
#define FDISK_LINUX0x83
#define FDISK_OPENBSD0xa6 /* OpenBSD FFS partition */
#define FDISK_FREEBSD0xa5 /* FreeBSD UFS2 partition */
#define FDISK_BEFS0xeb /* Haiku BeFS partition */
#define FDISK_UFS0xa8 /* Apple UFS partition */
#define FDISK_HFS0xaf /* Apple HFS partition */
#define FDISK_BOOTER0xab /* Apple booter partition */
#define FDISK_UFS0xa8/* Apple UFS partition */
#define FDISK_HFS0xaf/* Apple HFS partition */
#define FDISK_BOOTER0xab/* Apple booter partition */
/*
* Format of fdisk partion entry (if present).
branches/ErmaC/i386/libsaio/nvidia.c
6767
6868
6969
70
70
7171
7272
7373
......
7676
7777
7878
79
80
79
80
8181
82
83
84
82
83
84
8585
8686
8787
......
588588
589589
590590
591
591
592592
593593
594594
#define NVIDIA_ROM_SIZE0x10000
#define PATCH_ROM_SUCCESS1
#define PATCH_ROM_SUCCESS_HAS_LVDS2
#define PATCH_ROM_SUCCESS_HAS_LVDS2
#define PATCH_ROM_FAILED0
#define MAX_NUM_DCB_ENTRIES16
#define TYPE_GROUPED0xff
const char *nvidia_compatible_0[]={ "@0,compatible","NVDA,NVMac" };
const char *nvidia_compatible_1[]={ "@1,compatible","NVDA,NVMac" };
const char *nvidia_device_type_0[]={ "@0,device_type","display" };
const char *nvidia_device_type_1[]={ "@1,device_type","display" };
const char *nvidia_device_type_0[]={ "@0,device_type", "display" };
const char *nvidia_device_type_1[]={ "@1,device_type", "display" };
const char *nvidia_device_type[]={ "device_type","NVDA,Parent" };
const char *nvidia_name_0[]={ "@0,name","NVDA,Display-A" };
const char *nvidia_name_1[]={ "@1,name","NVDA,Display-B" };
const char *nvidia_slot_name[]={ "AAPL,slot-name","Slot-1" };
const char *nvidia_name_0[]={ "@0,name","NVDA,Display-A" };
const char *nvidia_name_1[]={ "@1,name","NVDA,Display-B" };
const char *nvidia_slot_name[]={ "AAPL,slot-name", "Slot-1" };
static uint8_t default_NVCAP[]= {
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00,
{ 0x10DE0871, "GeForce 9200" },
{ 0x10DE0872, "GeForce G102M" },
{ 0x10DE0873, "GeForce G102M" },
{ 0x10DE0874, "ION 9300M" },
{ 0x10DE0874, "ION 9300M" },
{ 0x10DE0876, "ION" },
{ 0x10DE087A, "GeForce 9400" },
{ 0x10DE087D, "ION 9400M" },
branches/ErmaC/i386/libsaio/ati.c
13031303
13041304
13051305
1306
1307
1308
1309
1310
1311
1312
1313
13061314
13071315
1316
13081317
1318
13091319
13101320
1321
13111322
1312
1323
1324
1325
1326
1327
13131328
13141329
13151330
1316
1317
1318
1331
1332
13191333
13201334
1321
1335
1336
1337
1338
13221339
1323
1324
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
13251351
1352
1353
1354
13261355
1327
1328
1329
1330
1331
1332
13331356
13341357
13351358
}
}
//card->ports = 2; // default - Azi: default is card_configs
if (card->info->chip_family >= CHIP_FAMILY_CEDAR)
{
card->flags |= EVERGREEN;
//card->ports = 3; //Azi: use the AtiPorts key if needed
}
//atN = 0;
// Check AtiConfig key for a framebuffer name,
card->cfg_name = getStringForKey(kAtiConfig, &bootInfo->chameleonConfig);
// if none,
if (!card->cfg_name)
{
// use the device fb key on radeon_cards, to retrive the default name from card_configs.
card->cfg_name = card_configs[card->info->cfg_name].name;
card->ports = card_configs[card->info->cfg_name].ports;
// and leave ports alone!
//card->ports = card_configs[card->info->cfg_name].ports;
// which means one of the fb's or kNull
verbose("Framebuffer set to device's default: %s\n", card->cfg_name);
}
else
{
for (i = 0; i < kCfgEnd; i++)
if (strcmp(card->cfg_name, card_configs[i].name) == 0)
card->ports = card_configs[i].ports;
// else, use the fb name returned by AtiConfig.
verbose("(AtiConfig) Framebuffer set to: %s\n", card->cfg_name);
}
if (card->info->chip_family >= CHIP_FAMILY_CEDAR)
// Check AtiPorts key for nr of ports,
card->ports = getIntForKey(kAtiPorts, &n_ports, &bootInfo->chameleonConfig);
// if a value bigger than 0 ?? is found, (do we need >= 0 ?? that's null FB on card_configs)
if (n_ports > 0)
{
card->flags |= EVERGREEN;
card->ports = 3; //Azi: not sure of the usefulness ??
card->ports = n_ports; // use it.
verbose("(AtiPorts) Nr of ports set to: %d\n", card->ports);
}
else// if (card->cfg_name > 0) // do we want 0 ports if fb is kNull or mistyped ?
{
// else, match fb name with card_configs list and retrive default nr of ports.
for (i = 0; i < kCfgEnd; i++)
if (strcmp(card->cfg_name, card_configs[i].name) == 0)
card->ports = card_configs[i].ports; // default
verbose("Nr of ports set to framebuffer's default: %d\n", card->ports);
}
//else
//card->ports = 2/1 ?; // set a min if 0 ports ?
//verbose("Nr of ports set to min: %d\n", card->ports);
getIntForKey(kAtiPorts, &n_ports, &bootInfo->bootConfig);
if (n_ports > 0){
card->ports = n_ports;
verbose("AtiPorts set to %d\n",n_ports); //AniV
}
sprintf(name, "ATY,%s", card->cfg_name);
aty_name.type = kStr;
aty_name.size = strlen(name) + 1;
branches/ErmaC/i386/libsaio/cpu.c
11
2
2
33
44
55
......
2424
2525
2626
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
8484
8585
86
8786
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
87
88
89
14190
91
14292
14393
14494
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
191141
192142
193
194143
195144
196145
197
198
146
147
199148
200149
201150
202
203151
204152
205153
206154
207155
208
209
210
211
212
156
157
158
159
160
213161
214162
215
163
216164
217165
218166
219167
220168
221
169
222170
223
224
225
171
172
173
226174
227
175
228176
229177
230
231
178
232179
233180
234181
235182
236183
237184
238
239
185
186
240187
241188
242189
190
243191
244192
245193
......
248196
249197
250198
251
252
253
254
255
256
257
258
259
260
261
199
200
201
202
203
204
205
206
207
208
209
262210
263
264
265
266
267
268
269
270
271
211
212
213
214
272215
216
217
218
219
220
221
273222
274223
275224
276225
277226
278
227
279228
280229
281230
......
290239
291240
292241
293
242
294243
295244
296
297
298
299
300
301
245
246
247
248
249
250
302251
303252
304253
......
330279
331280
332281
333
282
334283
335284
336285
337
286
338287
339288
340289
341290
342
343
344
345
346
347
348
349
350
291
292
293
294
295
296
297
298
299
351300
352
353
354
301
302
303
355304
356
357
358
305
306
307
359308
360
361
362
363
364
365
366
309
310
311
312
313
314
315
367316
368317
369318
370319
371
320
372321
373322
374323
375324
376325
377326
378
327
379328
380329
381330
......
391340
392341
393342
394
343
395344
396
345
397346
398347
399348
......
404353
405354
406355
407
356
408357
409358
410
359
411360
412361
413362
414363
415364
416
417
365
366
418367
419
368
420369
421
422
423
370
371
372
373
424374
425375
426
376
427377
428378
429379
430380
431381
432
382
433383
434384
435385
......
450400
451401
452402
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
525477
526
527
528
529
530
478
479
480
481
482
531483
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
551504
552
505
553506
554507
/*
* Copyright 2008 Islam Ahmed Zaid. All rights reserved. <azismed@gmail.com>
* Copyright 2008 Islam Ahmed Zaid. All rights reserved. <azismed@gmail.com>
* AsereBLN: 2009: cleanup and bugfix
*/
*/
static uint64_t measure_tsc_frequency(void)
{
uint64_t tscStart;
uint64_t tscEnd;
uint64_t tscDelta = 0xffffffffffffffffULL;
unsigned long pollCount;
uint64_t retval = 0;
int i;
/* Time how many TSC ticks elapse in 30 msec using the 8254 PIT
* counter 2. We run this loop 3 times to make sure the cache
* is hot and we take the minimum delta from all of the runs.
* That is to say that we're biased towards measuring the minimum
* number of TSC ticks that occur while waiting for the timer to
* expire. That theoretically helps avoid inconsistencies when
* running under a VM if the TSC is not virtualized and the host
* steals time. The TSC is normally virtualized for VMware.
*/
for(i = 0; i < 10; ++i)
{
enable_PIT2();
set_PIT2_mode0(CALIBRATE_LATCH);
tscStart = rdtsc64();
pollCount = poll_PIT2_gate();
tscEnd = rdtsc64();
/* The poll loop must have run at least a few times for accuracy */
if(pollCount <= 1)
continue;
/* The TSC must increment at LEAST once every millisecond. We
* should have waited exactly 30 msec so the TSC delta should
* be >= 30. Anything less and the processor is way too slow.
*/
if((tscEnd - tscStart) <= CALIBRATE_TIME_MSEC)
continue;
// tscDelta = MIN(tscDelta, (tscEnd - tscStart))
if( (tscEnd - tscStart) < tscDelta )
tscDelta = tscEnd - tscStart;
}
/* tscDelta is now the least number of TSC ticks the processor made in
* a timespan of 0.03 s (e.g. 30 milliseconds)
* Linux thus divides by 30 which gives the answer in kiloHertz because
* 1 / ms = kHz. But we're xnu and most of the rest of the code uses
* Hz so we need to convert our milliseconds to seconds. Since we're
* dividing by the milliseconds, we simply multiply by 1000.
*/
/* Unlike linux, we're not limited to 32-bit, but we do need to take care
* that we're going to multiply by 1000 first so we do need at least some
* arithmetic headroom. For now, 32-bit should be enough.
* Also unlike Linux, our compiler can do 64-bit integer arithmetic.
*/
if(tscDelta > (1ULL<<32))
retval = 0;
else
{
retval = tscDelta * 1000 / 30;
}
disable_PIT2();
return retval;
uint64_t tscStart;
uint64_t tscEnd;
uint64_t tscDelta = 0xffffffffffffffffULL;
unsigned long pollCount;
uint64_t retval = 0;
int i;
/* Time how many TSC ticks elapse in 30 msec using the 8254 PIT
* counter 2. We run this loop 3 times to make sure the cache
* is hot and we take the minimum delta from all of the runs.
* That is to say that we're biased towards measuring the minimum
* number of TSC ticks that occur while waiting for the timer to
* expire. That theoretically helps avoid inconsistencies when
* running under a VM if the TSC is not virtualized and the host
* steals time. The TSC is normally virtualized for VMware.
*/
for(i = 0; i < 10; ++i)
{
enable_PIT2();
set_PIT2_mode0(CALIBRATE_LATCH);
tscStart = rdtsc64();
pollCount = poll_PIT2_gate();
tscEnd = rdtsc64();
/* The poll loop must have run at least a few times for accuracy */
if (pollCount <= 1)
continue;
/* The TSC must increment at LEAST once every millisecond.
* We should have waited exactly 30 msec so the TSC delta should
* be >= 30. Anything less and the processor is way too slow.
*/
if ((tscEnd - tscStart) <= CALIBRATE_TIME_MSEC)
continue;
// tscDelta = MIN(tscDelta, (tscEnd - tscStart))
if ( (tscEnd - tscStart) < tscDelta )
tscDelta = tscEnd - tscStart;
}
/* tscDelta is now the least number of TSC ticks the processor made in
* a timespan of 0.03 s (e.g. 30 milliseconds)
* Linux thus divides by 30 which gives the answer in kiloHertz because
* 1 / ms = kHz. But we're xnu and most of the rest of the code uses
* Hz so we need to convert our milliseconds to seconds. Since we're
* dividing by the milliseconds, we simply multiply by 1000.
*/
/* Unlike linux, we're not limited to 32-bit, but we do need to take care
* that we're going to multiply by 1000 first so we do need at least some
* arithmetic headroom. For now, 32-bit should be enough.
* Also unlike Linux, our compiler can do 64-bit integer arithmetic.
*/
if (tscDelta > (1ULL<<32))
retval = 0;
else
{
retval = tscDelta * 1000 / 30;
}
disable_PIT2();
return retval;
}
#if 0
/*
* DFE: Measures the Max Performance Frequency in Hz (64-bit)
*/
static uint64_t measure_mperf_frequency(void)
{
uint64_t mperfStart;
uint64_t mperfEnd;
uint64_t mperfDelta = 0xffffffffffffffffULL;
unsigned long pollCount;
uint64_t retval = 0;
int i;
/* Time how many MPERF ticks elapse in 30 msec using the 8254 PIT
* counter 2. We run this loop 3 times to make sure the cache
* is hot and we take the minimum delta from all of the runs.
* That is to say that we're biased towards measuring the minimum
* number of MPERF ticks that occur while waiting for the timer to
* expire.
*/
for(i = 0; i < 10; ++i)
{
enable_PIT2();
set_PIT2_mode0(CALIBRATE_LATCH);
mperfStart = rdmsr64(MSR_AMD_MPERF);
pollCount = poll_PIT2_gate();
mperfEnd = rdmsr64(MSR_AMD_MPERF);
/* The poll loop must have run at least a few times for accuracy */
if(pollCount <= 1)
continue;
/* The MPERF must increment at LEAST once every millisecond. We
* should have waited exactly 30 msec so the MPERF delta should
* be >= 30. Anything less and the processor is way too slow.
*/
if((mperfEnd - mperfStart) <= CALIBRATE_TIME_MSEC)
continue;
// tscDelta = MIN(tscDelta, (tscEnd - tscStart))
if( (mperfEnd - mperfStart) < mperfDelta )
mperfDelta = mperfEnd - mperfStart;
}
/* mperfDelta is now the least number of MPERF ticks the processor made in
* a timespan of 0.03 s (e.g. 30 milliseconds)
*/
if(mperfDelta > (1ULL<<32))
retval = 0;
else
{
retval = mperfDelta * 1000 / 30;
}
disable_PIT2();
return retval;
}
#endif
/*
* Original comment/code:
* "DFE: Measures the Max Performance Frequency in Hz (64-bit)"
*
* Measures the Actual Performance Frequency in Hz (64-bit)
* (just a naming change, mperf --> aperf )
*/
static uint64_t measure_aperf_frequency(void)
{
uint64_t aperfStart;
uint64_t aperfEnd;
uint64_t aperfDelta = 0xffffffffffffffffULL;
unsigned long pollCount;
uint64_t retval = 0;
int i;
/* Time how many APERF ticks elapse in 30 msec using the 8254 PIT
* counter 2. We run this loop 3 times to make sure the cache
* is hot and we take the minimum delta from all of the runs.
* That is to say that we're biased towards measuring the minimum
* number of APERF ticks that occur while waiting for the timer to
* expire.
*/
for(i = 0; i < 10; ++i)
{
enable_PIT2();
set_PIT2_mode0(CALIBRATE_LATCH);
aperfStart = rdmsr64(MSR_AMD_APERF);
pollCount = poll_PIT2_gate();
aperfEnd = rdmsr64(MSR_AMD_APERF);
/* The poll loop must have run at least a few times for accuracy */
if(pollCount <= 1)
continue;
/* The TSC must increment at LEAST once every millisecond. We
* should have waited exactly 30 msec so the APERF delta should
* be >= 30. Anything less and the processor is way too slow.
*/
if((aperfEnd - aperfStart) <= CALIBRATE_TIME_MSEC)
continue;
// tscDelta = MIN(tscDelta, (tscEnd - tscStart))
if( (aperfEnd - aperfStart) < aperfDelta )
aperfDelta = aperfEnd - aperfStart;
}
/* mperfDelta is now the least number of MPERF ticks the processor made in
* a timespan of 0.03 s (e.g. 30 milliseconds)
*/
if(aperfDelta > (1ULL<<32))
retval = 0;
else
{
retval = aperfDelta * 1000 / 30;
}
disable_PIT2();
return retval;
uint64_t aperfStart;
uint64_t aperfEnd;
uint64_t aperfDelta = 0xffffffffffffffffULL;
unsigned long pollCount;
uint64_t retval = 0;
int i;
/* Time how many APERF ticks elapse in 30 msec using the 8254 PIT
* counter 2. We run this loop 3 times to make sure the cache
* is hot and we take the minimum delta from all of the runs.
* That is to say that we're biased towards measuring the minimum
* number of APERF ticks that occur while waiting for the timer to
* expire.
*/
for(i = 0; i < 10; ++i)
{
enable_PIT2();
set_PIT2_mode0(CALIBRATE_LATCH);
aperfStart = rdmsr64(MSR_AMD_APERF);
pollCount = poll_PIT2_gate();
aperfEnd = rdmsr64(MSR_AMD_APERF);
/* The poll loop must have run at least a few times for accuracy */
if (pollCount <= 1)
continue;
/* The TSC must increment at LEAST once every millisecond.
* We should have waited exactly 30 msec so the APERF delta should
* be >= 30. Anything less and the processor is way too slow.
*/
if ((aperfEnd - aperfStart) <= CALIBRATE_TIME_MSEC)
continue;
// tscDelta = MIN(tscDelta, (tscEnd - tscStart))
if ( (aperfEnd - aperfStart) < aperfDelta )
aperfDelta = aperfEnd - aperfStart;
}
/* mperfDelta is now the least number of MPERF ticks the processor made in
* a timespan of 0.03 s (e.g. 30 milliseconds)
*/
if (aperfDelta > (1ULL<<32))
retval = 0;
else
{
retval = aperfDelta * 1000 / 30;
}
disable_PIT2();
return retval;
}
/*
* Calculates the FSB and CPU frequencies using specific MSRs for each CPU
* - multi. is read from a specific MSR. In the case of Intel, there is:
* a max multi. (used to calculate the FSB freq.),
* and a current multi. (used to calculate the CPU freq.)
* a max multi. (used to calculate the FSB freq.),
* and a current multi. (used to calculate the CPU freq.)
* - fsbFrequency = tscFrequency / multi
* - cpuFrequency = fsbFrequency * multi
*/
void scan_cpu(PlatformInfo_t *p)
{
uint64_ttscFrequency, fsbFrequency, cpuFrequency;
uint64_tmsr, flex_ratio;
uint8_tmaxcoef, maxdiv, currcoef, bus_ratio_max, currdiv;
const char *newratio;
int len, myfsb;
uint8_t bus_ratio_min;
uint32_t max_ratio, min_ratio;
const char*newratio;
intlen, myfsb;
uint8_tbus_ratio_min;
uint32_tmax_ratio, min_ratio;
max_ratio = min_ratio = myfsb = bus_ratio_min = 0;
maxcoef = maxdiv = bus_ratio_max = currcoef = currdiv = 0;
/* get cpuid values */
do_cpuid(0x00000000, p->CPU.CPUID[CPUID_0]);
do_cpuid(0x00000001, p->CPU.CPUID[CPUID_1]);
do_cpuid(0x00000002, p->CPU.CPUID[CPUID_2]);
do_cpuid(0x00000003, p->CPU.CPUID[CPUID_3]);
do_cpuid2(0x00000004, 0, p->CPU.CPUID[CPUID_4]);
do_cpuid2(0x00000004, 0, p->CPU.CPUID[CPUID_4]);
do_cpuid(0x80000000, p->CPU.CPUID[CPUID_80]);
if ((p->CPU.CPUID[CPUID_80][0] & 0x0000000f) >= 8) {
do_cpuid(0x80000008, p->CPU.CPUID[CPUID_88]);
do_cpuid(0x80000001, p->CPU.CPUID[CPUID_81]);
if ((p->CPU.CPUID[CPUID_80][0] & 0x0000000f) >= 8) {
do_cpuid(0x80000008, p->CPU.CPUID[CPUID_88]);
do_cpuid(0x80000001, p->CPU.CPUID[CPUID_81]);
}
else if ((p->CPU.CPUID[CPUID_80][0] & 0x0000000f) >= 1) {
else if ((p->CPU.CPUID[CPUID_80][0] & 0x0000000f) >= 1) {
do_cpuid(0x80000001, p->CPU.CPUID[CPUID_81]);
}
#if DEBUG_CPU
{
inti;
printf("CPUID Raw Values:\n");
for (i=0; i<CPUID_MAX; i++) {
printf("%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]);
p->CPU.CPUID[i][0], p->CPU.CPUID[i][1],
p->CPU.CPUID[i][2], p->CPU.CPUID[i][3]);
}
}
#endif
p->CPU.Vendor= p->CPU.CPUID[CPUID_0][1];
p->CPU.Signature= p->CPU.CPUID[CPUID_1][0];
p->CPU.Stepping= bitfield(p->CPU.CPUID[CPUID_1][0], 3, 0);
p->CPU.ExtModel= bitfield(p->CPU.CPUID[CPUID_1][0], 19, 16);
p->CPU.ExtFamily= bitfield(p->CPU.CPUID[CPUID_1][0], 27, 20);
p->CPU.Model += (p->CPU.ExtModel << 4);
if (p->CPU.Vendor == CPUID_VENDOR_INTEL &&
p->CPU.Family == 0x06 &&
p->CPU.Model >= CPUID_MODEL_NEHALEM &&
p->CPU.Model != CPUID_MODEL_ATOM // MSR is *NOT* available on the Intel Atom CPU
)
{
msr = rdmsr64(MSR_CORE_THREAD_COUNT);// Undocumented MSR in Nehalem and newer CPUs
p->CPU.NoCores= bitfield((uint32_t)msr, 31, 16);// Using undocumented MSR to get actual values
p->CPU.NoThreads= bitfield((uint32_t)msr, 15, 0);// Using undocumented MSR to get actual values
p->CPU.Model += (p->CPU.ExtModel << 4);
if (p->CPU.Vendor == CPUID_VENDOR_INTEL &&
p->CPU.Family == 0x06 &&
p->CPU.Model >= CPUID_MODEL_NEHALEM &&
p->CPU.Model != CPUID_MODEL_ATOM// MSR is *NOT* available on the Intel Atom CPU
)
{
msr = rdmsr64(MSR_CORE_THREAD_COUNT);// Undocumented MSR in Nehalem and newer CPUs
p->CPU.NoCores= bitfield((uint32_t)msr, 31, 16);// Using undocumented MSR to get actual values
p->CPU.NoThreads= bitfield((uint32_t)msr, 15, 0);// Using undocumented MSR to get actual values
}
else if (p->CPU.Vendor == CPUID_VENDOR_AMD)
{
p->CPU.NoThreads= bitfield(p->CPU.CPUID[CPUID_1][1], 23, 16);
p->CPU.NoCores= bitfield(p->CPU.CPUID[CPUID_88][2], 7, 0) + 1;
}
else
{
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;
else if (p->CPU.Vendor == CPUID_VENDOR_AMD)
{
p->CPU.NoThreads= bitfield(p->CPU.CPUID[CPUID_1][1], 23, 16);
p->CPU.NoCores= bitfield(p->CPU.CPUID[CPUID_88][2], 7, 0) + 1;
}
else
{
// Use previous method for Cores and Threads
p->CPU.NoThreads= bitfield(p->CPU.CPUID[CPUID_1][1], 23, 16);
p->CPU.NoCores= bitfield(p->CPU.CPUID[CPUID_4][0], 31, 26) + 1;
}
/* get brand string (if supported) */
/* Copyright: from Apple's XNU cpuid.c */
if (p->CPU.CPUID[CPUID_80][0] > 0x80000004) {
uint32_treg[4];
char str[128], *s;
charstr[128], *s;
/*
* The brand string 48 bytes (max), guaranteed to
* be NULL terminated.
if (*s != ' ') break;
}
strlcpy(p->CPU.BrandString,s, sizeof(p->CPU.BrandString));
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,
* and the firmware couldn't figure out what sort of CPU we have.
*/
p->CPU.BrandString[0] = '\0';
}
/*
* This string means we have a firmware-programmable brand string,
* and the firmware couldn't figure out what sort of CPU we have.
*/
p->CPU.BrandString[0] = '\0';
}
}
/* setup features */
if (p->CPU.NoThreads > p->CPU.NoCores) {
p->CPU.Features |= CPU_FEATURE_HTT;
}
tscFrequency = measure_tsc_frequency();
fsbFrequency = 0;
cpuFrequency = 0;
if ((p->CPU.Vendor == CPUID_VENDOR_INTEL) && ((p->CPU.Family == 0x06) || (p->CPU.Family == 0x0f))) {
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 ||
p->CPU.Model == CPU_MODEL_FIELDS ||
p->CPU.Model == CPU_MODEL_DALES ||
p->CPU.Model == CPU_MODEL_DALES_32NM ||
p->CPU.Model == CPU_MODEL_WESTMERE ||
p->CPU.Model == CPU_MODEL_NEHALEM_EX ||
p->CPU.Model == CPU_MODEL_WESTMERE_EX ||
p->CPU.Model == CPU_MODEL_SANDY ||
p->CPU.Model == CPU_MODEL_SANDY_XEON)) {
if (p->CPU.Family == 0x06 && (p->CPU.Model == CPU_MODEL_NEHALEM ||
p->CPU.Model == CPU_MODEL_FIELDS ||
p->CPU.Model == CPU_MODEL_DALES ||
p->CPU.Model == CPU_MODEL_DALES_32NM ||
p->CPU.Model == CPU_MODEL_WESTMERE ||
p->CPU.Model == CPU_MODEL_NEHALEM_EX ||
p->CPU.Model == CPU_MODEL_WESTMERE_EX ||
p->CPU.Model == CPU_MODEL_SANDY ||
p->CPU.Model == CPU_MODEL_SANDY_XEON)) {
msr = rdmsr64(MSR_PLATFORM_INFO);
DBG("msr(%d): platform_info %08x\n", __LINE__, bitfield(msr, 31, 0));
bus_ratio_max = bitfield(msr, 14, 8);
bus_ratio_min = bitfield(msr, 46, 40); //valv: not sure about this one (Remarq.1)
DBG("msr(%d): platform_info %08x\n", __LINE__, bitfield(msr, 31, 0));
bus_ratio_max = bitfield(msr, 14, 8);
bus_ratio_min = bitfield(msr, 46, 40); //valv: not sure about this one (Remarq.1)
msr = rdmsr64(MSR_FLEX_RATIO);
DBG("msr(%d): flex_ratio %08x\n", __LINE__, bitfield(msr, 31, 0));
if (bitfield(msr, 16, 16)) {
flex_ratio = bitfield(msr, 14, 8);
DBG("msr(%d): flex_ratio %08x\n", __LINE__, bitfield(msr, 31, 0));
if (bitfield(msr, 16, 16)) {
flex_ratio = bitfield(msr, 14, 8);
/* bcc9: at least on the gigabyte h67ma-ud2h,
where the cpu multipler can't be changed to
allow overclocking, the flex_ratio msr has unexpected (to OSX)
contents. These contents cause mach_kernel to
fail to compute the bus ratio correctly, instead
causing the system to crash since tscGranularity
is inadvertently set to 0.
*/
where the cpu multipler can't be changed to
allow overclocking, the flex_ratio msr has unexpected (to OSX)
contents.These contents cause mach_kernel to
fail to compute the bus ratio correctly, instead
causing the system to crash since tscGranularity
is inadvertently set to 0.
*/
if (flex_ratio == 0) {
/* Clear bit 16 (evidently the presence bit) */
wrmsr64(MSR_FLEX_RATIO, (msr & 0xFFFFFFFFFFFEFFFFULL));
msr = rdmsr64(MSR_FLEX_RATIO);
verbose("Unusable flex ratio detected. Patched MSR now %08x\n", bitfield(msr, 31, 0));
verbose("Unusable flex ratio detected. Patched MSR now %08x\n", bitfield(msr, 31, 0));
} else {
if (bus_ratio_max > flex_ratio) {
bus_ratio_max = flex_ratio;
}
}
}
if (bus_ratio_max) {
fsbFrequency = (tscFrequency / bus_ratio_max);
}
max_ratio = atoi(newratio);
max_ratio = (max_ratio * 10);
if (len >= 3) max_ratio = (max_ratio + 5);
verbose("Bus-Ratio: min=%d, max=%s\n", bus_ratio_min, newratio);
// extreme overclockers may love 320 ;)
if ((max_ratio >= min_ratio) && (max_ratio <= 320)) {
cpuFrequency = (fsbFrequency * max_ratio) / 10;
}
}
//valv: to be uncommented if Remarq.1 didn't stick
/*if(bus_ratio_max > 0) bus_ratio = flex_ratio;*/
/*if (bus_ratio_max > 0) bus_ratio = flex_ratio;*/
p->CPU.MaxRatio = max_ratio;
p->CPU.MinRatio = min_ratio;
myfsb = fsbFrequency / 1000000;
verbose("Sticking with [BCLK: %dMhz, Bus-Ratio: %d]\n", myfsb, max_ratio);
currcoef = bus_ratio_max;
} else {
msr = rdmsr64(MSR_IA32_PERF_STATUS);
DBG("msr(%d): ia32_perf_stat 0x%08x\n", __LINE__, bitfield(msr, 31, 0));
currcoef = bitfield(msr, 12, 8);
DBG("msr(%d): ia32_perf_stat 0x%08x\n", __LINE__, bitfield(msr, 31, 0));
currcoef = bitfield(msr, 12, 8);
/* Non-integer bus ratio for the max-multi*/
maxdiv = bitfield(msr, 46, 46);
maxdiv = bitfield(msr, 46, 46);
/* Non-integer bus ratio for the current-multi (undocumented)*/
currdiv = bitfield(msr, 14, 14);
if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0e) || (p->CPU.Family == 0x0f)) // This will always be model >= 3
currdiv = bitfield(msr, 14, 14);
// This will always be model >= 3
if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0e) || (p->CPU.Family == 0x0f))
{
/* On these models, maxcoef defines TSC freq */
maxcoef = bitfield(msr, 44, 40);
maxcoef = bitfield(msr, 44, 40);
} else {
/* On lower models, currcoef defines TSC freq */
/* XXX */
maxcoef = currcoef;
}
if (maxcoef) {
if (maxdiv) {
fsbFrequency = ((tscFrequency * 2) / ((maxcoef * 2) + 1));
p->CPU.Features |= CPU_FEATURE_MOBILE;
}
}
else if((p->CPU.Vendor == CPUID_VENDOR_AMD) && (p->CPU.Family == 0x0f))
{
switch(p->CPU.ExtFamily)
{
case 0x00: /* K8 */
msr = rdmsr64(K8_FIDVID_STATUS);
maxcoef = bitfield(msr, 21, 16) / 2 + 4;
currcoef = bitfield(msr, 5, 0) / 2 + 4;
break;
case 0x01: /* K10 */
msr = rdmsr64(K10_COFVID_STATUS);
do_cpuid2(0x00000006, 0, p->CPU.CPUID[CPUID_6]);
if(bitfield(p->CPU.CPUID[CPUID_6][2], 0, 0) == 1) // EffFreq: effective frequency interface
{
//uint64_t mperf = measure_mperf_frequency();
uint64_t aperf = measure_aperf_frequency();
cpuFrequency = aperf;
}
// NOTE: tsc runs at the maccoeff (non turbo)
// *not* at the turbo frequency.
maxcoef = bitfield(msr, 54, 49) / 2 + 4;
currcoef = bitfield(msr, 5, 0) + 0x10;
currdiv = 2 << bitfield(msr, 8, 6);
break;
case 0x05: /* K14 */
msr = rdmsr64(K10_COFVID_STATUS);
currcoef = (bitfield(msr, 54, 49) + 0x10) << 2;
currdiv = (bitfield(msr, 8, 4) + 1) << 2;
currdiv += bitfield(msr, 3, 0);
break;
case 0x02: /* K11 */
// not implimented
break;
}
if (maxcoef)
{
if (currdiv)
{
if(!currcoef) currcoef = maxcoef;
if(!cpuFrequency)
fsbFrequency = ((tscFrequency * currdiv) / currcoef);
else
fsbFrequency = ((cpuFrequency * currdiv) / currcoef);
DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv);
} else {
if(!cpuFrequency)
fsbFrequency = (tscFrequency / maxcoef);
else
fsbFrequency = (cpuFrequency / maxcoef);
DBG("%d\n", currcoef);
}
}
else if (currcoef)
{
if (currdiv)
{
fsbFrequency = ((tscFrequency * currdiv) / currcoef);
DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv);
} else {
fsbFrequency = (tscFrequency / currcoef);
DBG("%d\n", currcoef);
}
}
if(!cpuFrequency) cpuFrequency = tscFrequency;
}
else if ((p->CPU.Vendor == CPUID_VENDOR_AMD) && (p->CPU.Family == 0x0f))
{
switch(p->CPU.ExtFamily)
{
case 0x00: /* K8 */
msr = rdmsr64(K8_FIDVID_STATUS);
maxcoef = bitfield(msr, 21, 16) / 2 + 4;
currcoef = bitfield(msr, 5, 0) / 2 + 4;
break;
case 0x01: /* K10 */
msr = rdmsr64(K10_COFVID_STATUS);
do_cpuid2(0x00000006, 0, p->CPU.CPUID[CPUID_6]);
// EffFreq: effective frequency interface
if (bitfield(p->CPU.CPUID[CPUID_6][2], 0, 0) == 1)
{
//uint64_t mperf = measure_mperf_frequency();
uint64_t aperf = measure_aperf_frequency();
cpuFrequency = aperf;
}
// NOTE: tsc runs at the maccoeff (non turbo)
//*not* at the turbo frequency.
maxcoef = bitfield(msr, 54, 49) / 2 + 4;
currcoef = bitfield(msr, 5, 0) + 0x10;
currdiv = 2 << bitfield(msr, 8, 6);
break;
case 0x05: /* K14 */
msr = rdmsr64(K10_COFVID_STATUS);
currcoef = (bitfield(msr, 54, 49) + 0x10) << 2;
currdiv = (bitfield(msr, 8, 4) + 1) << 2;
currdiv += bitfield(msr, 3, 0);
break;
case 0x02: /* K11 */
// not implimented
break;
}
if (maxcoef)
{
if (currdiv)
{
if (!currcoef) currcoef = maxcoef;
if (!cpuFrequency)
fsbFrequency = ((tscFrequency * currdiv) / currcoef);
else
fsbFrequency = ((cpuFrequency * currdiv) / currcoef);
DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv);
} else {
if (!cpuFrequency)
fsbFrequency = (tscFrequency / maxcoef);
else
fsbFrequency = (cpuFrequency / maxcoef);
DBG("%d\n", currcoef);
}
}
else if (currcoef)
{
if (currdiv)
{
fsbFrequency = ((tscFrequency * currdiv) / currcoef);
DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv);
} else {
fsbFrequency = (tscFrequency / currcoef);
DBG("%d\n", currcoef);
}
}
if (!cpuFrequency) cpuFrequency = tscFrequency;
}
#if 0
if (!fsbFrequency) {
fsbFrequency = (DEFAULT_FSB * 1000);
cpuFrequency = tscFrequency;
DBG("0 ! using the default value for FSB !\n");
}
if (!fsbFrequency) {
fsbFrequency = (DEFAULT_FSB * 1000);
cpuFrequency = tscFrequency;
DBG("0 ! using the default value for FSB !\n");
}
#endif
p->CPU.MaxCoef = maxcoef;
p->CPU.MaxDiv = maxdiv;
p->CPU.CurrCoef = currcoef;
p->CPU.CurrDiv = currdiv;
p->CPU.TSCFrequency = tscFrequency;
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);
p->CPU.MaxCoef = maxcoef;
p->CPU.MaxDiv = maxdiv;
p->CPU.CurrCoef = currcoef;
p->CPU.CurrDiv = currdiv;
p->CPU.TSCFrequency = tscFrequency;
p->CPU.FSBFrequency = fsbFrequency;
p->CPU.CPUFrequency = cpuFrequency;
// 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();
pause();
#endif
}
branches/ErmaC/i386/libsaio/stringTable.c
323323
324324
325325
326
326
327
328
329
330
331
327332
328333
329334
330335
331336
337
338
332339
333340
334341
}
if ((strlen(match) == key_len)
&& strncmp(match, key, key_len) == 0) {
*matchval = value;
// create a new string
char* newstr = malloc(value_len + 1);
strncpy(newstr, value, value_len);
newstr[value_len] = 0;
*matchval = newstr;
*len = value_len;
retval = true;
/* Continue to look for this key; last one wins. */
}
}
return retval;
}
branches/ErmaC/i386/libsaio/saio_types.h
213213
214214
215215
216
217
218
219
220
221
216
217
218
219
220
222221
223222
224223
};
enum {
kPartitionTypeHFS = 0xAF,
kPartitionTypeHPFS = 0x07,
kPartitionTypeFAT16 = 0x06,
kPartitionTypeFAT32 = 0x0c,
kPartitionTypeEXT3 = 0x83,
kPartitionTypeHFS= 0xAF,
kPartitionTypeHPFS= 0x07,
kPartitionTypeFAT16= 0x06,
kPartitionTypeFAT32= 0x0c,
kPartitionTypeEXT3= 0x83,
kPartitionTypeBEFS = 0xEB,
kPartitionTypeFreeBSD = 0xa5,
kPartitionTypeOpenBSD = 0xa6
branches/ErmaC/i386/libsaio/fake_efi.c
742742
743743
744744
745
745
746746
747747
748748
749749
750
// Initialize the device tree
setupEfiDeviceTree();
saveOriginalSMBIOS();
saveOriginalSMBIOS();
// Add configuration table entries to both the services table and the device tree
setupEfiConfigurationTable();
}
branches/ErmaC/i386/boot2/boot.c
66
77
88
9
9
1010
1111
1212
......
2121
2222
2323
24
2425
2526
2627
2728
28
29
2930
3031
3132
3233
33
34
3435
35
36
37
36
37
38
3839
39
40
4041
4142
4243
......
4950
5051
5152
52
5353
5454
5555
......
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
108
115109
116110
117111
118
112
119113
120114
121115
......
128122
129123
130124
131
132
125
126
133127
134128
135129
......
148142
149143
150144
151
152
145
146
153147
154
155
148
149
156150
157
158
151
152
159153
160154
161155
......
163157
164158
165159
166
160
167161
168162
169163
......
186180
187181
188182
189
190
191
192
193
194
195
196
197
183
184
185
186
187
188
189
190
191
192
198193
199194
200195
201
202
203
196
197
204198
205
199
206200
207201
208202
209203
210204
211
205
206
212207
213208
214
215209
216210
217211
218212
219
220
221213
222214
223215
......
242234
243235
244236
245
246
237
238
247239
248240
249241
250242
251243
252244
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
273265
274
275
276
277
266
267
268
269
278270
279
271
280272
281
273
282274
283
275
284276
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
340336
341337
342338
343339
344
345
346
340
341
342
343
344
347345
348346
349347
......
354352
355353
356354
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
355
356
357
358
359
360
361
362
363
364
365
366
375367
376
377
378
379
380
381
382
383
368
369
384370
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
371
372
373
405374
406
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
407399
400
401
408402
409
403
410404
411405
412406
......
431425
432426
433427
434
435
428
429
436430
437431
438432
......
461455
462456
463457
464
458
465459
466460
467461
......
477471
478472
479473
480
481
482
474
475
476
477
483478
484479
485480
486481
487482
488483
489
484
490485
491
486
492487
493
494
495
496
497
498
488
489
490
491
492
493
499494
500495
501496
......
504499
505500
506501
507
502
503
508504
509
510
511
512
513
514
515
516
517
518505
519506
520507
......
523510
524511
525512
526
513
514
527515
528516
529517
......
542530
543531
544532
545
546
547
533
534
535
548536
549
550
551
552
553
537
538
539
540
541
554542
555543
556
557
558
559
560
561
562
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
563575
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
576
577
578
579
589580
590
591
592
581
582
583
593584
594585
595
586
596587
597588
598589
599
600
590
591
601592
602593
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
644635
645
636
646637
647
648
649
650
651
652
653
654
655
656
657
658
659
638
639
640
641
642
643
644
645
646
647
648
649
650
651
660652
661
662
653
654
663655
664
665
656
657
666658
667
659
668660
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
661
662
663
664
665
666
667
668
669
685670
686
671
687672
688
673
674
675
676
677
678
679
680
681
689682
690
683
691684
692685
693686
694
687
695688
696689
697690
698691
699
700
701
702
703
704
705
706
707
708
709
710
692
693
694
695
696
697
698
699
700
701
702
703
711704
712705
713706
714707
715708
716
709
710
717711
718712
719713
720714
721
722
723
724
725
715
716
717
718
719
726720
727721
728722
......
734728
735729
736730
737
731
738732
739733
740734
......
752746
753747
754748
755
756
757
758
759
749
750
751
752
753
760754
761755
762756
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
785779
* Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights
* Reserved. This file contains Original Code and/or Modifications of
* Original Code as defined in and that are subject to the Apple Public
* Source License Version 2.0 (the "License"). You may not use this file
* Source License Version 2.0 (the "License").You may not use this file
* except in compliance with the License. Please obtain a copy of the
* License at http://www.apple.com/publicsource and read it before using
* this file.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*
* Mach Operating System
* Copyright (c) 1990 Carnegie-Mellon University
* Copyright (c) 1989 Carnegie-Mellon University
* All rights reserved. The CMU software License Agreement specifies
* All rights reserved. The CMU software License Agreement specifies
* the terms and conditions for use and redistribution.
*/
/*
* INTEL CORPORATION PROPRIETARY INFORMATION
*INTEL CORPORATION PROPRIETARY INFORMATION
*
* This software is supplied under the terms of a license agreement or
* nondisclosure agreement with Intel Corporation and may not be copied
* nor disclosed except in accordance with the terms of that agreement.
*This software is supplied under the terms of a licenseagreement or
*nondisclosure agreement with Intel Corporation and may not be copied
*nor disclosed except in accordance with the terms of that agreement.
*
* Copyright 1988, 1989 by Intel Corporation
*Copyright 1988, 1989 by Intel Corporation
*/
/*
* Reworked again by Curtis Galloway (galloway@NeXT.com)
*/
#include "boot.h"
#include "bootstruct.h"
#include "fake_efi.h"
#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;
int bvCount = 0;
//intmenucount = 0;
int gDeviceCount = 0;
BVRef bvr;
BVRef menuBVR;
BVRef bvChain;
bool useGUI;
//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", (unsigned)addr, (unsigned)size, file, line);
stop("\nMemory allocation error! Addr: 0x%x, Size: 0x%x, File: %s, Line: %d\n",
(unsigned)addr, (unsigned)size, file, line);
}
//==========================================================================
//Initializes the runtime. Right now this means zeroing the BSS and initializing malloc.
//Initializes the runtime. Right now this means zeroing the BSS and initializing malloc.
//
void initialize_runtime(void)
{
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);
// Notify modules that the kernel has been decoded
execute_hook("DecodedKernel", (void*)binary, NULL, NULL, NULL);
setupFakeEfi();
setupFakeEfi();
// Load boot drivers from the specifed root path.
//if (!gHaveKernelCache)
LoadDrivers("/");
//if (!gHaveKernelCache)
LoadDrivers("/");
execute_hook("DriversLoaded", (void*)binary, NULL, NULL, NULL);
execute_hook("DriversLoaded", (void*)binary, NULL, NULL, NULL);
clearActivityIndicator();
if (gErrors) {
printf("Pausing %d seconds...\n", kBootErrorTimeout);
sleep(kBootErrorTimeout);
}
md0Ramdisk();
verbose("Starting Darwin %s\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64");
usb_loop();
if (checkOSVersion("10.7"))
{
execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL);// Notify modules that the kernel is about to be started
}
else
{
execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgsPreLion, NULL, NULL);// Notify modules that the kernel is about to be started
}
// Notify modules that the kernel is about to be started
if (checkOSVersion("10.7"))
{
execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL);
}
else
{
execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgsPreLion, NULL, NULL);
}
// If we were in text mode, switch to graphics mode.
// This will draw the boot graphics unless we are in
// verbose mode.
if(gVerboseMode)
setVideoMode( GRAPHICS_MODE, 0 );
if (gVerboseMode)
setVideoMode( GRAPHICS_MODE, 0 );
else
drawBootGraphics();
drawBootGraphics();
setupBooterLog();
finalizeBootStruct();
if (checkOSVersion("10.7")) {
// Jump to kernel's entry point. There's no going back now.
if (checkOSVersion("10.7")) {
// Masking out so that Lion doesn't doublefault
// Jump to kernel's entry point. There's no going back now.
startprog( kernelEntry, bootArgs );
}
else {
// Jump to kernel's entry point. There's no going back now.
startprog( kernelEntry, bootArgsPreLion );
}
// from a block device, or by the network booter.
//
// arguments:
// biosdev - Value passed from boot1/NBP to specify the device
// that the booter was loaded from.
// biosdev - Value passed from boot1/NBP to specify the device
// that the booter was loaded from.
//
// If biosdev is kBIOSDevNetwork, then this function will return if
// booting was unsuccessful. This allows the PXE firmware to try the
// next boot device on its list.
void common_boot(int biosdev)
{
int status;
char *bootFile;
unsigned long adler32;
bool quiet;
bool firstRun = true;
bool instantMenu;
bool rescanPrompt;
unsigned int allowBVFlags = kBVFlagSystemVolume | kBVFlagForeignBoot;
unsigned int denyBVFlags = kBVFlagEFISystem;
// Set reminder to unload the PXE base code. Neglect to unload
// the base code will result in a hang or kernel panic.
gUnloadPXEOnExit = true;
// Record the device that the booter was loaded from.
gBIOSDev = biosdev & kBIOSDevMask;
// Initialize boot info structure.
initKernBootStruct();
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.
gUnloadPXEOnExit = true;
// Record the device that the booter was loaded from.
gBIOSDev = biosdev & kBIOSDevMask;
// Initialize boot info structure.
initKernBootStruct();
initBooterLog();
// Setup VGA text mode.
// Not sure if it is safe to call setVideoMode() before the
// config table has been loaded. Call video_mode() instead.
// Setup VGA text mode.
// Not sure if it is safe to call setVideoMode() before the
// config table has been loaded. Call video_mode() instead.
#if DEBUG
printf("before video_mode\n");
printf("before video_mode\n");
#endif
video_mode( 2 ); // 80x25 mono text mode.
video_mode( 2 ); // 80x25 mono text mode.
#if DEBUG
printf("after video_mode\n");
printf("after video_mode\n");
#endif
// Scan and record the system's hardware information.
scan_platform();
// First get info for boot volume.
scanBootVolumes(gBIOSDev, 0);
bvChain = getBVChainForBIOSDev(gBIOSDev);
setBootGlobals(bvChain);
// Load boot.plist config file
status = loadChameleonConfig(&bootInfo->chameleonConfig);
if (getBoolForKey(kQuietBootKey, &quiet, &bootInfo->chameleonConfig) && quiet) {
gBootMode |= kBootModeQuiet;
}
// Override firstRun to get to the boot menu instantly by setting "Instant Menu"=y in system config
if (getBoolForKey(kInsantMenuKey, &instantMenu, &bootInfo->chameleonConfig) && instantMenu) {
firstRun = false;
}
// Loading preboot ramdisk if exists.
loadPrebootRAMDisk();
// Disable rescan option by default
gEnableCDROMRescan = false;
// Enable it with Rescan=y in system config
if (getBoolForKey(kRescanKey, &gEnableCDROMRescan, &bootInfo->chameleonConfig) && gEnableCDROMRescan) {
gEnableCDROMRescan = true;
}
// Ask the user for Rescan option by setting "Rescan Prompt"=y in system config.
rescanPrompt = false;
if (getBoolForKey(kRescanPromptKey, &rescanPrompt , &bootInfo->chameleonConfig) && rescanPrompt && biosDevIsCDROM(gBIOSDev)) {
gEnableCDROMRescan = promptForRescanOption();
}
// Enable touching a single BIOS device only if "Scan Single Drive"=y is set in system config.
if (getBoolForKey(kScanSingleDriveKey, &gScanSingleDrive, &bootInfo->chameleonConfig) && gScanSingleDrive) {
gScanSingleDrive = true;
}
// Create a list of partitions on device(s).
if (gScanSingleDrive) {
scanBootVolumes(gBIOSDev, &bvCount);
} else {
scanDisks(gBIOSDev, &bvCount);
}
// Create a separated bvr chain using the specified filters.
bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount);
gBootVolume = selectBootVolume(bvChain);
// Scan and record the system's hardware information.
scan_platform();
// First get info for boot volume.
scanBootVolumes(gBIOSDev, 0);
bvChain = getBVChainForBIOSDev(gBIOSDev);
setBootGlobals(bvChain);
// Load boot.plist config file
status = loadChameleonConfig(&bootInfo->chameleonConfig);
if (getBoolForKey(kQuietBootKey, &quiet, &bootInfo->chameleonConfig) && quiet) {
gBootMode |= kBootModeQuiet;
}
// Override firstRun to get to the boot menu instantly by setting "Instant Menu"=y in system config
if (getBoolForKey(kInstantMenuKey, &instantMenu, &bootInfo->chameleonConfig) && instantMenu) {
firstRun = false;
}
// Loading preboot ramdisk if exists.
loadPrebootRAMDisk();
// Disable rescan option by default
gEnableCDROMRescan = false;
// Enable it with Rescan=y in system config
if (getBoolForKey(kRescanKey, &gEnableCDROMRescan, &bootInfo->chameleonConfig)
&& gEnableCDROMRescan) {
gEnableCDROMRescan = true;
}
// Ask the user for Rescan option by setting "Rescan Prompt"=y in system config.
rescanPrompt = false;
if (getBoolForKey(kRescanPromptKey, &rescanPrompt , &bootInfo->chameleonConfig)
&& rescanPrompt && biosDevIsCDROM(gBIOSDev))
{
gEnableCDROMRescan = promptForRescanOption();
}
// Enable touching a single BIOS device only if "Scan Single Drive"=y is set in system config.
if (getBoolForKey(kScanSingleDriveKey, &gScanSingleDrive, &bootInfo->chameleonConfig)
&& gScanSingleDrive) {
gScanSingleDrive = true;
}
// Create a list of partitions on device(s).
if (gScanSingleDrive) {
scanBootVolumes(gBIOSDev, &bvCount);
} else {
scanDisks(gBIOSDev, &bvCount);
}
// Create a separated bvr chain using the specified filters.
bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount);
gBootVolume = selectBootVolume(bvChain);
// Intialize module system
init_module_system();
#if DEBUG
printf(" Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags);
printf(" bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags);
getchar();
printf(" Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n",
gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags);
printf(" bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n",
gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags);
getchar();
#endif
useGUI = true;
// initGUI() returned with an error, disabling GUI.
useGUI = false;
}
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;
// additional variable for testing alternate kernel image locations on boot helper partitions.
char bootFileSpec[512];
setBootGlobals(bvChain);
// Parse args, load and start kernel.
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;
// Initialize globals.
sysConfigValid = false;
gErrors = false;
status = getBootOptions(firstRun);
firstRun = false;
if (status == -1) continue;
// additional variable for testing alternate kernel image locations on boot helper partitions.
charbootFileSpec[512];
status = processBootOptions();
// 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
if ( status == -1 )
{
// gBootVolume == NULL usually means the user hit escape.
if(gBootVolume == NULL)
{
freeFilteredBVChain(bvChain);
if (gEnableCDROMRescan)
rescanBIOSDevice(gBIOSDev);
bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount);
setBootGlobals(bvChain);
setupDeviceList(&bootInfo->themeConfig);
}
continue;
}
// Initialize globals.
sysConfigValid = false;
gErrors = false;
// Other status (e.g. 0) means that we should proceed with boot.
status = getBootOptions(firstRun);
firstRun = false;
if (status == -1) continue;
status = processBootOptions();
// 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
if ( status == -1 )
{
// gBootVolume == NULL usually means the user hit escape.
if (gBootVolume == NULL)
{
freeFilteredBVChain(bvChain);
if (gEnableCDROMRescan)
rescanBIOSDevice(gBIOSDev);
bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount);
setBootGlobals(bvChain);
setupDeviceList(&bootInfo->themeConfig);
}
continue;
}
// Other status (e.g. 0) means that we should proceed with boot.
// Turn off any GUI elements
if( bootArgs->Video.v_display == GRAPHICS_MODE )
if ( bootArgs->Video.v_display == GRAPHICS_MODE )
{
gui.devicelist.draw = false;
gui.bootprompt.draw = false;
archCpuType = CPU_TYPE_I386;
}
}
if (getValueForKey(kKernelArchKey, &val, &len, &bootInfo->chameleonConfig)) {
if (getValueForKey(kKernelArchKey, &val, &len, &bootInfo->chameleonConfig)) {
if (strncmp(val, "i386", 4) == 0) {
archCpuType = CPU_TYPE_I386;
}
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);
break;
if (!forceresume && ((sleeptime+3)<bvr->modTime)) {
#if DEBUG
printf ("Hibernate image is too old by %d seconds. Use ForceWake=y to override\n",bvr->modTime-sleeptime);
#endif
#if DEBUG
printf ("Hibernate image is too old by %d seconds. Use ForceWake=y to override\n",
bvr->modTime-sleeptime);
#endif
break;
}
HibernateBoot((char *)val);
break;
}
getBoolForKey(kUseKernelCache, &usecache, &bootInfo->chameleonConfig);
if(usecache) {
if (usecache) {
if (getValueForKey(kKernelCacheKey, &val, &len, &bootInfo->bootConfig)) {
if(val[0] == '\\')
{
len--;
val++;
}
strlcpy(gBootKernelCacheFile, val, len+1);
if (val[0] == '\\')
{
len--;
val++;
}
strlcpy(gBootKernelCacheFile, val, len + 1);
}
else {
//Lion
}
// Snow Leopard
else if (checkOSVersion("10.6")) {
sprintf(gBootKernelCacheFile, "kernelcache_%s", (archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64");
sprintf(gBootKernelCacheFile, "kernelcache_%s", (archCpuType == CPU_TYPE_I386)
? "i386" : "x86_64");
int lnam = sizeof(gBootKernelCacheFile) + 9; //with adler32
//Slice - TODO ???
// e.g. kernelcache_i386.E102928C.qSs0 = "unsaved" cache file.
//
// See kext_tools-180.2.1/kextcache_main.c:
// "Source directory has changed since starting; "
// "not saving cache file %s."
// or
// "Source kernel has changed since starting; "
// "not saving cache file %s."
char* name;
long prev_time = 0;
while(readdir(cacheDir, (const char**)&name, &flags, &time) >= 0)
{
if(((flags & kFileTypeMask) != kFileTypeDirectory) && time > prev_time && strstr(name, gBootKernelCacheFile) && (name[lnam] != '.'))
if (((flags & kFileTypeMask) != kFileTypeDirectory) && time > prev_time
&& strstr(name, gBootKernelCacheFile) && (name[lnam] != '.'))
{
sprintf(gBootKernelCacheFile, "%s%s", kDefaultCachePathSnow, name);
prev_time = time;
}
}
}
// Check for cache file.
trycache = (usecache &&
// Check for cache file.
trycache = (usecache &&
((gBootMode & kBootModeSafe) == 0) &&
!gOverrideKernel &&
(gBootFileType == kBlockDeviceType) &&
(gMKextName[0] == '\0') &&
(gBootKernelCacheFile[0] != '\0'));
!gOverrideKernel &&
(gBootFileType == kBlockDeviceType) &&
(gMKextName[0] == '\0') &&
(gBootKernelCacheFile[0] != '\0'));
verbose("Loading Darwin %s\n", gMacOSVersion);
if (trycache) do {
ret = GetFileInfo(NULL, bootInfo->bootFile, &flags, &kerneltime);
if(ret != 0) kerneltime = 0;
else if ((flags & kFileTypeMask) != kFileTypeFlat) {
trycache = 0;
break;
}
if (trycache) do {
ret = GetFileInfo(NULL, bootInfo->bootFile, &flags, &kerneltime);
if (ret != 0) kerneltime = 0;
else if ((flags & kFileTypeMask) != kFileTypeFlat) {
trycache = 0;
break;
}
ret = GetFileInfo(NULL, gBootKernelCacheFile, &flags, &cachetime);
if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat)
|| (cachetime < kerneltime)) {
trycache = 0;
break;
}
ret = GetFileInfo("/System/Library/", "Extensions", &flags, &exttime);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)
&& (cachetime < exttime)) {
trycache = 0;
break;
}
if (ret == 0 && kerneltime > exttime) {
exttime = kerneltime;
}
if (ret == 0 && cachetime != (exttime + 1)) {
trycache = 0;
break;
}
} while (0);
ret = GetFileInfo(NULL, gBootKernelCacheFile, &flags, &cachetime);
if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat)
|| (cachetime < kerneltime)) {
trycache = 0;
break;
}
ret = GetFileInfo("/System/Library/", "Extensions", &flags, &exttime);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)
&& (cachetime < exttime)) {
trycache = 0;
break;
}
if (ret == 0 && kerneltime > exttime) {
exttime = kerneltime;
}
if (ret == 0 && cachetime != (exttime + 1)) {
trycache = 0;
break;
}
} while (0);
do {
if (trycache) {
bootFile = gBootKernelCacheFile;
do {
if (trycache) {
bootFile = gBootKernelCacheFile;
verbose("Loading kernel cache %s\n", bootFile);
if (checkOSVersion("10.7")) {
ret = LoadThinFatFile(bootFile, &binary);
if (checkOSVersion("10.7")) {
ret = LoadThinFatFile(bootFile, &binary);
}
else {
ret = LoadFile(bootFile);
ret = LoadFile(bootFile);
binary = (void *)kLoadAddr;
}
if (ret >= 0)
break;
if (ret >= 0)
break;
verbose("Kernel cache did not load %s\n ", bootFile);
}
if (checkOSVersion("10.7")) {
bootFile = gBootKernelCacheFile;
}
else {
sprintf(bootFile, "\%s", bootInfo->bootFile);
}
// Try to load kernel image from alternate locations on boot helper partitions.
sprintf(bootFileSpec, "com.apple.boot.P%s", bootFile);
ret = GetFileInfo(NULL, bootFileSpec, &flags, &time);
if (ret == -1)
{
sprintf(bootFileSpec, "com.apple.boot.R%s", bootFile);
ret = GetFileInfo(NULL, bootFileSpec, &flags, &time);
if (ret == -1)
{
sprintf(bootFileSpec, "com.apple.boot.S%s", bootFile);
ret = GetFileInfo(NULL, bootFileSpec, &flags, &time);
if (ret == -1)
{
// No alternate location found, using the original kernel image path.
strcpy(bootFileSpec, bootInfo->bootFile);
}
}
}
if (checkOSVersion("10.7"))
{
//Lion, dont load kernel if haz cache
if (!trycache)
{
verbose("Loading kernel %s\n", bootFileSpec);
ret = LoadThinFatFile(bootFileSpec, &binary);
if (ret <= 0 && archCpuType == CPU_TYPE_X86_64)
{
archCpuType = CPU_TYPE_I386;
ret = LoadThinFatFile(bootFileSpec, &binary);
}
}
}
if (checkOSVersion("10.7")) {
bootFile = gBootKernelCacheFile;
}
else {
sprintf(bootFile, "\%s", bootInfo->bootFile);
}
// Try to load kernel image from alternate locations on boot helper partitions.
sprintf(bootFileSpec, "com.apple.boot.P%s", bootFile);
ret = GetFileInfo(NULL, bootFileSpec, &flags, &time);
if (ret == -1)
{
sprintf(bootFileSpec, "com.apple.boot.R%s", bootFile);
ret = GetFileInfo(NULL, bootFileSpec, &flags, &time);
if (ret == -1)
{
sprintf(bootFileSpec, "com.apple.boot.S%s", bootFile);
ret = GetFileInfo(NULL, bootFileSpec, &flags, &time);
if (ret == -1)
{
// No alternate location found, using the original kernel image path.
strcpy(bootFileSpec, bootInfo->bootFile);
}
}
}
if (checkOSVersion("10.7"))
{
//Lion, dont load kernel if haz cache
if (!trycache)
{
verbose("Loading kernel %s\n", bootFileSpec);
ret = LoadThinFatFile(bootFileSpec, &binary);
if (ret <= 0 && archCpuType == CPU_TYPE_X86_64)
{
archCpuType = CPU_TYPE_I386;
ret = LoadThinFatFile(bootFileSpec, &binary);
}
}
else ret = 1;
}
}
else
{
//Snow Leopard or older
verbose("Loading kernel %s\n", bootFileSpec);
ret = LoadThinFatFile(bootFileSpec, &binary);
if (ret <= 0 && archCpuType == CPU_TYPE_X86_64)
{
archCpuType = CPU_TYPE_I386;
ret = LoadThinFatFile(bootFileSpec, &binary);
}
}
} while (0);
clearActivityIndicator();
{
//Snow Leopard or older
verbose("Loading kernel %s\n", bootFileSpec);
ret = LoadThinFatFile(bootFileSpec, &binary);
if (ret <= 0 && archCpuType == CPU_TYPE_X86_64)
{
archCpuType = CPU_TYPE_I386;
ret = LoadThinFatFile(bootFileSpec, &binary);
}
}
} while (0);
clearActivityIndicator();
#if DEBUG
printf("Pausing...");
sleep(8);
printf("Pausing...");
sleep(8);
#endif
if (ret <= 0) {
if (ret <= 0) {
printf("Can't find %s\n", bootFile);
sleep(1);
if (gBootFileType == kNetworkDeviceType) {
// Return control back to PXE. Don't unload PXE base code.
gUnloadPXEOnExit = false;
break;
}
} else {
/* Won't return if successful. */
ret = ExecKernel(binary);
}
}
// chainboot
if (status==1) {
if (getVideoMode() == GRAPHICS_MODE) {// if we are already in graphics-mode,
setVideoMode(VGA_TEXT_MODE, 0);// switch back to text mode
if (gBootFileType == kNetworkDeviceType) {
// Return control back to PXE. Don't unload PXE base code.
gUnloadPXEOnExit = false;
break;
}
} else {
/* Won't return if successful. */
ret = ExecKernel(binary);
}
}
}
if ((gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit) {
// chainboot
if (status == 1) {
// if we are already in graphics-mode,
if (getVideoMode() == GRAPHICS_MODE) {
setVideoMode(VGA_TEXT_MODE, 0); // switch back to text mode.
}
}
if ((gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit) {
nbpUnloadBaseCode();
}
}
}
/*!
Selects a new BIOS device, taking care to update the global state appropriately.
Selects a new BIOS device, taking care to update the global state appropriately.
*/
/*
static void selectBiosDevice(void)
{
struct DiskBVMap *oldMap = diskResetBootVolumes(gBIOSDev);
CacheReset();
diskFreeMap(oldMap);
oldMap = NULL;
int dev = selectAlternateBootDevice(gBIOSDev);
BVRef bvchain = scanBootVolumes(dev, 0);
BVRef bootVol = selectBootVolume(bvchain);
gBootVolume = bootVol;
setRootVolume(bootVol);
gBIOSDev = dev;
struct DiskBVMap *oldMap = diskResetBootVolumes(gBIOSDev);
CacheReset();
diskFreeMap(oldMap);
oldMap = NULL;
int dev = selectAlternateBootDevice(gBIOSDev);
BVRef bvchain = scanBootVolumes(dev, 0);
BVRef bootVol = selectBootVolume(bvchain);
gBootVolume = bootVol;
setRootVolume(bootVol);
gBIOSDev = dev;
}
*/
bool checkOSVersion(const char * version)
{
return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1]) && (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3]));
return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1])
&& (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3]));
}
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))
{
valid = true;
if (valid)
{
if (getValueForKey(kProductVersion, &val, &len, &systemVersion))
if(getValueForKey(kProductVersion, &val, &len, &systemVersion))
{
// getValueForKey uses const char for val
// so copy it and trim
#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)
{
unsigned long s1 = 1; // adler & 0xffff;
unsigned long s2 = 0; // (adler >> 16) & 0xffff;
unsigned long result;
int k;
while (len > 0) {
k = len < NMAX ? len : NMAX;
len -= k;
while (k >= 16) {
DO16(buf);
buf += 16;
k -= 16;
}
if (k != 0) do {
s1 += *buf++;
s2 += s1;
} while (--k);
s1 %= BASE;
s2 %= BASE;
}
result = (s2 << 16) | s1;
return OSSwapHostToBigInt32(result);
unsigned long s1 = 1; // adler & 0xffff;
unsigned long s2 = 0; // (adler >> 16) & 0xffff;
unsigned long result;
int k;
while (len > 0) {
k = len < NMAX ? len : NMAX;
len -= k;
while (k >= 16) {
DO16(buf);
buf += 16;
k -= 16;
}
if (k != 0) do {
s1 += *buf++;
s2 += s1;
} while (--k);
s1 %= BASE;
s2 %= BASE;
}
result = (s2 << 16) | s1;
return OSSwapHostToBigInt32(result);
}
branches/ErmaC/i386/boot2/boot.h
6868
6969
7070
71
71
7272
7373
7474
#define kRescanPromptKey"Rescan Prompt"
#define kRescanKey "Rescan"
#define kScanSingleDriveKey"Scan Single Drive"
#define kInsantMenuKey"Instant Menu"
#define kInstantMenuKey"Instant Menu"
#define kDefaultKernel"mach_kernel"
#define kGUIKey"GUI"
#define kBootBannerKey"Boot Banner"
branches/ErmaC/i386/boot2/gui.c
887887
888888
889889
890
890
891891
892892
893
894893
895894
896895
897896
897
898898
899899
900900
......
927927
928928
929929
930
930
931931
932932
933933
934
934
935935
936936
937937
infoMenuSelection = 0;
}
if(gui.menu.draw)
if (gui.menu.draw)
drawInfoMenuItems();
//Azi: make this info more accessible.
getBoolForKey(kShowInfoKey, &shoWinfo, &bootInfo->chameleonConfig);
if (shoWinfo && showBootBanner) // no boot banner, no showinfo.
{
// keep formatted with spaces instead of tabs
gui.debug.cursor = pos( 10, 100);
dprintf( &gui.screen, "label: %s\n", param->label );
dprintf( &gui.screen, "biosdev: 0x%x\n", param->biosdev );
}
// draw prev indicator
if(start)
if (start)
blend( images[iDeviceScrollPrev].image, gui.devicelist.pixmap, centeredAt( images[iDeviceScrollPrev].image, p_prev ) );
// draw next indicator
if( end < gDeviceCount - 1 )
if ( end < gDeviceCount - 1 )
blend( images[iDeviceScrollNext].image, gui.devicelist.pixmap, centeredAt( images[iDeviceScrollNext].image, p_next ) );
gui.redraw = true;
branches/ErmaC/package/Resources/Bosnian.lproj/Description.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1138">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px 'Lucida Grande'}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px 'Lucida Grande'; min-height: 13.0px}
span.s1 {text-decoration: underline ; color: #0000ee}
</style>
</head>
<body>
<p class="p1">Chameleon je kombinacija različitih komponenti bootloadera.</p>
<p class="p1">On se temelji na David Elliottovoj lažnoj EFI implementaciji dodanoj na Apple boot-132 projektu.</p>
<p class="p1">Chameleon je proširen sa slijedećim ključnim značenjima:</p>
<p class="p2"><br></p>
<p class="p1">Nove funkcije u Chameleon 2.0</p>
<p class="p2"><br></p>
<p class="p1">- Potpuno prilagođen grafički korisinički interfejs donosi neke boje u Darwin Bootloaderu.</p>
<p class="p1">- Start sa retail DVD-om direktno učitava ramdisk slike bez pomoći dodatnih programa.</p>
<p class="p1">- Hibernacija. Uživajte u nastavaku rada vašeg Mac OS X-a sa pregledom slike.</p>
<p class="p1">- SMBIOS zamijena tvorničkih za modifikovanu SMBIOS vrijednost.</p>
<p class="p1">- DSDT zamijena za korištenje modifikovanog, ispravljenog DSDT-a koji može riješiti nekoliko problema.</p>
<p class="p3"><br></p>
<p class="p1">- Implementacija svojstva uređaja putem svojstva niza.</p>
<p class="p1">- hibridni boot0 / boot1h za MBR i GPT particionirane diskove.</p>
<p class="p1">- automatsko FSB kodno otkrivanje čak i za posljednje AMD procesore.<span class="Apple-converted-space"> </span></p>
<p class="p1">- Apple softver RAID podrška.</p>
<p class="p2"><br></p>
<p class="p1">Za detaljne informacije posjetite: <a href="http://chameleon.osx86.hu/"><span class="s1">http://chameleon.osx86.hu</span></a></p>
</body>
</html>
branches/ErmaC/package/Resources/Bosnian.lproj/Welcome.rtfd/TXT.rtf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360
{\fonttbl\f0\fnil\fcharset0 LucidaGrande;}
{\colortbl;\red255\green255\blue255;\red65\green78\blue255;\red0\green0\blue255;}
\margl1440\margr1440\vieww11660\viewh12980\viewkind0
\pard\ri0\qc
\f0\b\fs72 \cf0 Chameleon
\fs50 \
\fs26 v%CHAMELEONVERSION% r%CHAMELEONREVISION%
\fs50 \
\pard\ri0\ql\qnatural
\fs26 \cf0 \
\pard\ri0\qc
\fs50 \cf2 %CHAMELEONSTAGE%
\fs26 \cf0 \
\pard\ri0\ql\qnatural
\cf0 \
Programeri :%DEVELOP%\
\
Hvala : %CREDITS%\
\pard\tx360\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\b0\fs30 \cf0 \
\pard\ri0\ql\qnatural
\b\fs26 \cf0 Pkg : %PKGDEV%
\b0\fs30 \
\pard\tx360\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\cf0 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
\fs26 \cf0 Copyright \'a9 2011
\b \cf3 Bosnian translation: mlstudio}
branches/ErmaC/package/Resources/Bosnian.lproj/Conclusion.rtfd/TXT.rtf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fnil\fcharset0 LucidaGrande;}
{\colortbl;\red255\green255\blue255;\red65\green78\blue255;\red255\green0\blue0;}
\margl1440\margr1440\vieww11660\viewh12980\viewkind0
\pard\ri0\qc
\f0\b\fs72 \cf0 Chameleon
\fs50 \
\fs26 v%CHAMELEONVERSION% r%CHAMELEONREVISION%
\fs50 \
\
\cf2 %CHAMELEONSTAGE%\cf0 \
\pard\ri0\ql\qnatural
\fs26 \cf0 \
\pard\ri0\qc
\fs50 \cf3 Instalacija Kompletna!
\b0\fs26 \cf0 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
\fs18 \cf0 \
{\field{\*\fldinst{HYPERLINK "http://chameleon.osx86.hu/"}}{\fldrslt
\fs26 http://chameleon.osx86.hu/}}
\fs26 \
{\field{\*\fldinst{HYPERLINK "http://forum.voodooprojects.org/index.php"}}{\fldrslt http://forum.voodooprojects.org/index.php}}
\b \
\pard\tx360\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\b0\fs30 \cf0 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
\fs26 \cf0 Copyright \'a9 2011}
branches/ErmaC/package/Resources/Bosnian.lproj/License.rtf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fmodern\fcharset0 Courier-Bold;\f1\fmodern\fcharset0 Courier;}
{\colortbl;\red255\green255\blue255;}
\paperw12240\paperh15840\vieww22060\viewh18360\viewkind0
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
\f0\b\fs40 \cf0 APPLE PUBLIC SOURCE LICENSE \
\fs26 Version 2.0 - August 6, 2003\
\
\f1\b0 Please read this License carefully before downloading this software. By downloading or using this software, you are agreeing to be bound by the terms of this License. If you do not or cannot agree to the terms of this License, please do not download or use the software.\
\
1. General; Definitions. This License applies to any program or other work which Apple Computer, Inc. ("Apple") makes publicly available and which contains a notice placed by Apple identifying such program or work as "Original Code" and stating that it is subject to the terms of this Apple Public Source License version 2.0 ("License"). As used in this License:\
\
1.1 "Applicable Patent Rights" mean: (a) in the case where Apple is the grantor of rights, (i) claims of patents that are now or hereafter acquired, owned by or assigned to Apple and (ii) that cover subject matter contained in the Original Code, but only to the extent necessary to use, reproduce and/or distribute the Original Code without infringement; and (b) in the case where You are the grantor of rights, (i) claims of patents that are now or hereafter acquired, owned by or assigned to You and (ii) that cover subject matter in Your Modifications, taken alone or in combination with Original Code.\
\
1.2 "Contributor" means any person or entity that creates or contributes to the creation of Modifications.\
\
1.3 "Covered Code" means the Original Code, Modifications, the combination of Original Code and any Modifications, and/or any respective portions thereof.\
\
1.4 "Externally Deploy" means: (a) to sublicense, distribute or otherwise make Covered Code available, directly or indirectly, to anyone other than You; and/or (b) to use Covered Code, alone or as part of a Larger Work, in any way to provide a service, including but not limited to delivery of content, through electronic communication with a client other than You.\
\
1.5 "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License.\
\
1.6 "Modifications" mean any addition to, deletion from, and/or change\
to, the substance and/or structure of the Original Code, any previous\
Modifications, the combination of Original Code and any previous\
Modifications, and/or any respective portions thereof. When code is\
released as a series of files, a Modification is: (a) any addition to\
or deletion from the contents of a file containing Covered Code;\
and/or (b) any new file or other representation of computer program\
statements that contains any part of Covered Code.\
\
1.7 "Original Code" means (a) the Source Code of a program or other\
work as originally made available by Apple under this License,\
including the Source Code of any updates or upgrades to such programs\
or works made available by Apple under this License, and that has been\
expressly identified by Apple as such in the header file(s) of such\
work; and (b) the object code compiled from such Source Code and\
originally made available by Apple under this License.\
\
1.8 "Source Code" means the human readable form of a program or other\
work that is suitable for making modifications to it, including all\
modules it contains, plus any associated interface definition files,\
scripts used to control compilation and installation of an executable\
(object code).\
\
1.9 "You" or "Your" means an individual or a legal entity exercising\
rights under this License. For legal entities, "You" or "Your"\
includes any entity which controls, is controlled by, or is under\
common control with, You, where "control" means (a) the power, direct\
or indirect, to cause the direction or management of such entity,\
whether by contract or otherwise, or (b) ownership of fifty percent\
(50%) or more of the outstanding shares or beneficial ownership of\
such entity.\
\
2. Permitted Uses; Conditions & Restrictions. Subject to the terms\
and conditions of this License, Apple hereby grants You, effective on\
the date You accept this License and download the Original Code, a\
world-wide, royalty-free, non-exclusive license, to the extent of\
Apple's Applicable Patent Rights and copyrights covering the Original\
Code, to do the following:\
\
2.1 Unmodified Code. You may use, reproduce, display, perform,\
internally distribute within Your organization, and Externally Deploy\
verbatim, unmodified copies of the Original Code, for commercial or\
non-commercial purposes, provided that in each instance:\
\
(a) You must retain and reproduce in all copies of Original Code the\
copyright and other proprietary notices and disclaimers of Apple as\
they appear in the Original Code, and keep intact all notices in the\
Original Code that refer to this License; and\
\
(b) You must include a copy of this License with every copy of Source\
Code of Covered Code and documentation You distribute or Externally\
Deploy, and You may not offer or impose any terms on such Source Code\
that alter or restrict this License or the recipients' rights\
hereunder, except as permitted under Section 6.\
\
2.2 Modified Code. You may modify Covered Code and use, reproduce,\
display, perform, internally distribute within Your organization, and\
Externally Deploy Your Modifications and Covered Code, for commercial\
or non-commercial purposes, provided that in each instance You also\
meet all of these conditions:\
\
(a) You must satisfy all the conditions of Section 2.1 with respect to\
the Source Code of the Covered Code;\
\
(b) You must duplicate, to the extent it does not already exist, the\
notice in Exhibit A in each file of the Source Code of all Your\
Modifications, and cause the modified files to carry prominent notices\
stating that You changed the files and the date of any change; and\
\
(c) If You Externally Deploy Your Modifications, You must make\
Source Code of all Your Externally Deployed Modifications either\
available to those to whom You have Externally Deployed Your\
Modifications, or publicly available. Source Code of Your Externally\
Deployed Modifications must be released under the terms set forth in\
this License, including the license grants set forth in Section 3\
below, for as long as you Externally Deploy the Covered Code or twelve\
(12) months from the date of initial External Deployment, whichever is\
longer. You should preferably distribute the Source Code of Your\
Externally Deployed Modifications electronically (e.g. download from a\
web site).\
\
2.3 Distribution of Executable Versions. In addition, if You\
Externally Deploy Covered Code (Original Code and/or Modifications) in\
object code, executable form only, You must include a prominent\
notice, in the code itself as well as in related documentation,\
stating that Source Code of the Covered Code is available under the\
terms of this License with information on how and where to obtain such\
Source Code.\
\
2.4 Third Party Rights. You expressly acknowledge and agree that\
although Apple and each Contributor grants the licenses to their\
respective portions of the Covered Code set forth herein, no\
assurances are provided by Apple or any Contributor that the Covered\
Code does not infringe the patent or other intellectual property\
rights of any other entity. Apple and each Contributor disclaim any\
liability to You for claims brought by any other entity based on\
infringement of intellectual property rights or otherwise. As a\
condition to exercising the rights and licenses granted hereunder, You\
hereby assume sole responsibility to secure any other intellectual\
property rights needed, if any. For example, if a third party patent\
license is required to allow You to distribute the Covered Code, it is\
Your responsibility to acquire that license before distributing the\
Covered Code.\
\
3. Your Grants. In consideration of, and as a condition to, the\
licenses granted to You under this License, You hereby grant to any\
person or entity receiving or distributing Covered Code under this\
License a non-exclusive, royalty-free, perpetual, irrevocable license,\
under Your Applicable Patent Rights and other intellectual property\
rights (other than patent) owned or controlled by You, to use,\
reproduce, display, perform, modify, sublicense, distribute and\
Externally Deploy Your Modifications of the same scope and extent as\
Apple's licenses under Sections 2.1 and 2.2 above.\
\
4. Larger Works. You may create a Larger Work by combining Covered\
Code with other code not governed by the terms of this License and\
distribute the Larger Work as a single product. In each such instance,\
You must make sure the requirements of this License are fulfilled for\
the Covered Code or any portion thereof.\
\
5. Limitations on Patent License. Except as expressly stated in\
Section 2, no other patent rights, express or implied, are granted by\
Apple herein. Modifications and/or Larger Works may require additional\
patent licenses from Apple which Apple may grant in its sole\
discretion.\
\
6. Additional Terms. You may choose to offer, and to charge a fee for,\
warranty, support, indemnity or liability obligations and/or other\
rights consistent with the scope of the license granted herein\
("Additional Terms") to one or more recipients of Covered Code.\
However, You may do so only on Your own behalf and as Your sole\
responsibility, and not on behalf of Apple or any Contributor. You\
must obtain the recipient's agreement that any such Additional Terms\
are offered by You alone, and You hereby agree to indemnify, defend\
and hold Apple and every Contributor harmless for any liability\
incurred by or claims asserted against Apple or such Contributor by\
reason of any such Additional Terms.\
\
7. Versions of the License. Apple may publish revised and/or new\
versions of this License from time to time. Each version will be given\
a distinguishing version number. Once Original Code has been published\
under a particular version of this License, You may continue to use it\
under the terms of that version. You may also choose to use such\
Original Code under the terms of any subsequent version of this\
License published by Apple. No one other than Apple has the right to\
modify the terms applicable to Covered Code created under this\
License.\
\
8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in\
part pre-release, untested, or not fully tested works. The Covered\
Code may contain errors that could cause failures or loss of data, and\
may be incomplete or contain inaccuracies. You expressly acknowledge\
and agree that use of the Covered Code, or any portion thereof, is at\
Your sole and entire risk. THE COVERED CODE IS PROVIDED "AS IS" AND\
WITHOUT WARRANTY, UPGRADES OR SUPPORT OF ANY KIND AND APPLE AND\
APPLE'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS "APPLE" FOR THE\
PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY DISCLAIM\
ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT\
NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF\
MERCHANTABILITY, OF SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR\
PURPOSE, OF ACCURACY, OF QUIET ENJOYMENT, AND NONINFRINGEMENT OF THIRD\
PARTY RIGHTS. APPLE AND EACH CONTRIBUTOR DOES NOT WARRANT AGAINST\
INTERFERENCE WITH YOUR ENJOYMENT OF THE COVERED CODE, THAT THE\
FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR REQUIREMENTS,\
THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR\
ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO\
ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY APPLE, AN APPLE\
AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY.\
You acknowledge that the Covered Code is not intended for use in the\
operation of nuclear facilities, aircraft navigation, communication\
systems, or air traffic control machines in which case the failure of\
the Covered Code could lead to death, personal injury, or severe\
physical or environmental damage.\
\
9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO\
EVENT SHALL APPLE OR ANY CONTRIBUTOR BE LIABLE FOR ANY INCIDENTAL,\
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING\
TO THIS LICENSE OR YOUR USE OR INABILITY TO USE THE COVERED CODE, OR\
ANY PORTION THEREOF, WHETHER UNDER A THEORY OF CONTRACT, WARRANTY,\
TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF\
APPLE OR SUCH CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\
DAMAGES AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY\
REMEDY. SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF\
INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY\
TO YOU. In no event shall Apple's total liability to You for all\
damages (other than as may be required by applicable law) under this\
License exceed the amount of fifty dollars ($50.00).\
\
10. Trademarks. This License does not grant any rights to use the\
trademarks or trade names "Apple", "Apple Computer", "Mac", "Mac OS",\
"QuickTime", "QuickTime Streaming Server" or any other trademarks,\
service marks, logos or trade names belonging to Apple (collectively\
"Apple Marks") or to any trademark, service mark, logo or trade name\
belonging to any Contributor. You agree not to use any Apple Marks in\
or as part of the name of products derived from the Original Code or\
to endorse or promote products derived from the Original Code other\
than as expressly permitted by and in strict compliance at all times\
with Apple's third party trademark usage guidelines which are posted\
at http://www.apple.com/legal/guidelinesfor3rdparties.html.\
\
11. Ownership. Subject to the licenses granted under this License,\
each Contributor retains all rights, title and interest in and to any\
Modifications made by such Contributor. Apple retains all rights,\
title and interest in and to the Original Code and any Modifications\
made by or on behalf of Apple ("Apple Modifications"), and such Apple\
Modifications will not be automatically subject to this License. Apple\
may, at its sole discretion, choose to license such Apple\
Modifications under this License, or on different terms from those\
contained in this License or may choose not to license them at all.\
\
12. Termination.\
\
12.1 Termination. This License and the rights granted hereunder will\
terminate:\
\
(a) automatically without notice from Apple if You fail to comply with\
any term(s) of this License and fail to cure such breach within 30\
days of becoming aware of such breach;\
\
(b) immediately in the event of the circumstances described in Section\
13.5(b); or\
\
(c) automatically without notice from Apple if You, at any time during\
the term of this License, commence an action for patent infringement\
against Apple; provided that Apple did not first commence\
an action for patent infringement against You in that instance.\
\
12.2 Effect of Termination. Upon termination, You agree to immediately\
stop any further use, reproduction, modification, sublicensing and\
distribution of the Covered Code. All sublicenses to the Covered Code\
which have been properly granted prior to termination shall survive\
any termination of this License. Provisions which, by their nature,\
should remain in effect beyond the termination of this License shall\
survive, including but not limited to Sections 3, 5, 8, 9, 10, 11,\
12.2 and 13. No party will be liable to any other for compensation,\
indemnity or damages of any sort solely as a result of terminating\
this License in accordance with its terms, and termination of this\
License will be without prejudice to any other right or remedy of\
any party.\
\
13. Miscellaneous.\
\
13.1 Government End Users. The Covered Code is a "commercial item" as\
defined in FAR 2.101. Government software and technical data rights in\
the Covered Code include only those rights customarily provided to the\
public as defined in this License. This customary commercial license\
in technical data and software is provided in accordance with FAR\
12.211 (Technical Data) and 12.212 (Computer Software) and, for\
Department of Defense purchases, DFAR 252.227-7015 (Technical Data --\
Commercial Items) and 227.7202-3 (Rights in Commercial Computer\
Software or Computer Software Documentation). Accordingly, all U.S.\
Government End Users acquire Covered Code with only those rights set\
forth herein.\
\
13.2 Relationship of Parties. This License will not be construed as\
creating an agency, partnership, joint venture or any other form of\
legal association between or among You, Apple or any Contributor, and\
You will not represent to the contrary, whether expressly, by\
implication, appearance or otherwise.\
\
13.3 Independent Development. Nothing in this License will impair\
Apple's right to acquire, license, develop, have others develop for\
it, market and/or distribute technology or products that perform the\
same or similar functions as, or otherwise compete with,\
Modifications, Larger Works, technology or products that You may\
develop, produce, market or distribute.\
\
13.4 Waiver; Construction. Failure by Apple or any Contributor to\
enforce any provision of this License will not be deemed a waiver of\
future enforcement of that or any other provision. Any law or\
regulation which provides that the language of a contract shall be\
construed against the drafter will not apply to this License.\
\
13.5 Severability. (a) If for any reason a court of competent\
jurisdiction finds any provision of this License, or portion thereof,\
to be unenforceable, that provision of the License will be enforced to\
the maximum extent permissible so as to effect the economic benefits\
and intent of the parties, and the remainder of this License will\
continue in full force and effect. (b) Notwithstanding the foregoing,\
if applicable law prohibits or restricts You from fully and/or\
specifically complying with Sections 2 and/or 3 or prevents the\
enforceability of either of those Sections, this License will\
immediately terminate and You must immediately discontinue any use of\
the Covered Code and destroy all copies of it that are in your\
possession or control.\
\
13.6 Dispute Resolution. Any litigation or other dispute resolution\
between You and Apple relating to this License shall take place in the\
Northern District of California, and You and Apple hereby consent to\
the personal jurisdiction of, and venue in, the state and federal\
courts within that District with respect to this License. The\
application of the United Nations Convention on Contracts for the\
International Sale of Goods is expressly excluded.\
\
13.7 Entire Agreement; Governing Law. This License constitutes the\
entire agreement between the parties with respect to the subject\
matter hereof. This License shall be governed by the laws of the\
United States and the State of California, except that body of\
California law concerning conflicts of law.\
\
Where You are located in the province of Quebec, Canada, the following\
clause applies: The parties hereby confirm that they have requested\
that this License and all related documents be drafted in English. Les\
parties ont exige que le present contrat et tous les documents\
connexes soient rediges en anglais.\
\
EXHIBIT A.\
\
"Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights\
Reserved.\
\
This file contains Original Code and/or Modifications of Original Code\
as defined in and that are subject to the Apple Public Source License\
Version 2.0 (the 'License'). You may not use this file except in\
compliance with the License. Please obtain a copy of the License at\
http://www.opensource.apple.com/apsl/ and read it before using this\
file.\
\
The Original Code and all software distributed under the License are\
distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER\
EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,\
INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,\
FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.\
Please see the License for the specific language governing rights and\
limitations under the License." }
branches/ErmaC/package/buildpkg.sh
2727
2828
2929
30
30
3131
32
32
3333
34
34
3535
3636
3737
# =================
develop=" Crazor, Dense, fassl, fxtentacle, iNDi, JrCs, Kabyl, kaitek, mackerintel, mercurysquad, munky, Slice, meklort, mozodojo, rekursor, Turbo, cparm, valv & zef "
develop=" zef, Turbo, dfe, netkas, mackerintel, fassl, Kabyl, kaitek, iNDi, asereBLN, mozodojo, meklort, AzimutZ, Slice, cosmo1t, cparm"
credits=" andyvand, asereBLN, Azimut, bumby, cosmo1t, dfe, Galaxy, kalyway, Krazubu, MasterChief, netkas, sckevyn, smith@@, THeKiNG, DutchHockeyPro & Andy"
credits=" JrCs, mercurysquad, munky, rekursor, kalyway, Krazubu, XyZ, blackosx, DHP"
pkgdev=" blackosx, ErmaC , scrax"
pkgdev=" blackosx, ErmaC, scrax"
# =================
branches/ErmaC/CREDITS
33
44
55
6
6
77
88
99
10
10
1111
Developers:
----------
zef, Turbo, dfe, netkas, mackerintel, fassl, Kabyl, kaitek, iNDi, asereBLN, mozodojo, meklort, AzimutZ, Slice
zef, Turbo, dfe, netkas, mackerintel, fassl, Kabyl, kaitek, iNDi, asereBLN, mozodojo, meklort, AzimutZ, Slice, cosmo1t, cparm
Thanks to:
---------
JrCs, mercurysquad, munky, rekursor, cosmolt, kalyway, Krazubu, THeKiNG, XyZ, blackosx, DHP, cparm
JrCs, mercurysquad, munky, rekursor, kalyway, Krazubu, XyZ, blackosx, DHP

Archive Download the corresponding diff file

Revision: 1396