Merge pull request #11 from system76/skip-console-vars

MdeModulePkg/EmuRuntimeDxe: skip console NVRAM variables
This commit is contained in:
Jeremy Soller
2020-06-22 15:49:31 -06:00
committed by GitHub

View File

@ -1100,13 +1100,14 @@ UpdateVariable (
Store: Store:
// If the store is initialized // If the store is initialized
// And we are storing or deleting a non volatile variable // And we are storing or deleting a non volatile variable
// And variable name doesn't start with 'Con'
// Send the new data to SMMSTORE // Send the new data to SMMSTORE
if (storeInitialized && ( if (storeInitialized && (
(Attributes & EFI_VARIABLE_NON_VOLATILE) != 0 || ( (Attributes & EFI_VARIABLE_NON_VOLATILE) != 0 || (
Delete && Delete &&
(Variable->CurrPtr->Attributes & EFI_VARIABLE_NON_VOLATILE) != 0 (Variable->CurrPtr->Attributes & EFI_VARIABLE_NON_VOLATILE) != 0
) )) && (StrnCmp(L"Con", VariableName, StrLen(L"Con")))
)) { ) {
/* TODO: add hook for logging nv changes here */ /* TODO: add hook for logging nv changes here */
@ -1978,23 +1979,27 @@ VariableCommonInitialize (
EFI_GUID *guid = (EFI_GUID *)(buf + i + 8); EFI_GUID *guid = (EFI_GUID *)(buf + i + 8);
VOID *data = (VOID *)(buf + i + 8 + keysz); VOID *data = (VOID *)(buf + i + 8 + keysz);
DEBUG ((DEBUG_WARN, "Fetching variable: %s\n", varname)); // don't update console variables
DEBUG ((DEBUG_WARN, "buf: %p, buf+i: %p, guid: %p, varname: %p, data: %p\n", buf, buf + i, guid, varname, data)); if (StrnCmp(L"Con", varname, StrLen(L"Con"))) {
VARIABLE_POINTER_TRACK Variable; DEBUG ((DEBUG_WARN, "Fetching variable: %s\n", varname));
FindVariable (varname, guid, &Variable, (VARIABLE_GLOBAL *)mVariableModuleGlobal); DEBUG ((DEBUG_WARN, "buf: %p, buf+i: %p, guid: %p, varname: %p, data: %p\n", buf, buf + i, guid, varname, data));
VARIABLE_POINTER_TRACK Variable;
FindVariable (varname, guid, &Variable, (VARIABLE_GLOBAL *)mVariableModuleGlobal);
DEBUG ((DEBUG_WARN, "Updating variable: %s\n", varname)); DEBUG ((DEBUG_WARN, "Updating variable: %s\n", varname));
UpdateVariable ( UpdateVariable (
varname, varname,
guid, guid,
data, data,
valsz, valsz,
// all of these variables are nv // all of these variables are nv
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
&Variable &Variable
); );
} else {
DEBUG ((DEBUG_WARN, "Skipping console variable: %s\n", varname));
}
} }
DEBUG ((DEBUG_WARN, "Added variable: 0x%x, val size: %x\n", keysz, valsz));
// no UEFI variable since it's at most the GUID part, so skip // no UEFI variable since it's at most the GUID part, so skip
i += 8 + keysz + valsz + 1; i += 8 + keysz + valsz + 1;
i = (i + 3) & ~3; i = (i + 3) & ~3;