Chameleon

Chameleon Commit Details

Date:2012-08-11 22:35:20 (11 years 8 months ago)
Author:armel cadet-petit
Commit:2044
Parents: 2043
Message:Security fixes
Changes:
M/branches/cparm/i386/libsaio/modules.h
M/branches/cparm/i386/modules/HibernateEnabler/graphic_utils.c
M/branches/cparm/i386/libsaio/stringTable.c
M/branches/cparm/i386/libsaio/ntfs.h
M/branches/cparm/i386/libsaio/convert.c
M/branches/cparm/i386/modules/SMBiosGetters/mysmbios.c
M/branches/cparm/Chameleon.xcodeproj/project.pbxproj
M/branches/cparm/i386/libsaio/msdos.c
M/branches/cparm/i386/util/amlsgn.m
M/branches/cparm/i386/modules/RamDiskLoader/RamDiskLoader.c
M/branches/cparm/i386/modules/GraphicsEnabler/nvidia.c
M/branches/cparm/i386/libsaio/msdos.h
M/branches/cparm/i386/libsaio/disk.c
M/branches/cparm/i386/libsaio/device_inject.c
M/branches/cparm/i386/modules/SMBiosPatcher/smbios_patcher.c
M/branches/cparm/i386/libsaio/saio_internal.h
M/branches/cparm/i386/modules/GraphicsEnabler/ati.c
M/branches/cparm/i386/boot2/options.c
M/branches/cparm/i386/libsaio/xml.c
M/branches/cparm/i386/boot2/graphics.c
M/branches/cparm/i386/libsaio/exfat.c
M/branches/cparm/i386/modules/ACPICodec/acpi_codec.c
M/branches/cparm/CHANGES
M/branches/cparm/i386/libsaio/exfat.h
M/branches/cparm/i386/modules/NetbookInstaller/NBI.c
M/branches/cparm/i386/libsaio/sys.c
M/branches/cparm/i386/libsaio/device_tree.c
M/branches/cparm/i386/libsaio/nbp.c
M/branches/cparm/i386/libsaio/hfs.c
M/branches/cparm/i386/boot2/drivers.c
M/branches/cparm/i386/modules/Memory/spd.c
M/branches/cparm/i386/libsaio/saio_types.h
M/branches/cparm/i386/libsaio/hfs.h
M/branches/cparm/i386/boot2/drivers.h
M/branches/cparm/i386/modules/KextPatcher/kext_patcher.c
M/branches/cparm/i386/libsaio/fake_efi.c
M/branches/cparm/i386/util/md.c
M/branches/cparm/i386/libsaio/misc.c
M/branches/cparm/i386/libsaio/ufs.c
M/branches/cparm/i386/boot2/Makefile
M/branches/cparm/i386/modules/RamDiskLoader/ramdisk.c
M/branches/cparm/i386/libsaio/ufs.h
M/branches/cparm/i386/modules/Networking/Networking.c
M/branches/cparm/i386/libsa/efi_tables.c
M/branches/cparm/i386/boot2/boot.c
M/branches/cparm/i386/modules/GUI/Makefile
M/branches/cparm/i386/modules/RamDiskLoader/ramdisk.h
M/branches/cparm/i386/modules/GUI/graphic_utils.c
M/branches/cparm/i386/libsaio/modules.c
M/branches/cparm/i386/libsaio/bootstruct.c
M/branches/cparm/i386/modules/Keymapper/Keylayout.c
M/branches/cparm/i386/libsaio/ntfs.c
M/branches/cparm/i386/libsa/efi_tables.h
M/branches/cparm/i386/libsaio/pci.c
M/branches/cparm/i386/modules/Memory/mem.c

File differences

branches/cparm/Chameleon.xcodeproj/project.pbxproj
99
1010
1111
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2912
3013
3114
......
646629
647630
648631
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681632
682633
683634
......
11271078
11281079
11291080
1130
11311081
11321082
11331083
/* Begin PBXFileReference section */
AB0E930C14C6223500F798D7 /* cpu_intel_amd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpu_intel_amd.c; sourceTree = "<group>"; };
AB22095D15334C9E00AA9851 /* md5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = "<group>"; };
AB30EB4615AD7D3E000ACA09 /* acpi_codec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpi_codec.c; sourceTree = "<group>"; };
AB30EB4715AD7D3E000ACA09 /* acpi_codec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi_codec.h; sourceTree = "<group>"; };
AB30EB4815AD7D3E000ACA09 /* acpicode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpicode.c; sourceTree = "<group>"; };
AB30EB4915AD7D3E000ACA09 /* acpicode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpicode.h; sourceTree = "<group>"; };
AB30EB4A15AD7D3E000ACA09 /* ACPICodec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ACPICodec.c; sourceTree = "<group>"; };
AB30EB4B15AD7D3E000ACA09 /* acpidecode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpidecode.c; sourceTree = "<group>"; };
AB30EB4C15AD7D3E000ACA09 /* acpidecode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpidecode.h; sourceTree = "<group>"; };
AB30EB4D15AD7D3E000ACA09 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB30EB4E15AD7DC6000ACA09 /* AcpiAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AcpiAdditions.h; sourceTree = "<group>"; };
AB30EB4F15AD7E77000ACA09 /* portable_efi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = portable_efi.h; sourceTree = "<group>"; };
AB30EB5815AD8399000ACA09 /* Acpi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Acpi.h; sourceTree = "<group>"; };
AB30EB5915AD8399000ACA09 /* Acpi10.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Acpi10.h; sourceTree = "<group>"; };
AB30EB5A15AD8399000ACA09 /* Acpi20.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Acpi20.h; sourceTree = "<group>"; };
AB30EB5B15AD8399000ACA09 /* Acpi30.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Acpi30.h; sourceTree = "<group>"; };
AB30EB5C15AD8399000ACA09 /* Acpi40.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Acpi40.h; sourceTree = "<group>"; };
AB30EB5D15AD8399000ACA09 /* Acpi50.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Acpi50.h; sourceTree = "<group>"; };
AB30EB5E15AD8399000ACA09 /* AcpiAml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AcpiAml.h; sourceTree = "<group>"; };
AB42D02115187F2C0078E84A /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = "<group>"; };
AB42D02215187F2C0078E84A /* boot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = boot.png; sourceTree = "<group>"; };
AB42D02315187F2C0078E84A /* device_cdrom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_cdrom.png; sourceTree = "<group>"; };
name = Chameleon;
sourceTree = "<group>";
};
AB30EB4515AD7D3E000ACA09 /* ACPICodecV2 */ = {
isa = PBXGroup;
children = (
AB30EB5715AD8398000ACA09 /* IndustryStandard */,
AB30EB4E15AD7DC6000ACA09 /* AcpiAdditions.h */,
AB30EB4615AD7D3E000ACA09 /* acpi_codec.c */,
AB30EB4715AD7D3E000ACA09 /* acpi_codec.h */,
AB30EB4815AD7D3E000ACA09 /* acpicode.c */,
AB30EB4915AD7D3E000ACA09 /* acpicode.h */,
AB30EB4A15AD7D3E000ACA09 /* ACPICodec.c */,
AB30EB4B15AD7D3E000ACA09 /* acpidecode.c */,
AB30EB4C15AD7D3E000ACA09 /* acpidecode.h */,
AB30EB4D15AD7D3E000ACA09 /* Makefile */,
AB30EB4F15AD7E77000ACA09 /* portable_efi.h */,
);
path = ACPICodecV2;
sourceTree = "<group>";
};
AB30EB5715AD8398000ACA09 /* IndustryStandard */ = {
isa = PBXGroup;
children = (
AB30EB5815AD8399000ACA09 /* Acpi.h */,
AB30EB5915AD8399000ACA09 /* Acpi10.h */,
AB30EB5A15AD8399000ACA09 /* Acpi20.h */,
AB30EB5B15AD8399000ACA09 /* Acpi30.h */,
AB30EB5C15AD8399000ACA09 /* Acpi40.h */,
AB30EB5D15AD8399000ACA09 /* Acpi50.h */,
AB30EB5E15AD8399000ACA09 /* AcpiAml.h */,
);
path = IndustryStandard;
sourceTree = "<group>";
};
AB42D02015187F2C0078E84A /* embed */ = {
isa = PBXGroup;
children = (
isa = PBXGroup;
children = (
AB43B34914C37E520018D529 /* ACPICodec */,
AB30EB4515AD7D3E000ACA09 /* ACPICodecV2 */,
AB43B35214C37E520018D529 /* ACPIPatcher */,
AB43B35914C37E520018D529 /* CPUfreq */,
ABA02704156CE81A00F8E5F3 /* Ext2fs */,
branches/cparm/CHANGES
1
12
23
34
- Security fixes
- Added beta support for Xcode 4.4
- Added memory info to the nvidia plist structure, so now one can add several cards to the plist and set a customized name and memory info for each cards
branches/cparm/i386/libsaio/xml.c
5656
5757
5858
59
59
6060
6161
6262
......
7171
7272
7373
74
74
7575
7676
7777
......
258258
259259
260260
261
262
261
262
263263
264264
265265
266
266
267267
268268
269269
......
974974
975975
976976
977
977
978978
979979
980980
......
997997
998998
999999
1000
10001001
1001
1002
10021003
1003
1004
10041005
10051006
10061007
10071008
10081009
1010
1011
1012
1013
1014
1015
1016
10091017
10101018
1011
1019
10121020
10131021
10141022
......
10461054
10471055
10481056
1057
10491058
10501059
10511060
if (!tmp->string) {
return -1;
}
sprintf(tmp->string, "%s", string);
snprintf(tmp->string, strlen(string)+1,"%s", string);
return 0;
}
tmp = tmp->next;
free(new_ref);
return -1;
}
sprintf(new_ref->string, "%s", string);
snprintf(new_ref->string, strlen(string)+1,"%s", string);
new_ref->id = id;
new_ref->next = ref_strings;
ref_strings = new_ref;
char *configBuffer;
configBuffer = malloc(strlen(buffer)+1);
length = strlen(buffer) + 1;
configBuffer = malloc(length);
if (!configBuffer) {
return -1;
}
strcpy(configBuffer, buffer);
strlcpy(configBuffer, buffer, length);
buffer_start = configBuffer;
{
long refCount;
struct Symbol *next;
char string[];
char *string;
};
typedef struct Symbol Symbol, *SymbolPtr;
// Add the new symbol.
if (symbol == 0)
{
int len;
#if USEMALLOC
symbol = (SymbolPtr)malloc(sizeof(Symbol) + 1 + strlen(string));
symbol = (SymbolPtr)malloc(sizeof(Symbol) );
#else
symbol = (SymbolPtr)AllocateBootXMemory(sizeof(Symbol) + 1 + strlen(string));
symbol = (SymbolPtr)AllocateBootXMemory(sizeof(Symbol));
#endif
if (symbol == 0) {
stop("NULL symbol!");
return 0;
}
len = strlen(string) + 1;
symbol->string = (char*)malloc(len);
if (symbol->string == 0) {
free(symbol);
stop("NULL symbol->string!");
return 0;
}
// Set the symbol's data.
symbol->refCount = 0;
strcpy(symbol->string, string);
strlcpy(symbol->string, string, len);
// Add the symbol to the list.
symbol->next = gSymbolsHead;
else gSymbolsHead = symbol->next;
// Free the symbol's memory.
if (symbol->string) free(symbol->string);
free(symbol);
}
#endif
branches/cparm/i386/libsaio/exfat.c
212212
213213
214214
215
215
216216
217217
218218
......
241241
242242
243243
244
244
245245
246246
247247
* Reads the boot sector, does some checking, generates UUID
* (like the one you get on Windows???)
*/
long EXFATGetUUID(CICell ih, char *uuidStr)
long EXFATGetUUID(CICell ih, char *uuidStr, long strMaxLen)
{
struct exfatbootfile *boot;
void *buf = malloc(MAX_BLOCK_SIZE);
return -1;
// Use UUID like the one you get on Windows
sprintf(uuidStr, "%04X-%04X", (unsigned short)(boot->bf_volsn >> 16) & 0xFFFF,
snprintf(uuidStr, strMaxLen,"%04X-%04X", (unsigned short)(boot->bf_volsn >> 16) & 0xFFFF,
(unsigned short)boot->bf_volsn & 0xFFFF);
DBG("EXFATGetUUID: %x:%x = %s\n", ih->biosdev, ih->part_no, uuidStr);
branches/cparm/i386/libsaio/bootstruct.c
9595
9696
9797
98
98
9999
100100
101101
if (node == 0) {
stop("Couldn't create root node");
}
getPlatformName(platformName);
getPlatformName(platformName, sizeof(platformName));
{
int nameLen;
branches/cparm/i386/libsaio/exfat.h
2727
2828
2929
30
30
3131
extern void EXFATGetDescription(CICell ih, char *str, long strMaxLen);
extern bool EXFATProbe (const void *buf);
extern long EXFATGetUUID(CICell ih, char *uuidStr);
extern long EXFATGetUUID(CICell ih, char *uuidStr, long strMaxLen);
branches/cparm/i386/libsaio/device_tree.c
239239
240240
241241
242
242
243243
244244
245245
for (count = 0, prop = node->properties; prop != 0; count++, prop = prop->next) {
flatProp = (DeviceTreeNodeProperty *)buffer;
strcpy(flatProp->name, prop->name);
strlcpy(flatProp->name, prop->name, kPropNameLength);
flatProp->length = prop->length;
buffer += sizeof(DeviceTreeNodeProperty);
bcopy(prop->value, buffer, prop->length);
branches/cparm/i386/libsaio/hfs.c
303303
304304
305305
306
306
307307
308308
309309
......
426426
427427
428428
429
429
430430
431431
432432
433433
434
434
435435
436436
437437
......
580580
581581
582582
583
583
584
585
584586
587
588
589
590
591
585592
586593
587594
return -1;
}
getDeviceDescription(ih, devStr);
getDeviceDescription(ih, devStr, sizeof(devStr));
if (get_env(envHFSLoadVerbose)) {
verbose("Read HFS%s file: [%s/%s] %d bytes.\n",
return 0;
}
long HFSGetUUID(CICell ih, char *uuidStr)
long HFSGetUUID(CICell ih, char *uuidStr , long strMaxLen)
{
if (HFSInitPartition(ih) == -1) return -1;
if (gVolID == 0LL) return -1;
return CreateUUIDString((uint8_t*)(&gVolID), sizeof(gVolID), uuidStr);
return CreateUUIDString((uint8_t*)(&gVolID), sizeof(gVolID), uuidStr, strMaxLen);
}
// Private Functions
hfsPlusFile = (HFSPlusCatalogFile *)entry;
if ((SWAP_BE32(hfsPlusFile->userInfo.fdType) == kHardLinkFileType) &&
(SWAP_BE32(hfsPlusFile->userInfo.fdCreator) == kHFSPlusCreator)) {
sprintf(gLinkTemp, "%s/%s%ld", HFSPLUSMETADATAFOLDER,
#ifdef __i386__
snprintf(gLinkTemp, 64 ,"%s/%s%ld", HFSPLUSMETADATAFOLDER,
HFS_INODE_PREFIX, SWAP_BE32(hfsPlusFile->bsdInfo.special.iNodeNum));
#else
snprintf(gLinkTemp, sizeof(gLinkTemp),"%s/%s%ld", HFSPLUSMETADATAFOLDER,
HFS_INODE_PREFIX, SWAP_BE32(hfsPlusFile->bsdInfo.special.iNodeNum));
#endif
result = ResolvePathToCatalogEntry(gLinkTemp, flags, entry,
kHFSRootFolderID, &tmpDirIndex);
}
branches/cparm/i386/libsaio/hfs.h
2828
2929
3030
31
31
3232
3333
FinderInfo * finderInfo, long * infoValid);
extern void HFSGetDescription(CICell ih, char *str, long strMaxLen);
extern long HFSGetFileBlock(CICell ih, char *str, unsigned long long *firstBlock);
extern long HFSGetUUID(CICell ih, char *uuidStr);
extern long HFSGetUUID(CICell ih, char *uuidStr, long strMaxLen);
extern void HFSFree(CICell ih);
extern bool HFSProbe (const void *buf);
branches/cparm/i386/libsaio/ufs.c
180180
181181
182182
183
183
184184
185
186
185187
186188
187189
188190
189191
190
192
191193
192194
193195
#if !BOOT1
long UFSGetUUID(CICell ih, char *uuidStr)
long UFSGetUUID(CICell ih, char *uuidStr, long strMaxLen)
{
(void)strMaxLen;
long long uuid = gUFSLabel.ul_uuid;
if (UFSInitPartition(ih) == -1) return -1;
if (uuid == 0LL) return -1;
return CreateUUIDString((uint8_t*)(&uuid), sizeof(uuid), uuidStr);
return CreateUUIDString((uint8_t*)(&uuid), sizeof(uuid), uuidStr, strMaxLen);
}
#endif /* !BOOT1 */
branches/cparm/i386/libsaio/ufs.h
2828
2929
3030
31
31
3232
3333
FinderInfo * finderInfo, long * infoValid);
extern void UFSGetDescription(CICell ih, char *str, long strMaxLen);
extern long UFSGetFileBlock(CICell ih, char *str, unsigned long long *firstBlock);
extern long UFSGetUUID(CICell ih, char *uuidStr);
extern long UFSGetUUID(CICell ih, char *uuidStr, long strMaxLen);
extern void UFSFree(CICell ih);
branches/cparm/i386/libsaio/modules.c
14881488
14891489
14901490
1491
1492
1493
1494
1495
1491
1492
1493
1494
1495
14961496
14971497
14981498
......
15161516
15171517
15181518
1519
1520
1519
1520
15211521
15221522
15231523
......
15551555
15561556
15571557
1558
1558
15591559
15601560
15611561
1562
1562
15631563
15641564
15651565
......
15671567
15681568
15691569
1570
1570
15711571
15721572
15731573
......
16231623
16241624
16251625
1626
1626
16271627
16281628
16291629
......
16321632
16331633
16341634
1635
1635
16361636
16371637
16381638
......
16431643
16441644
16451645
1646
1646
16471647
16481648
16491649
......
17131713
17141714
17151715
1716
1716
17171717
17181718
17191719
if (BundleSet == true) return 0;
gModulesSpec = malloc( 4096 );
gDriverSpec = malloc( 4096 );
gFileSpec = malloc( 4096 );
gTempSpec = malloc( 4096 );
gFileName = malloc( 4096 );
gModulesSpec = malloc( DEFAULT_BUNDLE_SPEC_SIZE );
gDriverSpec = malloc( DEFAULT_BUNDLE_SPEC_SIZE );
gFileSpec = malloc( DEFAULT_BUNDLE_SPEC_SIZE );
gTempSpec = malloc( DEFAULT_BUNDLE_SPEC_SIZE );
gFileName = malloc( DEFAULT_BUNDLE_SPEC_SIZE );
if ( !gModulesSpec || !gDriverSpec || !gFileSpec || !gTempSpec || !gFileName )
goto error;
return 1;
strlcpy(gModulesSpec, dirSpec, 4096);
strlcat(gModulesSpec, "Modules", 4096 - 1);
strlcpy(gModulesSpec, dirSpec, DEFAULT_BUNDLE_SPEC_SIZE);
strlcat(gModulesSpec, "Modules", DEFAULT_BUNDLE_SPEC_SIZE);
FileLoadBundles(gModulesSpec, 0);
if (strcmp(name + length - 7, ".bundle")) continue;
// Save the file name.
strlcpy(gFileName, name, 4096);
strlcpy(gFileName, name, DEFAULT_BUNDLE_SPEC_SIZE);
DBG("Load Bundles %s\n",gFileName);
// Determine the bundle type.
sprintf(gTempSpec, "%s/%s", dirSpec, gFileName);
snprintf(gTempSpec,DEFAULT_BUNDLE_SPEC_SIZE,"%s/%s", dirSpec, gFileName);
ret = GetFileInfo(gTempSpec, "Contents", &flags, &time);
if (ret == 0) bundleType = kCFBundleType2;
else bundleType = kCFBundleType3;
DBG("Bundles type = %d\n",bundleType);
if (!plugin)
sprintf(gDriverSpec, "%s/%s/%sPlugIns", dirSpec, gFileName,
snprintf(gDriverSpec, DEFAULT_BUNDLE_SPEC_SIZE,"%s/%s/%sPlugIns", dirSpec, gFileName,
(bundleType == kCFBundleType2) ? "Contents/" : "");
ret = LoadBundlePList( dirSpec, gFileName, bundleType);
do {
// Save the driver path.
sprintf(gFileSpec, "%s/%s/%s", dirSpec, name,
snprintf(gFileSpec,DEFAULT_BUNDLE_SPEC_SIZE,"%s/%s/%s", dirSpec, name,
(bundleType == kCFBundleType2) ? "Contents/MacOS/" : "");
executablePathLength = strlen(gFileSpec) + 1;
strlcpy(tmpExecutablePath, gFileSpec, executablePathLength);
sprintf(gFileSpec, "%s/%s", dirSpec, name);
snprintf(gFileSpec, DEFAULT_BUNDLE_SPEC_SIZE,"%s/%s", dirSpec, name);
bundlePathLength = strlen(gFileSpec) + 1;
tmpBundlePath = malloc(bundlePathLength);
// Construct the file spec to the plist, then load it.
sprintf(gFileSpec, "%s/%s/%sInfo.plist", dirSpec, name,
snprintf(gFileSpec, DEFAULT_BUNDLE_SPEC_SIZE,"%s/%s/%sInfo.plist", dirSpec, name,
(bundleType == kCFBundleType2) ? "Contents/" : "");
DBG("Loading Bundle PList %s\n",gFileSpec);
if (prop != 0) \
{ \
fileName = prop->string; \
sprintf(gFileSpec, "%s%s", module->executablePath, fileName); \
snprintf(gFileSpec, DEFAULT_BUNDLE_SPEC_SIZE,"%s%s", module->executablePath, fileName); \
\
module_start = (void*)load_module((char*)fileName,gFileSpec); \
if(!module_start || (*module_start == (void*)0xFFFFFFFF)) \
branches/cparm/i386/libsaio/modules.h
2323
2424
2525
26
27
28
2629
2730
2831
#include <mach-o/nlist.h>
#include "efi.h"
#define DEFAULT_BUNDLE_SPEC_SIZE 4096
extern unsigned long long textAddress;
extern unsigned long long textSection;
branches/cparm/i386/libsaio/device_inject.c
411411
412412
413413
414
414
415
415416
416417
417418
......
419420
420421
421422
422
423
423424
424425
426
425427
426428
427429
......
430432
431433
432434
433
435
434436
435
437
438
439
440
436441
437442
438443
439
444
445
440446
441447
442448
443449
444450
445451
452
446453
447454
448
455
456
457
458
449459
450460
451461
452462
453463
464
454465
455
456
466
467
468
469
457470
458471
459472
460473
474
461475
462476
463477
464
478
479
480
481
465482
483
466484
467485
468486
......
484502
485503
486504
487
505
488506
489507
490508
char *devprop_generate_string(struct DevPropString *string)
{
char *buffer = (char*)malloc(string->length * 2);
int len = string->length * 2;
char *buffer = (char*)malloc(len);
char *ptr = buffer;
if(!buffer)
return NULL;
}
sprintf(buffer, "%08x%08x%04x%04x", dp_swap32(string->length), string->WHAT2,
snprintf(buffer, len, "%08x%08x%04x%04x", dp_swap32(string->length), string->WHAT2,
dp_swap16(string->numentries), string->WHAT3);
buffer += 24;
len -= 24;
int i = 0, x = 0;
struct DevPropDevice **string_entries_arrey = (struct DevPropDevice **) string->entries;
{
if (!(i<MAX_STRING_NUM_ENTRIES))
{
continue;
break;
}
sprintf(buffer, "%08x%04x%04x", dp_swap32(string_entries_arrey[i]->length),
if (!len) {
break;
}
snprintf(buffer, len, "%08x%04x%04x", dp_swap32(string_entries_arrey[i]->length),
dp_swap16(string_entries_arrey[i]->numentries), string_entries_arrey[i]->WHAT2);
buffer += 16;
sprintf(buffer, "%02x%02x%04x%08x%08x", string_entries_arrey[i]->acpi_dev_path.type,
len -= 16;
snprintf(buffer, len,"%02x%02x%04x%08x%08x", string_entries_arrey[i]->acpi_dev_path.type,
string_entries_arrey[i]->acpi_dev_path.subtype,
dp_swap16(string_entries_arrey[i]->acpi_dev_path.length),
string_entries_arrey[i]->acpi_dev_path._HID,
dp_swap32(string_entries_arrey[i]->acpi_dev_path._UID));
buffer += 24;
len -= 24;
for(x=0;x < string_entries_arrey[i]->num_pci_devpaths; x++)
{
sprintf(buffer, "%02x%02x%04x%02x%02x", string_entries_arrey[i]->pci_dev_path[x].type,
if (!len) {
break;
}
snprintf(buffer, len,"%02x%02x%04x%02x%02x", string_entries_arrey[i]->pci_dev_path[x].type,
string_entries_arrey[i]->pci_dev_path[x].subtype,
dp_swap16(string_entries_arrey[i]->pci_dev_path[x].length),
string_entries_arrey[i]->pci_dev_path[x].function,
string_entries_arrey[i]->pci_dev_path[x].device);
buffer += 12;
len -= 12;
}
sprintf(buffer, "%02x%02x%04x", string_entries_arrey[i]->path_end.type,
if (!len) {
break;
}
snprintf(buffer, len,"%02x%02x%04x", string_entries_arrey[i]->path_end.type,
string_entries_arrey[i]->path_end.subtype,
dp_swap16(string_entries_arrey[i]->path_end.length));
buffer += 8;
len -= 8;
uint8_t *dataptr = string_entries_arrey[i]->data;
for(x = 0; (uint32_t)x < (string_entries_arrey[i]->length) - (24 + (6 * string_entries_arrey[i]->num_pci_devpaths)) ; x++)
{
sprintf(buffer, "%02x", *dataptr++);
if (!len) {
break;
}
snprintf(buffer, len, "%02x", *dataptr++);
buffer += 2;
len -= 2;
}
i++;
}
{
if (!(i<MAX_STRING_NUM_ENTRIES))
{
continue;
break;
}
if(string_entries_arrey[i])
{
branches/cparm/i386/libsaio/ntfs.c
318318
319319
320320
321
321
322322
323323
324324
......
341341
342342
343343
344
344
345345
346346
347347
......
349349
350350
351351
352
352
353353
354354
355355
return;
}
long NTFSGetUUID(CICell ih, char *uuidStr)
long NTFSGetUUID(CICell ih, char *uuidStr, long strMaxLen)
{
bool NTFSProbe(const void*);
// Check for NTFS signature
if ( memcmp((void*)boot->bf_sysid, NTFS_BBID, NTFS_BBIDLEN) != 0 ) {
// If not NTFS, maybe it is EXFAT
return EXFATGetUUID(ih, uuidStr);
return EXFATGetUUID(ih, uuidStr, strMaxLen);
}
// Check for non-null volume serial number
return -1;
// Use UUID like the one you get on Windows
sprintf(uuidStr, "%04X-%04X",(unsigned short)(boot->bf_volsn >> 16) & 0xFFFF,
snprintf(uuidStr,strMaxLen, "%04X-%04X",(unsigned short)(boot->bf_volsn >> 16) & 0xFFFF,
(unsigned short)boot->bf_volsn & 0xFFFF);
return 0;
branches/cparm/i386/libsaio/sys.c
224224
225225
226226
227
227
228228
229229
230230
231231
232
232233
233234
234235
......
250251
251252
252253
254
255
256
257
258
259
260
261
262
253263
254264
255265
......
582592
583593
584594
585
595
586596
587597
588598
......
592602
593603
594604
595
605
596606
597607
598608
......
10991109
11001110
11011111
1102
1112
11031113
11041114
11051115
......
11141124
11151125
11161126
1117
1127
11181128
11191129
11201130
}
// filesystem-specific getUUID functions call this shared string generator
long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr)
long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr, long strMaxLen)
{
unsigned fmtbase, fmtidx, i;
uint8_t uuidfmt[] = { 4, 2, 2, 2, 6 };
char *p = uuidStr;
char *end = p + strMaxLen;
MD5_CTX md5c;
uint8_t mdresult[16];
fmtbase = 0;
for(fmtidx = 0; fmtidx < sizeof(uuidfmt); fmtidx++) {
for(i=0; i < uuidfmt[fmtidx]; i++) {
if (p > end)
{
break;
}
else if (p == end)
{
break;
*p = '\0';
}
uint8_t byte = mdresult[fmtbase+i];
char nib;
0, 0);
}
long GetFSUUID(char *spec, char *uuidStr)
long GetFSUUID(char *spec, char *uuidStr, long strMaxLen)
{
BVRef bvr;
long rval = -1;
return -1;
if(bvr->fs_getuuid)
rval = bvr->fs_getuuid(bvr, uuidStr);
rval = bvr->fs_getuuid(bvr, uuidStr, strMaxLen);
return rval;
}
// getDeviceDescription() - Extracts unit number and partition number
// from bvr structure into "dw(u,p)" format.
// Returns length of the out string
int getDeviceDescription(BVRef bvr, char *str)
int getDeviceDescription(BVRef bvr, char *str, long strMaxLen)
{
if(!str)
return 0;
dp--;
if (dp->name)
return sprintf(str, "%s(%d,%d)", dp->name, bvr->biosdev - dp->biosdev, bvr->part_no);
return snprintf(str, strMaxLen, "%s(%d,%d)", dp->name, bvr->biosdev - dp->biosdev, bvr->part_no);
}
return 0;
branches/cparm/i386/libsaio/ntfs.h
2222
2323
2424
25
25
extern void NTFSGetDescription(CICell ih, char *str, long strMaxLen);
extern bool NTFSProbe (const void *buf);
extern long NTFSGetUUID(CICell ih, char *uuidStr);
extern long NTFSGetUUID(CICell ih, char *uuidStr, long strMaxLen);
branches/cparm/i386/libsaio/nbp.c
103103
104104
105105
106
106
107107
108108
109109
static void NBPGetDescription(CICell ih, char * str, long strMaxLen)
{
sprintf( str, "Ethernet PXE Client" );
snprintf( str, strMaxLen,"Ethernet PXE Client" );
}
//==========================================================================
branches/cparm/i386/libsaio/disk.c
14131413
14141414
14151415
1416
1416
14171417
14181418
14191419
......
16041604
16051605
16061606
1607
1607
16081608
16091609
16101610
......
16121612
16131613
16141614
1615
1615
16161616
16171617
16181618
......
16211621
16221622
16231623
1624
1624
16251625
16261626
16271627
1628
1628
16291629
16301630
16311631
......
16711671
16721672
16731673
1674
1674
16751675
16761676
16771677
16781678
16791679
16801680
1681
1681
16821682
16831683
16841684
......
20412041
20422042
20432043
2044
2044
20452045
20462046
20472047
20482048
2049
2049
20502050
20512051
20522052
......
21272127
21282128
21292129
2130
2130
21312131
21322132
21332133
2134
2134
21352135
21362136
21372137
......
21582158
21592159
21602160
2161
2161
21622162
21632163
21642164
21652165
21662166
21672167
2168
2168
21692169
21702170
21712171
if(isPartitionUsed(gptMap))
{
char stringuuid[100];
efi_guid_unparse_upper((EFI_GUID*)gptMap->ent_type, stringuuid);
efi_guid_unparse_upper((EFI_GUID*)gptMap->ent_type, stringuuid, sizeof(stringuuid));
verbose("Reading GPT partition %d, type %s\n", gptID, stringuuid);
// Getting fdisk like partition type.
config_file_t systemVersion;
char dirSpec[512];
sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
snprintf(dirSpec, sizeof(dirSpec),"hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &systemVersion))
{
}
else
{
sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/ServerVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
snprintf(dirSpec, sizeof(dirSpec),"hd(%d,%d)/System/Library/CoreServices/ServerVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (!loadConfigFile(dirSpec, &systemVersion))
{
}
else
{
sprintf(dirSpec, "hd(%d,%d)/OS X Install Data/index.sproduct", BIOS_DEV_UNIT(bvr), bvr->part_no); // 10.8
snprintf(dirSpec, sizeof(dirSpec),"hd(%d,%d)/OS X Install Data/index.sproduct", BIOS_DEV_UNIT(bvr), bvr->part_no); // 10.8
if (!getOSInstallVersion(dirSpec, str, &systemVersion))
{
sprintf(dirSpec, "hd(%d,%d)/Mac OS X Install Data/index.sproduct", BIOS_DEV_UNIT(bvr), bvr->part_no); // 10.7
snprintf(dirSpec, sizeof(dirSpec),"hd(%d,%d)/Mac OS X Install Data/index.sproduct", BIOS_DEV_UNIT(bvr), bvr->part_no); // 10.7
if (!getOSInstallVersion(dirSpec, str, &systemVersion))
return false;
bvr->kernelfound = true;
sprintf(dirspec,kdirspec[0],BIOS_DEV_UNIT(bvr), bvr->part_no);
snprintf(dirspec,sizeof(dirspec),kdirspec[0],BIOS_DEV_UNIT(bvr), bvr->part_no);
ret = GetFileInfo(NULL, dirspec, &flags, &time);
if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat)) {
#if UNUSED
sprintf(dirspec,kdirspec[1],BIOS_DEV_UNIT(bvr), bvr->part_no);
snprintf(dirspec,sizeof(dirspec),kdirspec[1],BIOS_DEV_UNIT(bvr), bvr->part_no);
ret = GetFileInfo(NULL, dirspec, &flags, &time);
return 0;
// Try to match hd(x,y) first.
sprintf(testStr, "hd(%d,%d)", BIOS_DEV_UNIT(bvr), bvr->part_no);
snprintf(testStr, sizeof(testStr),"hd(%d,%d)", BIOS_DEV_UNIT(bvr), bvr->part_no);
if ( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) )
return true;
// Try to match volume UUID.
if ( bvr->fs_getuuid && bvr->fs_getuuid(bvr, testStr) == 0)
if ( bvr->fs_getuuid && bvr->fs_getuuid(bvr, testStr, sizeof(testStr)) == 0)
{
if( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) )
return true;
if (useDeviceDescription)
{
int len = getDeviceDescription(bvr, str);
int len = getDeviceDescription(bvr, str, strMaxLen);
if(len >= strMaxLen)
return;
strcpy(str + len, " ");
strlcpy(str + len, " ", strMaxLen);
len++;
strMaxLen -= len;
p += len;
name = bvr->type_name;
}
if (name == NULL) {
sprintf(p, "TYPE %02x", type);
snprintf(p, strMaxLen, "TYPE %02x", type);
} else {
strncpy(p, name, strMaxLen);
}
}
// Set the devices label
sprintf(bvr->label, p);
snprintf(bvr->label, sizeof(bvr->label), p);
}
//==========================================================================
branches/cparm/i386/libsaio/pci.c
188188
189189
190190
191
191
192192
193193
194194
195195
196
196
197197
198198
199
199
200200
201201
202202
end = current;
if (current->parent == root_pci_dev)
{
sprintf(tmp, "PciRoot(0x%x)/Pci(0x%x,0x%x)", uid,
snprintf(tmp, sizeof(tmp),"PciRoot(0x%x)/Pci(0x%x,0x%x)", uid,
current->dev.bits.dev, current->dev.bits.func);
}
else
{
sprintf(tmp, "/Pci(0x%x,0x%x)",
snprintf(tmp, sizeof(tmp) ,"/Pci(0x%x,0x%x)",
current->dev.bits.dev, current->dev.bits.func);
}
sprintf(buffer, "%s%s", buffer, tmp);
snprintf(buffer, sizeof(char) * 256,"%s%s", buffer, tmp);
}
return buffer;
}
branches/cparm/i386/libsaio/stringTable.c
117117
118118
119119
120
120
121121
122122
123123
......
603603
604604
605605
606
607
606
607
608
609
608610
609611
610612
611613
612
614
613615
614616
615617
if (!buf) {
return false;
}
sprintf(buf, "\"%s\"", key);
snprintf(buf, len + 3,"\"%s\"", key);
len = strlen(buf);
while(*tab) {
TagPtr tag;
pos = 0;
char *configBuffer;
configBuffer = malloc(strlen(buffer)+1);
length = strlen(buffer) + 1;
configBuffer = malloc(length);
if (!configBuffer) {
return -1;
}
strcpy(configBuffer, buffer);
strlcpy(configBuffer, buffer, length );
while (1)
{
branches/cparm/i386/libsaio/convert.c
1313
1414
1515
16
16
1717
1818
1919
static char msg[UUID_STR_LEN] = "";
if (!eUUID) return "";
const unsigned char * uuid = (unsigned char*) eUUID;
sprintf(msg, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
snprintf(msg, sizeof(msg), "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
uuid[0], uuid[1], uuid[2], uuid[3],
uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10],uuid[11],
branches/cparm/i386/libsaio/saio_types.h
221221
222222
223223
224
224
225225
226226
227227
typedef long (*FSGetDirEntry)(CICell ih, char * dirPath, long long * dirIndex,
char ** name, long * flags, long * time,
FinderInfo * finderInfo, long * infoValid);
typedef long (*FSGetUUID)(CICell ih, char *uuidStr);
typedef long (*FSGetUUID)(CICell ih, char *uuidStr, long strMaxLen);
typedef void (*BVGetDescription)(CICell ih, char * str, long strMaxLen);
// Can be just pointed to free or a special free function
typedef void (*BVFree)(CICell ih);
branches/cparm/i386/libsaio/msdos.c
835835
836836
837837
838
838
839839
840840
841841
......
999999
10001000
10011001
1002
1002
10031003
1004
1005
10041006
10051007
10061008
......
10121014
10131015
10141016
1017
1018
1019
1020
1021
10151022
10161023
10171024
toread-=msdosclustersize;
}
getDeviceDescription(ih, devStr);
getDeviceDescription(ih, devStr, sizeof(devStr));
verbose("Read FAT%d file: [%s/%s] %d bytes.\n",
msdosfatbits, devStr, filePath, (uint32_t)( toread<0 ) ? wastoread : wastoread-toread);
free (buf);
}
long
MSDOSGetUUID(CICell ih, char *uuidStr)
MSDOSGetUUID(CICell ih, char *uuidStr, long strMaxLen)
{
(void)strMaxLen;
char *buf = malloc (512);
if (!buf) {
return -1;
free (buf);
return -1;
}
if (strMaxLen<16)
{
free (buf);
return -1;
}
bzero (uuidStr, 16);
Seek(ih, 0);
Read(ih, (long)buf, 512);
branches/cparm/i386/libsaio/fake_efi.c
8585
8686
8787
88
88
8989
9090
9191
9292
9393
94
94
9595
9696
9797
......
290290
291291
292292
293
293
294294
295295
296296
297
297
298298
299299
300300
301
301
302302
303303
304304
305
305
306306
307307
308308
309309
310
310
311311
312312
313313
......
918918
919919
920920
921
921
922922
923923
924924
925925
926926
927
927
928928
929929
930930
931
931
932932
933933
934934
if (!string) {
#if DEBUG_EFI
char string_d[37];
efi_guid_unparse_upper(pGuid, string_d);
efi_guid_unparse_upper(pGuid, string_d, sizeof(string_d));
printf("Couldn't allocate Guid String for %s\n", string_d);
#endif
return NULL;
}
efi_guid_unparse_upper(pGuid, string);
efi_guid_unparse_upper(pGuid, string, 37);
return string;
}
Guid = gEfiConfigurationTable64[i].VendorGuid;
}
char id[5];
char id[4+1];
bzero(id,sizeof(id));
if (memcmp(&Guid, &gEfiSmbiosTableGuid, sizeof(EFI_GUID)) == 0)
{
sprintf(id, "%s", "_SM_");
snprintf(id, sizeof(id),"%s", "_SM_");
}
else if (memcmp(&Guid, &gEfiAcpiTableGuid, sizeof(EFI_GUID)) == 0)
{
sprintf(id, "%s", "RSD1");
snprintf(id,sizeof(id), "%s", "RSD1");
}
else if (memcmp(&Guid, &gEfiAcpi20TableGuid, sizeof(EFI_GUID)) == 0)
{
sprintf(id, "%s", "RSD2");
snprintf(id, sizeof(id),"%s", "RSD2");
}
#ifndef NO_SMP_SUPPORT
else if (memcmp(&Guid, &gEfiMpsTableGuid, sizeof(EFI_GUID)) == 0)
{
sprintf(id, "%s", "_MP_");
snprintf(id, sizeof(id),"%s", "_MP_");
}
#endif
if (getValueForKey("SMBIOS", &override_pathname, &len, DEFAULT_BOOT_CONFIG) && len > 0)
{
// Specify a path to a file, e.g. SMBIOS=/Extra/macProXY.plist
sprintf(dirSpecSMBIOS, override_pathname);
snprintf(dirSpecSMBIOS, sizeof(dirSpecSMBIOS),override_pathname);
err = loadConfigFile(dirSpecSMBIOS, DEFAULT_SMBIOS_CONFIG);
}
else
{
// Check selected volume's Extra.
sprintf(dirSpecSMBIOS, "/Extra/%s", filename);
snprintf(dirSpecSMBIOS, sizeof(dirSpecSMBIOS),"/Extra/%s", filename);
if ((err = loadConfigFile(dirSpecSMBIOS, DEFAULT_SMBIOS_CONFIG)))
{
// Check booter volume/rdbt Extra.
sprintf(dirSpecSMBIOS, "bt(0,0)/Extra/%s", filename);
snprintf(dirSpecSMBIOS, sizeof(dirSpecSMBIOS),"bt(0,0)/Extra/%s", filename);
err = loadConfigFile(dirSpecSMBIOS, DEFAULT_SMBIOS_CONFIG);
}
}
branches/cparm/i386/libsaio/msdos.h
2828
2929
3030
31
31
3232
3333
char ** name, long * flags, long * time,
FinderInfo * finderInfo, long * infoValid);
extern long MSDOSGetFileBlock(CICell ih, char *str, unsigned long long *firstBlock);
extern long MSDOSGetUUID(CICell ih, char *uuidStr);
extern long MSDOSGetUUID(CICell ih, char *uuidStr, long strMaxLen);
extern void MSDOSFree(CICell ih);
extern int MSDOSProbe (const void *buf);
branches/cparm/i386/libsaio/misc.c
125125
126126
127127
128
128
129129
130
130
131131
132132
//
#ifndef BOOT1
void
getPlatformName(char *nameBuf)
getPlatformName(char *nameBuf, int size)
{
strcpy(nameBuf, "ACPI");
strlcpy(nameBuf, "ACPI", size);
}
#endif
branches/cparm/i386/libsaio/saio_internal.h
175175
176176
177177
178
178
179179
180180
181181
......
256256
257257
258258
259
260
259
260
261261
262262
263263
......
288288
289289
290290
291
291
292292
293293
294294
extern void enableA20(void);
extern void turnOffFloppy(void);
extern void getPlatformName(char *nameBuf);
extern void getPlatformName(char *nameBuf, int size);
#ifdef NBP_SUPPORT
/* nbp.c */
extern long GetFileInfo(const char *dirSpec, const char *name,
long *flags, long *time);
extern long GetFileBlock(const char *fileSpec, unsigned long long *firstBlock);
extern long GetFSUUID(char *spec, char *uuidStr);
extern long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr);
extern long GetFSUUID(char *spec, char *uuidStr, long strMaxLen);
extern long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr, long strMaxLen);
extern int openmem(char *buf, int len);
extern int open(const char *path);
extern void getBootVolumeDescription(BVRef bvr, char *str, long strMaxLen, bool verbose);
extern void setRootVolume(BVRef volume);
extern void setBootGlobals(BVRef chain);
extern int getDeviceDescription(BVRef volume, char *str);
extern int getDeviceDescription(BVRef volume, char *str, long strMaxLen);
/* rtc.c */
extern void rtc_read_clock(struct tm *time) ;
branches/cparm/i386/boot2/graphics.c
151151
152152
153153
154
154
155155
156156
157157
//bzero( &vbeInfo, sizeof(vbeInfo) );
bzero( &vbeInfo, sizeof(VBEInfoBlock) );
strcpy( (char*)&vbeInfo, "VBE2" );
strlcpy( (char*)&vbeInfo, "VBE2", sizeof(VBEInfoBlock) );
err = getVBEInfo( &vbeInfo );
if ( err != errSuccess )
{
branches/cparm/i386/boot2/boot.c
690690
691691
692692
693
693
694694
695695
696696
697
697
698698
699699
700700
701
701
702702
703703
704704
......
827827
828828
829829
830
830
831831
832832
833833
......
888888
889889
890890
891
891
892892
893893
894894
895895
896896
897897
898
898
899899
900900
901901
902
902
903903
904904
905905
......
981981
982982
983983
984
984
985985
986986
987987
......
11291129
11301130
11311131
1132
1132
11331133
1134
1134
11351135
11361136
11371137
#ifdef BOOT_HELPER_SUPPORT
// Try to load kernel image from alternate locations on boot helper partitions.
sprintf(bootFileSpec, "com.apple.boot.P/%s", bootFile);
snprintf(bootFileSpec, sizeof(bootFileSpec),"com.apple.boot.P/%s", bootFile);
ret = GetFileInfo(NULL, bootFileSpec, &flags, &time);
if (ret == -1)
{
sprintf(bootFileSpec, "com.apple.boot.R/%s", bootFile);
snprintf(bootFileSpec, sizeof(bootFileSpec), "com.apple.boot.R/%s", bootFile);
ret = GetFileInfo(NULL, bootFileSpec, &flags, &time);
if (ret == -1)
{
sprintf(bootFileSpec, "com.apple.boot.S/%s", bootFile);
snprintf(bootFileSpec, sizeof(bootFileSpec), "com.apple.boot.S/%s", bootFile);
ret = GetFileInfo(NULL, bootFileSpec, &flags, &time);
if (ret == -1)
{
{
if(((BVRef)(uint32_t)get_env(envgBootVolume))->OSVersion[3] > '6')
{
sprintf(gBootKernelCacheFile, "%s", kDefaultCachePath);
snprintf(gBootKernelCacheFile, sizeof(gBootKernelCacheFile), "%s", kDefaultCachePath);
}
else if(((BVRef)(uint32_t)get_env(envgBootVolume))->OSVersion[3] <= '6')
{
int ret = -1;
if (Adler32) {
sprintf(gBootKernelCacheFile, "%s.%08lX", "/System/Library/Caches/com.apple.kernelcaches/kernelcache",Adler32);
snprintf(gBootKernelCacheFile, sizeof(gBootKernelCacheFile), "%s.%08lX", "/System/Library/Caches/com.apple.kernelcaches/kernelcache",Adler32);
ret = GetFileInfo(NULL, gBootKernelCacheFile, &flags, &cachetime);
}
if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat))
{
safe_set_env(envAdler32, 0);
sprintf(gBootKernelCacheFile, "%s", "/System/Library/Caches/com.apple.kernelcaches/kernelcache");
snprintf(gBootKernelCacheFile, sizeof(gBootKernelCacheFile), "%s", "/System/Library/Caches/com.apple.kernelcaches/kernelcache");
}
} else if (Adler32)
sprintf(gBootKernelCacheFile, "%s_%s.%08lX", kDefaultCachePath, (get_env(envarchCpuType) == CPU_TYPE_I386) ? "i386" : "x86_64", Adler32); //Snow Leopard
snprintf(gBootKernelCacheFile, sizeof(gBootKernelCacheFile), "%s_%s.%08lX", kDefaultCachePath, (get_env(envarchCpuType) == CPU_TYPE_I386) ? "i386" : "x86_64", Adler32); //Snow Leopard
}
}
goto out;
}
if (((BVRef)(uint32_t)get_env(envgBootVolume))->fs_getuuid && (((BVRef)(uint32_t)get_env(envgBootVolume))->fs_getuuid (((BVRef)(uint32_t)get_env(envgBootVolume)), bootInfo->uuidStr) == 0))
if (((BVRef)(uint32_t)get_env(envgBootVolume))->fs_getuuid && (((BVRef)(uint32_t)get_env(envgBootVolume))->fs_getuuid (((BVRef)(uint32_t)get_env(envgBootVolume)), bootInfo->uuidStr, sizeof(bootInfo->uuidStr)) == 0))
{
verbose("Setting boot-uuid to: %s\n", bootInfo->uuidStr);
//uuidSet = true;
// bootFile must start with a / if it not start with a device name
if (!bootFileWithDevice && (str)[0] != '/')
sprintf(bootFile, "/%s", str); // append a leading /
snprintf(bootFile, sizeof(bootfile), "/%s", str); // append a leading /
else
strlcpy(bootFile, bootInfo->bootFile, sizeof(bootInfo->bootFile));
strlcpy(bootFile, bootInfo->bootFile, sizeof(bootFile));
return bootfile;
}
branches/cparm/i386/boot2/drivers.c
9494
9595
9696
97
97
9898
9999
100100
......
122122
123123
124124
125
126
127
128
129
125
126
127
128
129
130130
131131
132132
......
178178
179179
180180
181
182
181
182
183183
184184
185185
186
186
187187
188188
189189
......
191191
192192
193193
194
195
194
195
196196
197197
198198
199
199
200200
201201
202202
......
212212
213213
214214
215
215
216216
217217
218
218
219219
220220
221
221
222222
223223
224224
......
235235
236236
237237
238
239
240
238
239
240
241241
242242
243243
......
264264
265265
266266
267
267
268268
269269
270270
......
272272
273273
274274
275
275
276276
277277
278278
......
284284
285285
286286
287
287
288288
289289
290290
......
301301
302302
303303
304
304
305305
306306
307307
......
322322
323323
324324
325
325
326326
327327
328
328
329329
330330
331331
332332
333333
334
334
335335
336336
337337
......
340340
341341
342342
343
343
344344
345345
346346
......
368368
369369
370370
371
371
372372
373373
374374
......
422422
423423
424424
425
425
426426
427427
428428
......
446446
447447
448448
449
449
450450
451451
452452
......
455455
456456
457457
458
458
459459
460460
461461
......
465465
466466
467467
468
468
469469
470470
471471
......
568568
569569
570570
571
571
572572
573573
574574
......
619619
620620
621621
622
622
623623
624624
625625
long LoadDrivers( char * dirSpec );
long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);
long InitDriverSupport(void);
long FileLoadDrivers(char *dirSpec, long plugin);
long FileLoadDrivers(char *dirSpec, long size,long plugin);
long LoadDriverMKext(char *fileSpec);
long LoadDriverPList(char *dirSpec, char *name, long bundleType);
long LoadMatchedModules(void);
if (DriverSet == true) return 0;
gExtensionsSpec = malloc( 4096 );
gDriverSpec = malloc( 4096 );
gFileSpec = malloc( 4096 );
gTempSpec = malloc( 4096 );
gFileName = malloc( 4096 );
gExtensionsSpec = malloc( DEFAULT_DRIVER_SPEC_SIZE );
gDriverSpec = malloc( DEFAULT_DRIVER_SPEC_SIZE );
gFileSpec = malloc( DEFAULT_DRIVER_SPEC_SIZE );
gTempSpec = malloc( DEFAULT_DRIVER_SPEC_SIZE );
gFileName = malloc( DEFAULT_DRIVER_SPEC_SIZE );
if ( !gExtensionsSpec || !gDriverSpec || !gFileSpec || !gTempSpec || !gFileName )
stop("InitDriverSupport error");
// First try a specfic OS version folder ie 10.5
sprintf(dirSpecExtra, "/Extra/%s/", (char*)((BVRef)(uint32_t)get_env(envgBootVolume))->OSVersion);
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
snprintf(dirSpecExtra, sizeof(dirSpecExtra) ,"/Extra/%s/", (char*)((BVRef)(uint32_t)get_env(envgBootVolume))->OSVersion);
if (FileLoadDrivers(dirSpecExtra, DEFAULT_DRIVER_SPEC_SIZE, 0) != 0)
{
// Next try to load Extra extensions from the selected root partition.
strlcpy(dirSpecExtra, "/Extra/", sizeof(dirSpecExtra));
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
if (FileLoadDrivers(dirSpecExtra, DEFAULT_DRIVER_SPEC_SIZE, 0) != 0)
{
// If failed, then try to load Extra extensions from the boot partition
// in case we have a separate booter partition or a bt(0,0) aliased ramdisk.
if (!((((BVRef)(uint32_t)get_env(envgBIOSBootVolume))->biosdev == ((BVRef)(uint32_t)get_env(envgBootVolume))->biosdev) && (((BVRef)(uint32_t)get_env(envgBIOSBootVolume))->part_no == ((BVRef)(uint32_t)get_env(envgBootVolume))->part_no)))
{
// First try a specfic OS version folder ie 10.5
sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", (char*)((BVRef)(uint32_t)get_env(envgBootVolume))->OSVersion);
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
snprintf(dirSpecExtra, sizeof(dirSpecExtra),"bt(0,0)/Extra/%s/", (char*)((BVRef)(uint32_t)get_env(envgBootVolume))->OSVersion);
if (FileLoadDrivers(dirSpecExtra, DEFAULT_DRIVER_SPEC_SIZE, 0) != 0)
{
// Next we'll try the base
strlcpy(dirSpecExtra, "bt(0,0)/Extra/", sizeof(dirSpecExtra));
FileLoadDrivers(dirSpecExtra, 0);
FileLoadDrivers(dirSpecExtra, DEFAULT_DRIVER_SPEC_SIZE, 0);
}
}
if (((BVRef)(uint32_t)get_env(envgBootVolume))->flags & kBVFlagBooter)
{
strlcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/", sizeof(dirSpecExtra));
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
if (FileLoadDrivers(dirSpecExtra, DEFAULT_DRIVER_SPEC_SIZE, 0) != 0)
{
strlcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/", sizeof(dirSpecExtra));
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
if (FileLoadDrivers(dirSpecExtra, DEFAULT_DRIVER_SPEC_SIZE, 0) != 0)
{
strlcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/", sizeof(dirSpecExtra));
FileLoadDrivers(dirSpecExtra, 0);
FileLoadDrivers(dirSpecExtra, DEFAULT_DRIVER_SPEC_SIZE, 0);
}
}
}
}
else
{
strlcpy(gExtensionsSpec, dirSpec, 4096);
strcat(gExtensionsSpec, "System/Library/");
FileLoadDrivers(gExtensionsSpec, 0);
strlcpy(gExtensionsSpec, dirSpec, DEFAULT_DRIVER_SPEC_SIZE);
strlcat(gExtensionsSpec, "System/Library/", DEFAULT_DRIVER_SPEC_SIZE);
FileLoadDrivers(gExtensionsSpec, DEFAULT_DRIVER_SPEC_SIZE, 0);
}
}
else
long ret, flags, time, time2;
char altDirSpec[512];
sprintf (altDirSpec, "%s%s", dirSpec, extDirSpec);
snprintf (altDirSpec, sizeof(altDirSpec),"%s%s", dirSpec, extDirSpec);
ret = GetFileInfo(altDirSpec, "Extensions.mkext", &flags, &time);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat))
{
if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeDirectory) ||
(((get_env(envgBootMode) & kBootModeSafe) == 0) && (time == (time2 + 1))))
{
sprintf(gDriverSpec, "%sExtensions.mkext", altDirSpec);
snprintf(gDriverSpec, DEFAULT_DRIVER_SPEC_SIZE,"%sExtensions.mkext", altDirSpec);
verbose("LoadDrivers: Loading from [%s]\n", gDriverSpec);
if (LoadDriverMKext(gDriverSpec) == 0) return 0;
}
// FileLoadDrivers
long
FileLoadDrivers( char * dirSpec, long plugin )
FileLoadDrivers( char * dirSpec, long size, long plugin )
{
long ret, length, flags, time, bundleType;
long long index;
else if (FileLoadMKext(dirSpec, "") == 0)
return 0;
strcat(dirSpec, "Extensions");
strlcat(dirSpec, "Extensions", size);
// here we are clearely in a situation where we'll have to load all drivers as with the option -f, in my experience, sometime it can help to add it explicitly in the bootargs
extern void addBootArg(const char * );
if (strcmp(name + length - 5, ".kext")) continue;
// Save the file name.
strlcpy(gFileName, name, 4096);
strlcpy(gFileName, name, DEFAULT_DRIVER_SPEC_SIZE);
// Determine the bundle type.
sprintf(gTempSpec, "%s/%s", dirSpec, gFileName);
snprintf(gTempSpec, DEFAULT_DRIVER_SPEC_SIZE,"%s/%s", dirSpec, gFileName);
ret = GetFileInfo(gTempSpec, "Contents", &flags, &time);
if (ret == 0) bundleType = kCFBundleType2;
else bundleType = kCFBundleType3;
if (!plugin)
sprintf(gDriverSpec, "%s/%s/%sPlugIns", dirSpec, gFileName,
snprintf(gDriverSpec, DEFAULT_DRIVER_SPEC_SIZE,"%s/%s/%sPlugIns", dirSpec, gFileName,
(bundleType == kCFBundleType2) ? "Contents/" : "");
ret = LoadDriverPList(dirSpec, gFileName, bundleType);
result = ret;
if (!plugin)
FileLoadDrivers(gDriverSpec, 1);
FileLoadDrivers(gDriverSpec, 0, 1);
}
return result;
#endif
// INTEL modification
sprintf(gDriverSpec, "%s%s.mkext", dirSpec, bootInfo->bootFile);
snprintf(gDriverSpec, DEFAULT_DRIVER_SPEC_SIZE,"%s%s.mkext", dirSpec, bootInfo->bootFile);
verbose("NetLoadDrivers: Loading from [%s]\n", gDriverSpec);
memcpy((void *)driversAddr, (void *)package, driversLength);
// Add the MKext to the memory map.
sprintf(segName, "DriversPackage-%lx", driversAddr);
snprintf(segName, sizeof(segName),"DriversPackage-%lx", driversAddr);
AllocateMemoryRange(segName, driversAddr, driversLength);
do {
// Save the driver path.
sprintf(gFileSpec, "%s/%s/%s", dirSpec, name,
snprintf(gFileSpec, DEFAULT_DRIVER_SPEC_SIZE,"%s/%s/%s", dirSpec, name,
(bundleType == kCFBundleType2) ? "Contents/MacOS/" : "");
executablePathLength = strlen(gFileSpec) + 1;
strlcpy(tmpExecutablePath, gFileSpec, executablePathLength);
sprintf(gFileSpec, "%s/%s", dirSpec, name);
snprintf(gFileSpec, DEFAULT_DRIVER_SPEC_SIZE,"%s/%s", dirSpec, name);
bundlePathLength = strlen(gFileSpec) + 1;
tmpBundlePath = malloc(bundlePathLength);
// Construct the file spec to the plist, then load it.
sprintf(gFileSpec, "%s/%s/%sInfo.plist", dirSpec, name,
snprintf(gFileSpec, DEFAULT_DRIVER_SPEC_SIZE,"%s/%s/%sInfo.plist", dirSpec, name,
(bundleType == kCFBundleType2) ? "Contents/" : "");
length = LoadFile(gFileSpec);
if (prop != 0)
{
fileName = prop->string;
sprintf(gFileSpec, "%s%s", module->executablePath, fileName);
snprintf(gFileSpec, DEFAULT_DRIVER_SPEC_SIZE,"%s%s", module->executablePath, fileName);
length = LoadThinFatFile(gFileSpec, &executableAddr);
if (length == 0)
{
strlcpy(driver->bundlePathAddr, module->bundlePath, module->bundlePathLength);
// Add an entry to the memory map.
sprintf(segName, "Driver-%lx", (unsigned long)driver);
snprintf(segName, sizeof(segName),"Driver-%lx", (unsigned long)driver);
AllocateMemoryRange(segName, driverAddr, driverLength);
branches/cparm/i386/boot2/drivers.h
4040
4141
4242
43
44
4345
4446
4547
......
5355
5456
5557
56
58
5759
60
61
62
63
64
65
66
67
68
69
70
71
5872
59
73
6074
6175
#include "xml.h"
#include "modules.h"
#define DEFAULT_DRIVER_SPEC_SIZE 4096
struct compressed_kernel_header {
u_int32_t signature;
u_int32_t compress_type;
};
typedef struct compressed_kernel_header compressed_kernel_header;
extern long LoadDrivers(char * dirSpec);
extern long LoadDrivers( char * dirSpec );
extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);
extern long InitDriverSupport(void);
extern long FileLoadDrivers(char *dirSpec, long size,long plugin);
extern long LoadDriverMKext(char *fileSpec);
extern long LoadDriverPList(char *dirSpec, char *name, long bundleType);
extern long LoadMatchedModules(void);
extern long MatchLibraries(void);
#if UNUSED
extern long MatchPersonalities(void);
#endif
#ifdef NBP_SUPPORT
extern long NetLoadDrivers(char *dirSpec);
#endif
typedef long (*FileLoadDrivers_t)(char *dirSpec, long plugin);
typedef long (*FileLoadDrivers_t)(char *dirSpec, long size, long plugin);
#endif /* _BOOT2_DRIVERS_H */
branches/cparm/i386/boot2/options.c
181181
182182
183183
184
184
185185
186186
187187
......
536536
537537
538538
539
539
540540
541541
542542
......
700700
701701
702702
703
703
704704
705705
706706
......
12311231
12321232
12331233
1234
1234
12351235
12361236
1237
1237
12381238
12391239
12401240
1241
1241
12421242
12431243
12441244
if ( (gBootArgsPtr + strlen(argStr) + 1) < gBootArgsEnd)
{
*gBootArgsPtr++ = ' ';
strcat(gBootArgs, argStr);
strlcat(gBootArgs, argStr, BOOT_STRING_LEN);
gBootArgsPtr += strlen(argStr);
}
}
if(!buff) return 0;
char info[] = "BIOS reported memory ranges:\n";
sprintf(buff, "%s", info);
snprintf(buff, sizeof(char)*1024 ,"%s", info);
int memoryMapCount = (int)get_env(envMemoryMapCnt);
for (i=0; i<memoryMapCount; i++) {
stop("Couldn't allocate memory for the prompt\n"); //TODO: Find a better stategie
return -1;
}
sprintf(prompt, "Press ENTER to start up from %s, or press any key to enter startup options.", name);
snprintf(prompt, 256,"Press ENTER to start up from %s, or press any key to enter startup options.", name);
free(name);
}
int fd = -1;
char dirspec[512];
char filename[512];
sprintf(filename, "BootHelp.txt");
snprintf(filename, sizeof(filename), "BootHelp.txt");
// Check Extra on booting partition
sprintf(dirspec,"/Extra/%s",filename);
snprintf(dirspec, sizeof(dirspec),"/Extra/%s",filename);
fd=open (dirspec);
if (fd<0)
{// Fall back to booter partition
sprintf(dirspec,"bt(0,0)/Extra/%s",filename);
snprintf(dirspec, sizeof(dirspec),"bt(0,0)/Extra/%s",filename);
fd=open (dirspec);
if (fd<0)
{
branches/cparm/i386/boot2/Makefile
4545
4646
4747
48
48
4949
5050
5151
MKDIRS = /bin/mkdir -p
endif
AS = as
LD = gcc
LD = $(BINROOT)/ld_classic
# LIBS= -lc_static
LIBS= -L$(SYMDIR) -lsaio -lsa
LIBDEP= $(SYMDIR)/libsaio.a $(SYMDIR)/libsa.a
branches/cparm/i386/modules/NetbookInstaller/NBI.c
2525
2626
2727
28
29
30
31
28
3229
33
34
35
36
37
38
39
40
41
42
43
4430
4531
4632
......
153139
154140
155141
156
142
157143
158144
159145
......
221207
222208
223209
224
225
210
211
226212
227213
228214
229215
230216
231217
232
233
218
219
234220
235
236
221
222
237223
238
239
224
225
240226
241227
242228
......
256242
257243
258244
259
260
261
245
246
247
262248
263249
264250
//void NBI_loadBootGraphics(void);
void NBI_md0Ramdisk_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
#ifdef NBP_SUPPORT
extern long NetLoadDrivers(char *dirSpec);
#endif
extern long FileLoadDrivers(char *dirSpec, long plugin);
//extern long GetDriverGbl(void);
extern long LoadDriverMKext(char *fileSpec);
extern long LoadDriverPList(char *dirSpec, char *name, long bundleType);
extern long MatchLibraries( void );
#if UNUSED
extern long MatchPersonalities( void );
#endif
extern long LoadMatchedModules( void );
extern long InitDriverSupport(void);
extern long GetDriverGbl(void);
void NetbookInstaller_start(void);
void NetbookInstaller_start(void)
{
// TODO: embed NBI.img in this file
// If runNetbookInstaller is true, then the system has changed states, patch it
sprintf(filename, "%s", "Extra/NetbookInstaller.img");;
snprintf(filename, sizeof(filename),"%s", "Extra/NetbookInstaller.img");;
fh = open(filename);
if (fh >= 0)
if ( get_env(envgBootFileType) == kBlockDeviceType )
{
verbose("Loading Recovery Extensions\n");
strcpy(dirSpecExtra, "/Extra/RecoveryExtensions/");
FileLoadDrivers(dirSpecExtra, 0);
strlcpy(dirSpecExtra, "/Extra/RecoveryExtensions/", sizeof(dirSpecExtra));
FileLoadDrivers(dirSpecExtra, sizeof(dirSpecExtra), 0);
#ifdef BOOT_HELPER_SUPPORT
// TODO: fix this, the order does matter, and it's not correct now.
// Also try to load Extensions from boot helper partitions.
if (((BVRef)(uint32_t)get_env(envgBootVolume))->flags & kBVFlagBooter)
{
strcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/");
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
strlcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/", sizeof(dirSpecExtra));
if (FileLoadDrivers(dirSpecExtra, sizeof(dirSpecExtra), 0) != 0)
{
strcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/");
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
strlcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/", sizeof(dirSpecExtra));
if (FileLoadDrivers(dirSpecExtra, sizeof(dirSpecExtra), 0) != 0)
{
strcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/");
FileLoadDrivers(dirSpecExtra, 0);
strlcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/", sizeof(dirSpecExtra));
FileLoadDrivers(dirSpecExtra, sizeof(dirSpecExtra), 0);
}
}
}
{
char * ExtensionsSpec = (char*)(uint32_t)get_env(envDriverExtSpec);
strcpy(ExtensionsSpec, dirSpec);
strcat(ExtensionsSpec, "System/Library/");
FileLoadDrivers(ExtensionsSpec, 0);
strlcpy(ExtensionsSpec, dirSpec, DEFAULT_DRIVER_SPEC_SIZE);
strlcat(ExtensionsSpec, "System/Library/", DEFAULT_DRIVER_SPEC_SIZE);
FileLoadDrivers(ExtensionsSpec,DEFAULT_DRIVER_SPEC_SIZE, 0);
}
}
else
branches/cparm/i386/modules/RamDiskLoader/ramdisk.h
3232
3333
3434
35
36
3735
3836
3937
extern BVRef gRAMDiskVolume;
extern bool gRAMDiskBTAliased;
extern long FileLoadDrivers(char *dirSpec, long plugin);
extern void setRAMDiskBTHook(bool mode);
extern int mountRAMDisk(const char * param);
extern void processRAMDiskCommand(char ** argPtr, const char * cmd);
branches/cparm/i386/modules/RamDiskLoader/RamDiskLoader.c
6161
6262
6363
64
65
64
65
6666
6767
68
69
68
69
7070
7171
7272
7373
74
75
74
75
7676
7777
78
79
78
79
8080
8181
8282
break;
case 1:
// First try a specfic OS version folder ie 10.5
sprintf(dirSpecExtra, "rd(0,0)/Extra/%s/", (char*)((BVRef)(uint32_t)get_env(envgBootVolume))->OSVersion);
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
snprintf(dirSpecExtra, sizeof(dirSpecExtra),"rd(0,0)/Extra/%s/", (char*)((BVRef)(uint32_t)get_env(envgBootVolume))->OSVersion);
if (FileLoadDrivers(dirSpecExtra, sizeof(dirSpecExtra),0) != 0)
{
// Next we'll try the base
strcpy(dirSpecExtra, "rd(0,0)/Extra/");
FileLoadDrivers(dirSpecExtra, 0);
strlcpy(dirSpecExtra, "rd(0,0)/Extra/",sizeof(dirSpecExtra));
FileLoadDrivers(dirSpecExtra,sizeof(dirSpecExtra), 0);
}
break;
case 2:
// First try a specfic OS version folder ie 10.5
sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", (char*)((BVRef)(uint32_t)get_env(envgBootVolume))->OSVersion);
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
snprintf(dirSpecExtra, sizeof(dirSpecExtra),"bt(0,0)/Extra/%s/", (char*)((BVRef)(uint32_t)get_env(envgBootVolume))->OSVersion);
if (FileLoadDrivers(dirSpecExtra,sizeof(dirSpecExtra), 0) != 0)
{
// Next we'll try the base
strcpy(dirSpecExtra, "bt(0,0)/Extra/");
FileLoadDrivers(dirSpecExtra, 0);
strlcpy(dirSpecExtra, "bt(0,0)/Extra/",sizeof(dirSpecExtra));
FileLoadDrivers(dirSpecExtra,sizeof(dirSpecExtra), 0);
}
break;
default:
branches/cparm/i386/modules/RamDiskLoader/ramdisk.c
4444
4545
4646
47
47
4848
4949
5050
5151
52
52
5353
5454
5555
5656
57
57
5858
5959
6060
6161
62
62
6363
6464
6565
......
6868
6969
7070
71
71
7272
7373
7474
7575
76
76
7777
7878
7979
8080
81
81
8282
8383
8484
......
182182
183183
184184
185
185
186186
187187
188188
......
219219
220220
221221
222
222
223223
224224
225225
......
406406
407407
408408
409
409
410410
411411
412412
......
414414
415415
416416
417
417
418418
419419
420420
DEFAULT_BOOT_CONFIG))
{
// Use user specified md0 file
sprintf(filename, "%s", override_filename);
snprintf(filename, sizeof(filename) ,"%s", override_filename);
fh = open(filename);
if(fh < 0)
{
sprintf(filename, "bt(0,0)/Extra/%s", override_filename);
snprintf(filename, sizeof(filename) ,"bt(0,0)/Extra/%s", override_filename);
fh = open(filename);
if(fh < 0)
{
sprintf(filename, "rd(0,0)/Extra/%s", override_filename);
snprintf(filename, sizeof(filename) ,"rd(0,0)/Extra/%s", override_filename);
fh = open(filename);
if(fh < 0)
{
sprintf(filename, "/Extra/%s", override_filename);
snprintf(filename, sizeof(filename) ,"/Extra/%s", override_filename);
fh = open(filename);
}
}
if(fh < 0)
{
sprintf(filename, "bt(0,0)/Extra/Postboot.img");
snprintf(filename, sizeof(filename) ,"bt(0,0)/Extra/Postboot.img");
fh = open(filename);
if(fh < 0)
{
sprintf(filename, "rd(0,0)/Extra/Postboot.img");
snprintf(filename, sizeof(filename) ,"rd(0,0)/Extra/Postboot.img");
fh = open(filename);
if(fh < 0)
{
sprintf(filename, "/Extra/Postboot.img");// Check /Extra if not in rd(0,0)
snprintf(filename, sizeof(filename) ,"/Extra/Postboot.img");// Check /Extra if not in rd(0,0)
fh = open(filename);
}
}
if (error == 0)
{
// Save filename in gRAMDiskFile to display information.
strcpy(gRAMDiskFile, param);
strlcpy(gRAMDiskFile, param, sizeof(gRAMDiskFile));
// Set gRAMDiskMI as well for the multiboot ramdisk driver hook.
gRAMDiskMI = malloc(sizeof(multiboot_info));
char dirSpec[128];
// Reading ramdisk configuration.
strcpy(dirSpec, RAMDISKCONFIG_FILENAME);
strlcpy(dirSpec, RAMDISKCONFIG_FILENAME, sizeof(dirSpec));
if (loadConfigFile(dirSpec, &ramdiskConfig) == 0)
{
}
for(; ramdiskChain != NULL; ramdiskChain = ramdiskChain->next)
{
sprintf(extensionsSpec, "rd(%d,%d)/Extra/", ramdiskUnit, ramdiskChain->part_no);
snprintf(extensionsSpec, sizeof(extensionsSpec) ,"rd(%d,%d)/Extra/", ramdiskUnit, ramdiskChain->part_no);
ret = GetFileInfo(NULL, extensionsSpec, &flags, &cachetime);
if (((flags & kFileTypeMask) != kFileTypeDirectory)) continue;
ret = FileLoadDrivers_p(extensionsSpec, 0 /* this is a kext root dir, not a kext with plugins */);
ret = FileLoadDrivers_p(extensionsSpec, sizeof(extensionsSpec), 0 /* this is a kext root dir, not a kext with plugins */);
if(ret != 0)
{
verbose("FileLoadDrivers failed on a ramdisk\n");
branches/cparm/i386/modules/KextPatcher/kext_patcher.c
478478
479479
480480
481
481
482482
483483
484484
......
633633
634634
635635
636
636
637637
638638
639639
......
742742
743743
744744
745
745
746746
747747
748748
char* new_str = malloc(strlen("0xXXXX000&0xFFFE0000")+1);
sprintf(new_str, "0x04030000&amp;0xFFFE0000"); // todo, pass in actual class id
snprintf(new_str, strlen("0xXXXX000&0xFFFE0000")+1,"0x04030000&amp;0xFFFE0000"); // todo, pass in actual class id
char* orig_string = "0x04020000&amp;0xFFFE0000"; //XMLCastString(match_class);
char* new_str = malloc(strlen("pci14e4,xxxx")+1);
sprintf(new_str, "pci14e4,%02x", patch_bcm_deviceid);
snprintf(new_str, strlen("pci14e4,xxxx")+1,"pci14e4,%02x", patch_bcm_deviceid);
// Check to see if we *really* need to modify the plist, if not, return false
// so that *if* this were going ot be the only modified kext, the repacking code
offset =XMLCastStringOffset(XMLGetProperty(personality, (const char*)"IOPCIPrimaryMatch"));
char* newstring = malloc(strlen("0x00008086") + 1);
sprintf(newstring, "0x%04x", 0x8086 | (patch_gma_deviceid << 16));
snprintf(newstring, strlen("0x00008086") + 1,"0x%04x", 0x8086 | (patch_gma_deviceid << 16));
DBG("Replacing %s with %s\n", "0x00008086", newstring);
replace_string("0x27A28086", newstring, plistbuffer + offset, 10240);
branches/cparm/i386/modules/GUI/Makefile
2525
2626
2727
28
2829
2930
3031
......
3435
3536
3637
37
38
3839
3940
4041
4142
4243
4344
44
45
4546
4647
4748
......
127128
128129
129130
130
131
131132
132133
133
134
134135
135136
136
137
137138
138139
139140
140
141
141142
142143
143
144
144145
145146
146147
OBJROOT=../../../obj/i386/modules/$(DIR)
SYMROOT=../../../sym/i386/modules/
DSTROOT=../../../dst/i386/modules/
BINROOT = ../../../bin
UTILDIR = ../../util
INSTALLDIR = $(DSTROOT)/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/standalone
OPTIM = -Os -Oz
OPTIM = -O0 # -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" \
$(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common #-fstack-protector-all
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common -ffreestanding
DEFINES=
CONFIG = hd
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o"
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o"
GUI_module.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "GUI_module.c" $(INC) -o "$(OBJROOT)/GUI_module.o"
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "GUI_module.c" $(INC) -o "$(OBJROOT)/GUI_module.o"
gui.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "gui.c" $(INC) -o "$(OBJROOT)/gui.o"
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "gui.c" $(INC) -o "$(OBJROOT)/gui.o"
picopng.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "picopng.c" $(INC) -o "$(OBJROOT)/picopng.o"
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "picopng.c" $(INC) -o "$(OBJROOT)/picopng.o"
graphic_utils.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "graphic_utils.c" $(INC) -o "$(OBJROOT)/graphic_utils.o"
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "graphic_utils.c" $(INC) -o "$(OBJROOT)/graphic_utils.o"
art.h:
@if [ "$(PNGCRUSH)" ]; then\
branches/cparm/i386/modules/GUI/graphic_utils.c
886886
887887
888888
889
889
890890
891891
892892
small = (vbeInfo.TotalMemory < 16);
sprintf(buff, "VESA v%d.%d %d%s (%s)\n",
snprintf(buff, sizeof(char)*256,"VESA v%d.%d %d%s (%s)\n",
vbeInfo.VESAVersion >> 8,
vbeInfo.VESAVersion & 0xf,
small ? (vbeInfo.TotalMemory * 64) : (vbeInfo.TotalMemory / 16),
branches/cparm/i386/modules/Networking/Networking.c
160160
161161
162162
163
163
164164
165165
166166
device = devprop_add_device(string, wlan_dev);
if(device)
{
sprintf(tmp, "Airport");
snprintf(tmp, sizeof(tmp),"Airport");
devprop_add_value(device, "AAPL,slot-name", (uint8_t *) tmp, strlen(tmp) + 1);
devprop_add_value(device, "device_type", (uint8_t *) tmp, strlen(tmp) + 1);
branches/cparm/i386/modules/GraphicsEnabler/nvidia.c
12781278
12791279
12801280
1281
1281
12821282
12831283
12841284
......
14241424
14251425
14261426
1427
1427
14281428
14291429
14301430
......
15631563
15641564
15651565
1566
1566
15671567
1568
1568
15691569
15701570
15711571
devices_number = 1;
}
sprintf(tmp, "Slot-%x",devices_number);
snprintf(tmp, sizeof(tmp) ,"Slot-%x",devices_number);
devprop_add_value(device, "AAPL,slot-name", (uint8_t *) tmp, strlen(tmp));
safe_set_env(envDeviceNumber,devices_number+1);
}
return false;
}
sprintf(nvFilename, "/Extra/%04x_%04x.rom", (uint16_t)nvda_dev->vendor_id, (uint16_t)nvda_dev->device_id);
snprintf(nvFilename, sizeof(nvFilename) ,"/Extra/%04x_%04x.rom", (uint16_t)nvda_dev->vendor_id, (uint16_t)nvda_dev->device_id);
if (getBoolForKey(kUseNvidiaROM, &doit, DEFAULT_BOOT_CONFIG) && doit) {
verbose("Looking for nvidia video bios file %s\n", nvFilename);
nvBiosOveride = load_nvidia_bios_file(nvFilename, rom, NVIDIA_ROM_SIZE);
}
}
sprintf(biosVersion, "%s", (nvBiosOveride > 0) ? nvFilename : version_str);
snprintf(biosVersion, sizeof(biosVersion) ,"%s", (nvBiosOveride > 0) ? nvFilename : version_str);
sprintf(kNVCAP, "NVCAP_%04x", nvda_dev->device_id);
snprintf(kNVCAP, sizeof(kNVCAP) ,"NVCAP_%04x", nvda_dev->device_id);
if (getValueForKey(kNVCAP, &value, &len, DEFAULT_BOOT_CONFIG) && len == NVCAP_LEN * 2) {
uint8_tnew_NVCAP[NVCAP_LEN];
branches/cparm/i386/modules/GraphicsEnabler/ati.c
11911191
11921192
11931193
1194
1194
11951195
11961196
11971197
......
15281528
15291529
15301530
1531
1531
15321532
15331533
15341534
15351535
1536
1536
15371537
15381538
15391539
if (!do_load)
return false;
sprintf(file_name, "/Extra/%04x_%04x_%08x.rom", vendor_id, device_id, subsys_id);
snprintf(file_name, sizeof(file_name),"/Extra/%04x_%04x_%08x.rom", vendor_id, device_id, subsys_id);
if ((fd = open_bvdev("bt(0,0)", file_name)) < 0)
return false;
//card->ports = 2/1 ?; // set a min if 0 ports ?
//verbose("Nr of ports set to min: %d\n", card->ports);
sprintf(name, "ATY,%s", card->cfg_name);
snprintf(name, sizeof(name),"ATY,%s", card->cfg_name);
aty_name.type = kStr;
aty_name.size = strlen(name) + 1;
aty_name.data = (uint8_t *)name;
sprintf(name_parent, "ATY,%sParent", card->cfg_name);
snprintf(name_parent, sizeof(name_parent),"ATY,%sParent", card->cfg_name);
aty_nameparent.type = kStr;
aty_nameparent.size = strlen(name_parent) + 1;
aty_nameparent.data = (uint8_t *)name_parent;
branches/cparm/i386/modules/SMBiosGetters/mysmbios.c
830830
831831
832832
833
833
834834
835835
836836
current = structHeader->handle;
}
sprintf(key, "%s%d", keyString, idx);
snprintf(key, sizeof(key),"%s%d", keyString, idx);
if (value)
{
branches/cparm/i386/modules/HibernateEnabler/graphic_utils.c
188188
189189
190190
191
191
192192
193193
194194
//bzero( &vbeInfo, sizeof(vbeInfo) );
bzero( &vbeInfo, sizeof(VBEInfoBlock) );
strcpy( (char*)&vbeInfo, "VBE2" );
strlcpy( (char*)&vbeInfo, "VBE2", sizeof(VBEInfoBlock) );
err = getVBEInfo( &vbeInfo );
if ( err != errSuccess )
{
branches/cparm/i386/modules/Keymapper/Keylayout.c
143143
144144
145145
146
146
147147
148148
149149
if (getValueForKey("KeyLayout", &val, &len, DEFAULT_BOOT_CONFIG))
{
sprintf(layoutPath, "/Extra/Keymaps/%s", val);
snprintf(layoutPath, sizeof(layoutPath),"/Extra/Keymaps/%s", val);
// Add the extension if needed
if (len <= 4 || strcmp(val+len-4,".lyt") != 0)
strlcat(layoutPath, ".lyt", sizeof(layoutPath));
branches/cparm/i386/modules/SMBiosPatcher/smbios_patcher.c
965965
966966
967967
968
968
969969
970970
971971
......
10031003
10041004
10051005
1006
1006
10071007
10081008
10091009
......
10171017
10181018
10191019
1020
1020
10211021
10221022
10231023
......
11331133
11341134
11351135
1136
1136
11371137
11381138
11391139
......
12331233
12341234
12351235
1236
1236
12371237
12381238
12391239
......
12591259
12601260
12611261
1262
1262
12631263
12641264
12651265
intsize;
charaltname[40];
sprintf(altname, "%s_%d",smbios_properties[j].name, tablespresent[cur->type] + 1);
snprintf(altname, sizeof(altname),"%s_%d",smbios_properties[j].name, tablespresent[cur->type] + 1);
if (smbios_properties[j].table_type == cur->type &&
smbios_properties[j].value_type == SMSTRING &&
smbios_properties[j].auto_str && randomSerial && (!strcmp ("SMserial", smbios_properties[j].name))) {
intnumnec=-1;
charbuffer[40];
sprintf(buffer, "SMtable%d", i);
snprintf(buffer, sizeof(buffer),"SMtable%d", i);
if (!getIntForKey(buffer, &numnec, DEFAULT_SMBIOS_CONFIG)) {
numnec = -1;
}
intsize;
charaltname[40];
sprintf(altname, "%s_%d",smbios_properties[j].name, tablespresent[smbios_table_descriptions[i].type] + 1);
snprintf(altname, sizeof(altname), "%s_%d",smbios_properties[j].name, tablespresent[smbios_table_descriptions[i].type] + 1);
if (smbios_properties[j].table_type == smbios_table_descriptions[i].type &&
smbios_properties[j].value_type==SMSTRING &&
smbios_properties[j].auto_str && randomSerial && (!strcmp ("SMserial", smbios_properties[j].name))) {
intnum;
charaltname[40];
sprintf(altname, "%s_%d", smbios_properties[j].name, tablespresent[newcur->type] + 1);
snprintf(altname, sizeof(altname), smbios_properties[j].name, tablespresent[newcur->type] + 1);
if (smbios_properties[j].table_type == newcur->type) {
switch (smbios_properties[j].value_type) {
case SMSTRING:
intnumnec = -1;
charbuffer[40];
sprintf(buffer, "SMtable%d", i);
snprintf(buffer, sizeof(buffer),"SMtable%d", i);
if (!getIntForKey(buffer, &numnec, DEFAULT_SMBIOS_CONFIG)) {
numnec = -1;
}
intnum;
charaltname[40];
sprintf(altname, "%s_%d", smbios_properties[j].name, tablespresent[newcur->type] + 1);
snprintf(altname, sizeof(altname),"%s_%d", smbios_properties[j].name, tablespresent[newcur->type] + 1);
if (smbios_properties[j].table_type == newcur->type) {
switch (smbios_properties[j].value_type) {
case SMSTRING:
branches/cparm/i386/modules/Memory/mem.c
4848
4949
5050
51
51
5252
5353
54
54
5555
56
56
5757
5858
5959
6060
61
61
6262
6363
6464
......
9696
9797
9898
99
99
100100
101101
102102
}
if (len%STEP==0) return;
sprintf(buffer,"%02x:", i);
snprintf(buffer, sizeof(buffer),"%02x:", i);
for (j=0; j < STEP; j++) {
if (j<(len%STEP))
sprintf(str, " %02x", ad[i+j]);
snprintf(str, sizeof(str)," %02x", ad[i+j]);
else
strcpy(str, " " );
strlcpy(str, " " , sizeof(str));
strlcat(buffer, str, sizeof(buffer));
}
strlcat(buffer," ", sizeof(buffer));
for (j=0; j < (len%STEP); j++) {
sprintf(str, "%c", DC(ad[i+j]));
snprintf(str, sizeof(str) ,"%c", DC(ad[i+j]));
strlcat(buffer, str, sizeof(buffer));
}
printf("%s\n",buffer);
for(dmihdr = FindFirstDmiTableOfType(i, 4);
dmihdr;
dmihdr = FindNextDmiTableOfType(i, 4)) {
sprintf(title,"Table (type %d) :" , i);
snprintf(title,sizeof(title),"Table (type %d) :" , i);
dumpPhysAddr(title, dmihdr, dmihdr->length+32);
}
}
branches/cparm/i386/modules/Memory/spd.c
221221
222222
223223
224
224
225225
226226
227227
228
228
229229
230230
231231
if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) // DDR3
{
sprintf(asciiSerial, "%X%X%X%X%X%X%X%X", SMST(122) /*& 0x7*/, SLST(122), SMST(123), SLST(123), SMST(124), SLST(124), SMST(125), SLST(125));
snprintf(asciiSerial, sizeof(asciiSerial),"%X%X%X%X%X%X%X%X", SMST(122) /*& 0x7*/, SLST(122), SMST(123), SLST(123), SMST(124), SLST(124), SMST(125), SLST(125));
}
else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2) // DDR2 or DDR
{
sprintf(asciiSerial, "%X%X%X%X%X%X%X%X", SMST(95) /*& 0x7*/, SLST(95), SMST(96), SLST(96), SMST(97), SLST(97), SMST(98), SLST(98));
snprintf(asciiSerial, sizeof(asciiSerial),"%X%X%X%X%X%X%X%X", SMST(95) /*& 0x7*/, SLST(95), SMST(96), SLST(96), SMST(97), SLST(97), SMST(98), SLST(98));
}
return strdup(asciiSerial);
branches/cparm/i386/modules/ACPICodec/acpi_codec.c
565565
566566
567567
568
568
569569
570570
571571
......
16241624
16251625
16261626
1627
1627
16281628
16291629
16301630
......
16361636
16371637
16381638
1639
1639
16401640
16411641
16421642
......
18011801
18021802
18031803
1804
1804
18051805
18061806
18071807
18081808
18091809
1810
1810
18111811
18121812
18131813
......
44014401
44024402
44034403
4404
4404
44054405
44064406
44074407
......
45804580
45814581
45824582
4583
4583
45844584
45854585
45864586
......
47544754
47554755
47564756
4757
4757
47584758
47594759
47604760
......
47644764
47654765
47664766
4767
4767
47684768
47694769
47704770
......
47734773
47744774
47754775
4776
4776
47774777
47784778
47794779
DBG("Searching for %s file ...\n", filename);
// Check booting partition
sprintf(acpi_file, "%s%s",dirspec, filename);
snprintf(acpi_file, sizeof(acpi_file), "%s%s",dirspec, filename);
safe_set_env(envHFSLoadVerbose, 0);
fd=open(acpi_file);
{
U32 dropPSS = 0, Pstatus = 0;
char MatchStat[5];
char MatchStat[4+1];
#ifdef pstate_power_support
U32 TDP = compute_tdp(cpu);
#endif
if ((pstate_tag_count > 0) && PstateTag)
{
sprintf(MatchStat, "%d",i);
snprintf(MatchStat, sizeof(MatchStat),"%d",i);
TagPtr match_Status = XMLGetProperty(PstateTag, (const char*)MatchStat);
if (match_Status && (XMLTagCount(match_Status) > 0))
{
U32 i;
char MatchStat[5];
char MatchStat[4+1];
for (i = 0; i < 32 ; i++)
{
char *Lat = NULL, *Pw = NULL, *BWidth= NULL, *BOffset= NULL, *Address= NULL, *AccessSize= NULL, *index= NULL;
sprintf(MatchStat, "C%d",i);
snprintf(MatchStat, sizeof(MatchStat),"C%d",i);
TagPtr match_Status = XMLGetProperty(CstateTag, (const char*)MatchStat);
if (match_Status)
{
{
bool oem = false;
char oemOption[OEMOPT_SIZE];
sprintf(oemOption, "oem%s",tableSig );
snprintf(oemOption, sizeof(oemOption), "oem%s",tableSig );
if (getBoolForKey(oemOption, &oem, personality) && oem) // This method don't work for DSDT and FACS
{
{
bool oem = false;
char oemOption[OEMOPT_SIZE];
sprintf(oemOption, "oem%s",tableSig );
snprintf(oemOption, sizeof(oemOption),"oem%s",tableSig );
if (getBoolForKey(oemOption, &oem, personality) && oem) // This method don't work for DSDT and FACS
{
DBG(" %s required\n", oemOption);
ret = GetFileInfo("rd(0,0)/Extra/", "Acpi", &flags, &time);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory))
{
sprintf(dirspec, "rd(0,0)/Extra/Acpi/");
snprintf(dirspec, sizeof(dirspec),"rd(0,0)/Extra/Acpi/");
acpidir_found = true;
}
ret = GetFileInfo("/Extra/", "Acpi", &flags, &time);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory))
{
sprintf(dirspec, "/Extra/Acpi/");
snprintf(dirspec, sizeof(dirspec), "/Extra/Acpi/");
acpidir_found = true;
}
ret = GetFileInfo("bt(0,0)/Extra/", "Acpi", &flags, &time);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory))
{
sprintf(dirspec, "bt(0,0)/Extra/Acpi/");
snprintf(dirspec, sizeof(dirspec),"bt(0,0)/Extra/Acpi/");
acpidir_found = true;
}
branches/cparm/i386/libsa/efi_tables.h
99
1010
1111
12
12
1313
1414
1515
uint32_t crc32(uint32_t crc, const void *buf, size_t size);
void efi_guid_unparse_upper(EFI_GUID const *pGuid, char *out);
void efi_guid_unparse_upper(EFI_GUID const *pGuid, char *out, long strMaxlen);
bool efi_guid_is_null(EFI_GUID const *pGuid);
int efi_guid_compare(EFI_GUID const *pG1, EFI_GUID const *pG2);
branches/cparm/i386/libsa/efi_tables.c
115115
116116
117117
118
118
119119
120
120
121121
122122
123123
* Utility function to make a device tree string from an EFI_GUID
*/
void efi_guid_unparse_upper(EFI_GUID const *pGuid, char *out)
void efi_guid_unparse_upper(EFI_GUID const *pGuid, char *out, long strMaxlen)
{
sprintf(out, "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
snprintf(out, strMaxlen, "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
pGuid->Data1, /* - */
pGuid->Data2, /* - */
pGuid->Data3, /* - */
branches/cparm/i386/util/md.c
9191
9292
9393
94
95
96
97
94
95
96
97
9898
9999
100
100
101101
102102
103103
104
104
105105
106
106
107107
108108
109109
110110
111111
112
113
112
113
114114
115
116
117
118
119
120
121
122
123
115
116
117
118
119
120
121
122
124123
125
126
127
128
129
130
131
132
133
134
135
124
125
126
127
128
129
130
131
132
133
134
136135
137136
138
139
140
141
142
143
144
137
145138
146
139
140
141
142
143
144
147145
146
147
148148
149149
150150
......
294294
295295
296296
297
297298
298299
299300
......
523524
524525
525526
526
527
527
528528
529529
530530
......
576576
577577
578578
579
580
579
581580
582581
583582
584
585
583
584
586585
587586
588587
#define OLDSALUTATION "# DO NOT DELETE THIS LINE"
#define OLDSALUTATIONLEN (sizeof OLDSALUTATION - 1)
char file_array[IObuffer]; /* read file and store crunched names */
char dep_line[LINESIZE]; /* line being processed */
char dot_o[LINESIZE]; /* <foo.o>: prefix */
char *path_component[100]; /* stores components for a path while being
static char file_array[IObuffer]; /* read file and store crunched names */
static char dep_line[LINESIZE]; /* line being processed */
static char dot_o[LINESIZE]; /* <foo.o>: prefix */
static char *path_component[100]; /* stores components for a path while being
crunched */
struct dep { /* stores paths that a file depends on */
static struct dep { /* stores paths that a file depends on */
int len;
char *str;
} dep_files[1000];
int dep_file_index;
static int dep_file_index;
int qsort_strcmp(struct dep *a, struct dep *b)
static int qsort_strcmp(struct dep *a, struct dep *b)
{
extern int strcmp();
return strcmp(a->str, b->str);
}
char *outfile = (char *) 0; /* generate dependency file */
FILE *out;
static char *outfile = (char *) 0; /* generate dependency file */
static FILE *out;
char *makefile = (char *) 0; /* user supplied makefile name */
char *real_mak_name; /* actual makefile name (if not supplied) */
char shadow_mak_name[LINESIZE]; /* changes done here then renamed */
FILE *mak; /* for reading makefile */
FILE *makout; /* for writing shadow */
char makbuf[LINESIZE]; /* one line buffer for makefile */
struct stat makstat; /* stat of makefile for time comparisons */
int mak_eof = 0; /* eof seen on makefile */
FILE *find_mak(), *temp_mak();
static char *makefile = (char *) 0; /* user supplied makefile name */
static char *real_mak_name; /* actual makefile name (if not supplied) */
static char shadow_mak_name[LINESIZE]; /* changes done here then renamed */
static FILE *mak; /* for reading makefile */
static FILE *makout; /* for writing shadow */
static char makbuf[LINESIZE]; /* one line buffer for makefile */
static struct stat makstat; /* stat of makefile for time comparisons */
static int mak_eof = 0; /* eof seen on makefile */
int delete = 0; /* -d delete dependency file */
int debug = 0;
int D_contents = 0; /* print file contents */
int D_depend = 0; /* print dependency processing info */
int D_make = 0; /* print makefile processing info */
int D_open = 0; /* print after succesful open */
int D_time = 0; /* print time comparison info */
int force = 1; /* always update dependency info */
int update = 0; /* it's ok if the -m file does not exist */
int verbose = 0; /* tell me something */
int expunge = 0; /* first flush dependency stuff from makefile */
static int delete = 0; /* -d delete dependency file */
static int debug = 0;
static int D_contents = 0; /* print file contents */
static int D_depend = 0; /* print dependency processing info */
static int D_make = 0; /* print makefile processing info */
static int D_open = 0; /* print after succesful open */
static int D_time = 0; /* print time comparison info */
static int force = 1; /* always update dependency info */
static int update = 0; /* it's ok if the -m file does not exist */
static int verbose = 0; /* tell me something */
static int expunge = 0; /* first flush dependency stuff from makefile */
char *name;
static void scan_mak(FILE *, FILE *, char *);
static void finish_mak(FILE *, FILE *);
static void output_dep(FILE *out);
static void parse_dep(void);
static void save_dot_o(void);
static char *name;
static int read_dep(register char *file);
static void skip_mak(register FILE *makin, register FILE *makout);
static void save_dot_o(void);
static void parse_dep(void);
static void output_dep(FILE *out);
static FILE *find_mak(char *file);
static FILE *temp_mak(void);
static void scan_mak(FILE *, FILE *, char *);
static void expunge_mak(register FILE *makin, register FILE *makout);
static void skip_mak(register FILE *makin, register FILE *makout);
static void finish_mak(FILE *, FILE *);
int main(int argc, register char **argv)
{
usage:
fprintf(stderr, "usage: md -f -Dcdmot -m makefile -o outputfile -v <file1> ... <filen>\n");
exit(1);
return 1;
}
}
/* process makefile */
FILE *
find_mak(char *file)
static FILE *find_mak(char *file)
{
FILE *mak;
return mak;
}
FILE *
temp_mak()
static FILE *temp_mak(void)
{
FILE *mak;
strcpy(shadow_mak_name, real_mak_name);
strcat(shadow_mak_name, ".md");
strlcpy(shadow_mak_name, real_mak_name, sizeof(shadow_mak_name));
strlcat(shadow_mak_name, ".md", sizeof(shadow_mak_name));
/*
* For SGS stuff, in case still linked to master version
branches/cparm/i386/util/amlsgn.m
128128
129129
130130
131
131
132132
133133
134134
static char msg[UUID_STR_LEN] = "";
if (!eUUID) return "";
const unsigned char * uuid = (unsigned char*) eUUID;
sprintf(msg, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
snprintf(msg, sizeof(msg), "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
uuid[0], uuid[1], uuid[2], uuid[3],
uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10],uuid[11],

Archive Download the corresponding diff file

Revision: 2044