Chameleon

Chameleon Commit Details

Date:2015-03-05 17:45:59 (9 years 1 month ago)
Author:ErmaC
Commit:2590
Parents: 2589
Message:Typo.
Changes:
M/trunk/i386/libsaio/fake_efi.c

File differences

trunk/i386/libsaio/fake_efi.c
145145
146146
147147
148
148
149149
150150
151151
152152
153
153
154154
155155
156156
......
192192
193193
194194
195
196
197
195
196
197
198198
199199
200200
......
262262
263263
264264
265
266
265
266
267267
268268
269269
......
303303
304304
305305
306
306
307307
308308
309309
......
371371
372372
373373
374
375
374
375
376376
377377
378378
......
465465
466466
467467
468
468
469469
470470
471471
......
491491
492492
493493
494
494
495495
496
497
498
496
497
498
499
500
499501
500
502
501503
502504
503505
......
526528
527529
528530
529
531
530532
531533
532534
......
543545
544546
545547
546
548
547549
548550
549551
......
568570
569571
570572
571
572
573
574
573575
574576
575577
......
636638
637639
638640
639
641
642
640643
641644
642645
643646
644
647
648
645649
646650
647651
648
652
653
649654
650655
651656
......
653658
654659
655660
656
657
661
662
663
658664
659665
660666
661667
662668
663669
664
670
671
665672
666673
667674
668675
669
676
677
670678
671679
672680
DT__AddProperty(tableNode, "guid", sizeof(EFI_GUID), (void *)pGuid);
// The "table" property is the 32-bit (in our implementation) physical address of the table
DT__AddProperty(tableNode, "table", sizeof(void*) * 2, table);
DT__AddProperty(tableNode, "table", sizeof(void *) * 2, table);
// Assume the alias pointer is a global or static piece of data
if (alias != NULL)
{
DT__AddProperty(tableNode, "alias", strlen(alias)+1, (char*)alias);
DT__AddProperty(tableNode, "alias", strlen(alias)+1, (char *)alias);
}
return EFI_SUCCESS;
uint8_t voidret_instructions[sizeof(VOIDRET_INSTRUCTIONS)/sizeof(uint8_t)];
uint8_t unsupportedret_instructions[sizeof(UNSUPPORTEDRET_INSTRUCTIONS_32)/sizeof(uint8_t)];
};
struct fake_efi_pages *fakeEfiPages = (struct fake_efi_pages*)AllocateKernelMemory(sizeof(struct fake_efi_pages));
struct fake_efi_pages *fakeEfiPages = (struct fake_efi_pages *)AllocateKernelMemory(sizeof(struct fake_efi_pages));
// Zero out all the tables in case fields are added later
//bzero(fakeEfiPages, sizeof(struct fake_efi_pages));
// but it is nice if we can at least prevent a complete crash by
// at least providing some sort of implementation until one can be provided
// nicely in a kext.
void (*voidret_fp)() = (void*)fakeEfiPages->voidret_instructions;
void (*unsupportedret_fp)() = (void*)fakeEfiPages->unsupportedret_instructions;
void (*voidret_fp)() = (void *)fakeEfiPages->voidret_instructions;
void (*unsupportedret_fp)() = (void *)fakeEfiPages->unsupportedret_instructions;
efiRuntimeServices->GetTime = (EFI_PTR32)unsupportedret_fp;
efiRuntimeServices->SetTime = (EFI_PTR32)unsupportedret_fp;
efiRuntimeServices->GetWakeupTime = (EFI_PTR32)unsupportedret_fp;
uint8_t unsupportedret_instructions[sizeof(UNSUPPORTEDRET_INSTRUCTIONS_64)/sizeof(uint8_t)];
};
struct fake_efi_pages *fakeEfiPages = (struct fake_efi_pages*)AllocateKernelMemory(sizeof(struct fake_efi_pages));
struct fake_efi_pages *fakeEfiPages = (struct fake_efi_pages *)AllocateKernelMemory(sizeof(struct fake_efi_pages));
// Zero out all the tables in case fields are added later
//bzero(fakeEfiPages, sizeof(struct fake_efi_pages));
// at least providing some sort of implementation until one can be provided
// nicely in a kext.
void (*voidret_fp)() = (void*)fakeEfiPages->voidret_instructions;
void (*unsupportedret_fp)() = (void*)fakeEfiPages->unsupportedret_instructions;
void (*voidret_fp)() = (void *)fakeEfiPages->voidret_instructions;
void (*unsupportedret_fp)() = (void *)fakeEfiPages->unsupportedret_instructions;
efiRuntimeServices->GetTime = ptov64((EFI_PTR32)unsupportedret_fp);
efiRuntimeServices->SetTime = ptov64((EFI_PTR32)unsupportedret_fp);
efiRuntimeServices->GetWakeupTime = ptov64((EFI_PTR32)unsupportedret_fp);
/*
* Get an smbios option string option to convert to EFI_CHAR16 string
*/
static EFI_CHAR16* getSmbiosChar16(const char * key, size_t* len)
static EFI_CHAR16 *getSmbiosChar16(const char *key, size_t *len)
{
const char*src = getStringForKey(key, &bootInfo->smbiosConfig);
EFI_CHAR16* dst = 0;
/*
* Get the SystemID from the bios dmi info
staticEFI_CHAR8* getSmbiosUUID()
staticEFI_CHAR8 *getSmbiosUUID()
{
static EFI_CHAR8 uuid[UUID_LEN];
int i, isZero, isOnes;
SMBByte*p;
static EFI_CHAR8uuid[UUID_LEN];
inti;
intisZero;
intisOnes;
SMBByte*p;
p = (SMBByte*)Platform.UUID;
p = (SMBByte *)Platform.UUID;
for (i=0, isZero=1, isOnes=1; i<UUID_LEN; i++)
{
// return a binary UUID value from the overriden SystemID and SMUUID if found,
// or from the bios if not, or from a fixed value if no bios value is found
static EFI_CHAR8* getSystemID()
static EFI_CHAR8 *getSystemID()
{
// unable to determine UUID for host. Error: 35 fix
// Rek: new SMsystemid option conforming to smbios notation standards, this option should
if (!ret)
{
// no bios dmi UUID available, set a fixed value for system-id
ret=getUUIDFromString((sysId = (const char*) SYSTEM_ID));
ret=getUUIDFromString((sysId = (const char *) SYSTEM_ID));
}
verbose("Customizing SystemID with : %s\n", getStringFromUUID(ret)); // apply a nice formatting to the displayed output
return ret;
void setupEfiDeviceTree(void)
{
// EFI_CHAR8* ret = 0; Bungo: not used
EFI_CHAR16* ret16 = 0;
// EFI_CHAR8*ret = 0; Bungo: not used
EFI_CHAR16*ret16 = 0;
size_t len = 0;
Node*node;
// the value in the fsbFrequency global and not an malloc'd pointer
// because the DT_AddProperty function does not copy its args.
if (Platform.CPU.FSBFrequency != 0) {
if (Platform.CPU.FSBFrequency != 0)
{
DT__AddProperty(efiPlatformNode, FSB_Frequency_prop, sizeof(uint64_t), &Platform.CPU.FSBFrequency);
}
// Export TSC and CPU frequencies for use by the kernel or KEXTs
if (Platform.CPU.TSCFrequency != 0) {
if (Platform.CPU.TSCFrequency != 0)
{
DT__AddProperty(efiPlatformNode, TSC_Frequency_prop, sizeof(uint64_t), &Platform.CPU.TSCFrequency);
}
if (Platform.CPU.CPUFrequency != 0) {
if (Platform.CPU.CPUFrequency != 0)
{
DT__AddProperty(efiPlatformNode, CPU_Frequency_prop, sizeof(uint64_t), &Platform.CPU.CPUFrequency);
}
// Bungo
/* Export system-id. Can be disabled with SystemId=No in com.apple.Boot.plist
if ((ret=getSystemID())) {
DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, UUID_LEN, (EFI_UINT32*) ret);
if ((ret=getSystemID()))
{
DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, UUID_LEN, (EFI_UINT32 *) ret);
}
*/
DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, UUID_LEN, (EFI_UINT32 *)Platform.UUID);
// Export SystemSerialNumber if present
if ((ret16=getSmbiosChar16("SMserial", &len))) {
if ((ret16=getSmbiosChar16("SMserial", &len)))
{
DT__AddProperty(efiPlatformNode, SYSTEM_SERIAL_PROP, len, ret16);
}
// Export Model if present
if ((ret16=getSmbiosChar16("SMproductname", &len))) {
if ((ret16=getSmbiosChar16("SMproductname", &len)))
{
DT__AddProperty(efiPlatformNode, MODEL_PROP, len, ret16);
}

Archive Download the corresponding diff file

Revision: 2590