OpenCoreMisc: Implement ballooning stubs

This commit is contained in:
vit9696 2019-10-26 14:26:29 +03:00
parent 929ceaaac3
commit 2e86c435d5
3 changed files with 28 additions and 11 deletions

View File

@ -15,6 +15,7 @@
#ifndef OPEN_CORE_H
#define OPEN_CORE_H
#include <Library/OcBootManagementLib.h>
#include <Library/OcConfigurationLib.h>
#include <Library/OcCpuLib.h>
#include <Library/OcCryptoLib.h>
@ -175,6 +176,8 @@ OcLoadUefiSupport (
upon changing screen resolution.
@param[in] Config OpenCore configuration.
@retval TRUE when required.
**/
BOOLEAN
OcShouldReconnectConsoleOnResolutionChange (
@ -191,6 +194,18 @@ OcMiscGetVersionString (
VOID
);
/**
Get ballooning handler for memory allocation protections.
@param[in] Config OpenCore configuration.
@retval Handler address or NULL.
**/
OC_BALLOON_ALLOC
OcGetBallooningHandler (
IN OC_GLOBAL_CONFIG *Config
);
/**
Load early miscellaneous support like configuration.

View File

@ -525,6 +525,7 @@ OcMiscBoot (
Context->CustomRead = OcToolLoadEntry;
Context->PrivilegeContext = Privilege;
Context->RequestPrivilege = OcShowSimplePasswordRequest;
Context->BalloonAllocator = OcGetBallooningHandler (Config);
if ((Config->Misc.Security.ExposeSensitiveData & OCS_EXPOSE_VERSION_UI) != 0) {
Context->TitleSuffix = OcMiscGetVersionString ();

View File

@ -412,6 +412,18 @@ OcShouldReconnectConsoleOnResolutionChange (
return Config->Uefi.Quirks.ReconnectOnResChange;
}
OC_BALLOON_ALLOC
OcGetBallooningHandler (
IN OC_GLOBAL_CONFIG *Config
)
{
if (Config->Uefi.Quirks.AvoidHighAlloc) {
return OcHandleKernelProtectionZone;
}
return NULL;
}
VOID
OcLoadBooterUefiSupport (
IN OC_GLOBAL_CONFIG *Config
@ -506,17 +518,6 @@ OcLoadUefiSupport (
&Config->Uefi.Quirks.RequestBootVarRouting
);
//
// Inform allocations when we want to use lower memory only.
//
gRT->SetVariable (
OC_AVOID_HIGH_ALLOC_VARIABLE_NAME,
&gOcVendorVariableGuid,
OPEN_CORE_INT_NVRAM_ATTR,
sizeof (Config->Uefi.Quirks.AvoidHighAlloc),
&Config->Uefi.Quirks.AvoidHighAlloc
);
if (Config->Uefi.Quirks.ReleaseUsbOwnership
|| Config->Uefi.Quirks.ExitBootServicesDelay > 0
|| AgiExitBs) {