Merge pull request #60 from Florin9doi/p9

Delete user memory (gRam) when a new config is selected
This commit is contained in:
Sergey 2019-12-22 08:14:28 +03:00 committed by GitHub
commit 4c3655d954
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 3 deletions

View File

@ -5996,6 +5996,16 @@ GetUserSettings(
Prop = GetProperty(DictPointer, "MemoryRank");
gSettings.Attribute = (INT8)GetPropertyInteger(Prop, -1); //1==Single Rank, 2 == Dual Rank, 0==undefined -1 == keep as is
// Delete the user memory when a new config is selected
INTN i = 0;
for (i = 0; i < gRAM.UserInUse && i < MAX_RAM_SLOTS; i++) {
gRAM.User[i].ModuleSize = 0;
gRAM.User[i].InUse = 0;
}
gRAM.UserInUse = 0;
gRAM.UserChannels = 0;
gSettings.InjectMemoryTables = FALSE;
// Inject memory tables into SMBIOS
Prop = GetProperty (DictPointer, "Memory");
if (Prop != NULL){

View File

@ -1818,8 +1818,8 @@ KernelAndKextPatcherInit(IN LOADER_ENTRY *Entry)
// Find kernel Mach-O header:
// for ML: bootArgs2->kslide + 0x00200000
// for older versions: just 0x200000
// for AptioFix booting - it's always at KernelRelocBase + 0x200000
// for older versions: just 0x00200000
// for AptioFix booting - it's always at KernelRelocBase + 0x00200000
KernelData = (VOID*)(UINTN)(KernelSlide + KernelRelocBase + 0x00200000);
// check that it is Mach-O header and detect architecture

View File

@ -1295,7 +1295,7 @@ VOID PatchTableType17()
return;
}
// Check channels
if ((gRAM.UserChannels == 0) || (gRAM.UserChannels > 4)) {
if ((gRAM.UserChannels == 0) || (gRAM.UserChannels > 8)) {
gRAM.UserChannels = 1;
}
if (gRAM.UserInUse >= MAX_RAM_SLOTS) {