diff options
author | zliu3 <zliu3@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-12-06 08:16:31 +0000 |
---|---|---|
committer | zliu3 <zliu3@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-12-06 08:16:31 +0000 |
commit | 09d4dd14e9281f125de3090acbfbff1d1aa05756 (patch) | |
tree | d5c628d84b44ae674fcaf8426fcd01aa250dfda2 /EdkModulePkg/Universal | |
parent | 027c2ecb3bf2dd726d51dad5a26f67c522c64e23 (diff) | |
download | edk2-platforms-09d4dd14e9281f125de3090acbfbff1d1aa05756.tar.xz |
Fixed one bug in EmuVariable module: The macro (GET_PAD_SIZE) is different with GetPadSize(), so in some special case the variable can not be read rightly after it was set.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2059 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg/Universal')
-rw-r--r-- | EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.c | 71 |
1 files changed, 20 insertions, 51 deletions
diff --git a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.c b/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.c index fe1ac92b63..bfb499ab65 100644 --- a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.c +++ b/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.c @@ -1,16 +1,16 @@ /*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
-
+
EmuVariable.c
Abstract:
@@ -62,37 +62,6 @@ Returns: return (Count * 2) + 2;
}
-UINTN
-EFIAPI
-GetPadSize (
- IN UINTN Value
- )
-/*++
-
-Routine Description:
-
- This function return the pad size for alignment
-
-Arguments:
-
- Value The value need to align
-
-Returns:
-
- Pad size for value
-
---*/
-{
- //
- // If alignment is 0 or 1, means no alignment required
- //
- if (ALIGNMENT == 0 || ALIGNMENT == 1) {
- return 0;
- }
-
- return ALIGNMENT - (Value % ALIGNMENT);
-}
-
VARIABLE_STORE_STATUS
EFIAPI
GetVariableStoreStatus (
@@ -161,7 +130,7 @@ Returns: //
// Be careful about pad size for alignment
//
- return (UINT8 *) ((UINTN) GET_VARIABLE_NAME_PTR (Variable) + Variable->NameSize + GetPadSize (Variable->NameSize));
+ return (UINT8 *) ((UINTN) GET_VARIABLE_NAME_PTR (Variable) + Variable->NameSize + GET_PAD_SIZE (Variable->NameSize));
}
VARIABLE_HEADER *
@@ -413,7 +382,7 @@ Returns: UINTN VarNameSize;
EFI_STATUS Status;
- if (VariableNameSize == NULL || VariableName == NULL || VendorGuid == NULL) {
+ if (VariableNameSize == NULL || VendorGuid == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -593,8 +562,8 @@ Returns: //
VarNameOffset = sizeof (VARIABLE_HEADER);
VarNameSize = ArrayLength (VariableName);
- VarDataOffset = VarNameOffset + VarNameSize + GetPadSize (VarNameSize);
- VarSize = VarDataOffset + DataSize + GetPadSize (DataSize);
+ VarDataOffset = VarNameOffset + VarNameSize + GET_PAD_SIZE (VarNameSize);
+ VarSize = VarDataOffset + DataSize + GET_PAD_SIZE (DataSize);
if (Attributes & EFI_VARIABLE_NON_VOLATILE) {
if ((UINT32) (VarSize +*NonVolatileOffset) >
@@ -675,11 +644,11 @@ Routine Description: Arguments:
- Attributes Attributes bitmask to specify the type of variables
+ Attributes Attributes bitmask to specify the type of variables
on which to return information.
MaximumVariableStorageSize Pointer to the maximum size of the storage space available
for the EFI variables associated with the attributes specified.
- RemainingVariableStorageSize Pointer to the remaining size of the storage space available
+ RemainingVariableStorageSize Pointer to the remaining size of the storage space available
for the EFI variables associated with the attributes specified.
MaximumVariableSize Pointer to the maximum size of the individual EFI variables
associated with the attributes specified.
@@ -699,7 +668,7 @@ Returns: VARIABLE_HEADER *NextVariable;
UINT64 VariableSize;
VARIABLE_STORE_HEADER *VariableStoreHeader;
-
+
if(MaximumVariableStorageSize == NULL || RemainingVariableStorageSize == NULL || MaximumVariableSize == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -725,7 +694,7 @@ Returns: //
// Query is Volatile related.
//
- VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINTN) Global->VolatileVariableBase);
+ VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINTN) Global->VolatileVariableBase);
} else {
//
// Query is Non-Volatile related.
@@ -734,14 +703,14 @@ Returns: }
//
- // Now let's fill *MaximumVariableStorageSize *RemainingVariableStorageSize
+ // Now let's fill *MaximumVariableStorageSize *RemainingVariableStorageSize
// with the storage size (excluding the storage header size)
//
*MaximumVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);
*RemainingVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);
//
- // Let *MaximumVariableSize be MAX_VARIABLE_SIZE
+ // Let *MaximumVariableSize be MAX_VARIABLE_SIZE
//
*MaximumVariableSize = MAX_VARIABLE_SIZE;
@@ -846,7 +815,7 @@ Returns: //
mVariableModuleGlobal = (ESAL_VARIABLE_GLOBAL *) AllocateRuntimePool (
sizeof (ESAL_VARIABLE_GLOBAL)
- );
+ );
if (NULL == mVariableModuleGlobal) {
return EFI_OUT_OF_RESOURCES;
}
|