diff options
author | mdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-10-11 23:44:40 +0000 |
---|---|---|
committer | mdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-10-11 23:44:40 +0000 |
commit | 5ead4a07a8bd2dc1604988a20d72c86963d66c51 (patch) | |
tree | 9d6123a5380d222dd36ff682b0fe9e7912747db4 /MdeModulePkg/Universal | |
parent | aa0583c78369a5a85d7bf26c76240ae4e3086c42 (diff) | |
download | edk2-platforms-5ead4a07a8bd2dc1604988a20d72c86963d66c51.tar.xz |
If there are variables in the VAR_ADDED state that are identical to the variable being updated during reclaim, then only keep the variable being updated and delete variables in the VAR_ADDED state.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6104 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r-- | MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c index 2571167d89..b5741785b2 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -656,26 +656,47 @@ Returns: //
//
- // Reinstall all ADDED variables
+ // Reinstall all ADDED variables as long as they are not identical to Updating Variable
//
Variable = GetStartPointer (VariableStoreHeader);
while (IsValidVariableHeader (Variable)) {
NextVariable = GetNextVariablePtr (Variable);
if (Variable->State == VAR_ADDED) {
+ if (UpdatingVariable != NULL) {
+ if (UpdatingVariable == Variable) {
+ Variable = NextVariable;
+ continue;
+ }
+ if (CompareGuid (&Variable->VendorGuid, &UpdatingVariable->VendorGuid) &&
+ NameSizeOfVariable(Variable) == NameSizeOfVariable (UpdatingVariable) &&
+ CompareMem (GetVariableNamePtr (Variable), GetVariableNamePtr (UpdatingVariable), NameSizeOfVariable (Variable)) == 0 ) {
+ Variable = NextVariable;
+ continue;
+ }
+ }
VariableSize = (UINTN) NextVariable - (UINTN) Variable;
CopyMem (CurrPtr, (UINT8 *) Variable, VariableSize);
CurrPtr += VariableSize;
}
-
Variable = NextVariable;
}
+
+ //
+ // Reinstall the variable being updated if it is not NULL
+ //
+ if (UpdatingVariable != NULL) {
+ VariableSize = (UINTN)(GetNextVariablePtr (UpdatingVariable)) - (UINTN)UpdatingVariable;
+ CopyMem (CurrPtr, (UINT8 *) UpdatingVariable, VariableSize);
+ CurrPtr += VariableSize;
+ }
+
//
// Reinstall all in delete transition variables
//
Variable = GetStartPointer (VariableStoreHeader);
while (IsValidVariableHeader (Variable)) {
NextVariable = GetNextVariablePtr (Variable);
- if (Variable->State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)) {
+ if (Variable != UpdatingVariable && Variable->State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)) {
//
// Buffer has cached all ADDED variable.
@@ -693,12 +714,7 @@ Returns: ) {
Point0 = (VOID *) GetVariableNamePtr (AddedVariable);
Point1 = (VOID *) GetVariableNamePtr (Variable);
- if (!CompareMem (
- Point0,
- Point1,
- NameSizeOfVariable (AddedVariable)
- )
- ) {
+ if (CompareMem (Point0, Point1, NameSizeOfVariable (AddedVariable)) == 0) {
FoundAdded = TRUE;
break;
}
@@ -706,11 +722,12 @@ Returns: AddedVariable = NextAddedVariable;
}
if (!FoundAdded) {
+ //
+ // Promote VAR_IN_DELETED_TRANSITION to VAR_ADDED
+ //
VariableSize = (UINTN) NextVariable - (UINTN) Variable;
CopyMem (CurrPtr, (UINT8 *) Variable, VariableSize);
- if (Variable != UpdatingVariable) {
- ((VARIABLE_HEADER *) CurrPtr)->State = VAR_ADDED;
- }
+ ((VARIABLE_HEADER *) CurrPtr)->State = VAR_ADDED;
CurrPtr += VariableSize;
}
}
|