summaryrefslogtreecommitdiff
path: root/edk2/EdkCompatibilityPkg
diff options
context:
space:
mode:
Diffstat (limited to 'edk2/EdkCompatibilityPkg')
-rw-r--r--edk2/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/DispatchExecute.c55
-rw-r--r--edk2/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.c10
-rw-r--r--edk2/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c21
-rw-r--r--edk2/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c4
-rw-r--r--edk2/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.S16
-rw-r--r--edk2/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S14
-rw-r--r--edk2/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c121
-rw-r--r--edk2/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.inf5
-rw-r--r--edk2/EdkCompatibilityPkg/Contributions.txt188
-rw-r--r--edk2/EdkCompatibilityPkg/Foundation/Include/Arm/EfiBind.h4
-rw-r--r--edk2/EdkCompatibilityPkg/Foundation/Include/Ebc/EfiBind.h4
-rw-r--r--edk2/EdkCompatibilityPkg/Foundation/Include/Ia32/EfiBind.h6
-rw-r--r--edk2/EdkCompatibilityPkg/Foundation/Include/Ipf/EfiBind.h10
-rw-r--r--edk2/EdkCompatibilityPkg/Foundation/Include/X64/EfiBind.h6
-rw-r--r--edk2/EdkCompatibilityPkg/Foundation/Library/CompilerStub/CompilerStubLib.inf6
-rw-r--r--edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Graphics.c58
-rw-r--r--edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Graphics.c58
-rw-r--r--edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiCommonLib.h4
-rw-r--r--edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/StdErr.c4
-rw-r--r--edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/PrintLite/StdErr.c4
-rw-r--r--edk2/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/String.c6
-rw-r--r--edk2/EdkCompatibilityPkg/Foundation/Library/Smm/SmmScriptLib/PiSmmDefinition.h8
22 files changed, 534 insertions, 78 deletions
diff --git a/edk2/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/DispatchExecute.c b/edk2/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/DispatchExecute.c
index 8ef429990..20567bdde 100644
--- a/edk2/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/DispatchExecute.c
+++ b/edk2/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/DispatchExecute.c
@@ -3,7 +3,7 @@
Provide a thunk function to transition from long mode to compatibility mode to execute 32-bit code and then transit
back to long mode.
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -34,8 +34,24 @@ typedef union {
} Bits;
UINT64 Uint64;
} IA32_GDT;
+
+///
+/// Byte packed structure for an IA-32 Interrupt Gate Descriptor.
+///
+typedef union {
+ struct {
+ UINT32 OffsetLow:16; ///< Offset bits 15..0.
+ UINT32 Selector:16; ///< Selector.
+ UINT32 Reserved_0:8; ///< Reserved.
+ UINT32 GateType:8; ///< Gate Type. See #defines above.
+ UINT32 OffsetHigh:16; ///< Offset bits 31..16.
+ } Bits;
+ UINT64 Uint64;
+} IA32_IDT_ENTRY;
#pragma pack()
+#define COMPATIBILITY_MODE_SELECTOR 8
+
//
// Global Descriptor Table (GDT)
//
@@ -92,7 +108,36 @@ Execute32BitCode (
)
{
EFI_STATUS Status;
-
+ IA32_DESCRIPTOR *Ia32Idtr;
+ IA32_DESCRIPTOR X64Idtr;
+ UINTN Ia32IdtEntryCount;
+ UINTN Index;
+ IA32_IDT_ENTRY *Ia32IdtEntry;
+
+ //
+ // Save x64 IDT Descriptor
+ //
+ AsmReadIdtr ((IA32_DESCRIPTOR *) &X64Idtr);
+
+ //
+ // Get the IA32 IDT Descriptor saved in 16 bytes in front of X64 IDT table.
+ //
+ Ia32Idtr = (IA32_DESCRIPTOR *) (UINTN) (X64Idtr.Base - 16);
+ Ia32IdtEntryCount = (Ia32Idtr->Limit + 1) / sizeof (IA32_IDT_ENTRY);
+
+ Ia32IdtEntry = (IA32_IDT_ENTRY *)(Ia32Idtr->Base);
+ for (Index = 0; Index < Ia32IdtEntryCount; Index ++ ) {
+ //
+ // Use the new Code Selector value
+ //
+ Ia32IdtEntry[Index].Bits.Selector = COMPATIBILITY_MODE_SELECTOR;
+ }
+
+ //
+ // Setup IA32 IDT table for 32-bit framework Boot Script code
+ //
+ AsmWriteIdtr (Ia32Idtr);
+
ASSERT (Function != 0);
Status = AsmExecute32BitCode (
@@ -101,6 +146,12 @@ Execute32BitCode (
Param2,
&mGdt
);
+
+ //
+ // Restore X64 IDT table
+ //
+ AsmWriteIdtr ((IA32_DESCRIPTOR *) &X64Idtr);
+
return Status;
}
diff --git a/edk2/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.c b/edk2/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.c
index 5171a66b0..da55e1217 100644
--- a/edk2/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.c
+++ b/edk2/EdkCompatibilityPkg/Compatibility/DeviceIoOnPciRootBridgeIoThunk/DeviceIoOnPciRootBridgeIoThunk.c
@@ -12,7 +12,7 @@ This module module layers Device I/O on top of PCI Root Bridge I/O (Segment 0)
Platform required to support EFI drivers that consume Device I/O
Platform required to support EFI applications that consume Device I/O
-Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -758,7 +758,7 @@ DeviceIoPciRead (
Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
- if (Width < 0 || Width >= MMIO_COPY_UINT8) {
+ if ((UINT32)Width >= MMIO_COPY_UINT8) {
return EFI_INVALID_PARAMETER;
}
@@ -805,7 +805,7 @@ DeviceIoPciWrite (
Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
- if (Width < 0 || Width >= MMIO_COPY_UINT8) {
+ if ((UINT32)Width >= MMIO_COPY_UINT8) {
return EFI_INVALID_PARAMETER;
}
@@ -1029,7 +1029,7 @@ DeviceIoMap (
Private = DEVICE_IO_PRIVATE_DATA_FROM_THIS (This);
- if (Operation < 0 || Operation > EfiBusMasterCommonBuffer) {
+ if ((UINT32)Operation > EfiBusMasterCommonBuffer) {
return EFI_INVALID_PARAMETER;
}
@@ -1123,7 +1123,7 @@ DeviceIoAllocateBuffer (
return EFI_INVALID_PARAMETER;
}
- if ((Type >= MaxAllocateType) || (Type < AllocateAnyPages)) {
+ if ((UINT32)Type >= MaxAllocateType) {
return EFI_INVALID_PARAMETER;
}
diff --git a/edk2/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c b/edk2/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c
index 86820ca5d..c33a3f0b8 100644
--- a/edk2/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c
+++ b/edk2/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c
@@ -3,7 +3,7 @@
by HII Thunk Modules. These Config access Protocols are used to thunk UEFI Config
Access Callback to Framework HII Callback and EFI Variable Set/Get operations.
-Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -74,9 +74,12 @@ GetFirstStorageOfFormSet (
StorageList = GetFirstNode (&FormSet->StorageListHead);
- if (!IsNull (&FormSet->StorageListHead, StorageList)) {
+ while (!IsNull (&FormSet->StorageListHead, StorageList)) {
Storage = FORMSET_STORAGE_FROM_LINK (StorageList);
- return Storage;
+ if (Storage->Type == EFI_HII_VARSTORE_BUFFER) {
+ return Storage;
+ }
+ StorageList = GetNextNode (&FormSet->StorageListHead, StorageList);
}
return NULL;
@@ -155,6 +158,10 @@ GetStorageFromConfigString (
while (!IsNull (&FormSet->StorageListHead, StorageList)) {
Storage = FORMSET_STORAGE_FROM_LINK (StorageList);
+ StorageList = GetNextNode (&FormSet->StorageListHead, StorageList);
+ if (Storage->Type != EFI_HII_VARSTORE_BUFFER) {
+ continue;
+ }
if ((Storage->VarStoreId == FormSet->DefaultVarStoreId) && (FormSet->OriginalDefaultVarStoreName != NULL)) {
Name = FormSet->OriginalDefaultVarStoreName;
@@ -165,8 +172,6 @@ GetStorageFromConfigString (
if (HiiIsConfigHdrMatch (ConfigString, &Storage->Guid, Name)) {
return Storage;
}
-
- StorageList = GetNextNode (&FormSet->StorageListHead, StorageList);
}
return NULL;
@@ -474,6 +479,12 @@ ThunkExtractConfig (
}
BufferStorage = FORMSET_STORAGE_FROM_LINK (StorageList);
StorageList = GetNextNode (&FormSetContext->StorageListHead, StorageList);
+ if (BufferStorage->Type != EFI_HII_VARSTORE_BUFFER) {
+ //
+ // BufferStorage type should be EFI_HII_VARSTORE_BUFFER
+ //
+ continue;
+ }
}
VarStoreName = NULL;
diff --git a/edk2/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c b/edk2/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c
index ae2124522..f246c08b5 100644
--- a/edk2/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c
+++ b/edk2/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c
@@ -1,7 +1,7 @@
/** @file
This file implements the protocol functions related to string package.
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -349,7 +349,7 @@ HiiThunkGetString (
//
// Get the current platform language setting
//
- PlatformLanguage = GetEfiGlobalVariable (L"PlatformLang");
+ GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&PlatformLanguage, NULL);
//
// Get the best matching language from SupportedLanguages
diff --git a/edk2/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.S b/edk2/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.S
index 6fd2c1d8f..84fd47329 100644
--- a/edk2/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.S
+++ b/edk2/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.S
@@ -1,7 +1,7 @@
#------------------------------------------------------------------------------
# IA32 assembly file for AP startup vector.
#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
# 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
@@ -100,11 +100,21 @@ ProtectedModeStart: # protected mode entry point
#
movl $0x1b, %ecx
rdmsr
+
+ btl $10, %eax # Check for x2apic mode
+ jnc LegacyApicMode
+ movl $0x802, %ecx # Read APIC_ID
+ rdmsr
+ movl %eax, %ebx # ebx == apicid
+ jmp GetCpuNumber
+
+LegacyApicMode:
andl $0xfffff000, %eax
addl $0x20, %eax
movl (%eax), %ebx
- shrl $24, %ebx
-
+ shrl $24, %ebx # ebx == apicid
+
+GetCpuNumber:
xorl %ecx, %ecx
movl %esi,%edi
addl $ProcessorNumber, %edi
diff --git a/edk2/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S b/edk2/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S
index 6ea0f3e69..9585d3224 100644
--- a/edk2/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S
+++ b/edk2/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S
@@ -1,7 +1,7 @@
#------------------------------------------------------------------------------
# X64 assembly file for AP startup vector.
#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
# 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
@@ -134,11 +134,21 @@ LongModeStart:
#
movl $0x1b, %ecx
rdmsr
+
+ btl $10, %eax # Check for x2apic mode
+ jnc LegacyApicMode
+ movl $0x802, %ecx # Read APIC_ID
+ rdmsr
+ movl %eax, %ebx # ebx == apicid
+ jmp GetCpuNumber
+
+LegacyApicMode:
andl $0xfffff000, %eax
addl $0x20, %eax
movl (%eax), %ebx
- shrl $24, %ebx
+ shrl $24, %ebx # ebx == apicid
+GetCpuNumber:
xorq %rcx, %rcx
movl %esi,%edi
addl $ProcessorNumberLocation, %edi
diff --git a/edk2/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c b/edk2/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
index 99dccab8e..193ab1975 100644
--- a/edk2/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
+++ b/edk2/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
@@ -4,7 +4,14 @@
This driver is the counterpart of the SMM Base On SMM Base2 Thunk driver. It
provides helping services in SMM to the SMM Base On SMM Base2 Thunk driver.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+ Caution: This module requires additional review when modified.
+ This driver will have external input - communicate buffer in SMM mode.
+ This external input must be validated carefully to avoid security issue like
+ buffer overflow, integer overflow.
+
+ SmmHandlerEntry() will receive untrusted input and do validation.
+
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -35,6 +42,7 @@
#include <Protocol/MpService.h>
#include <Protocol/LoadPe32Image.h>
#include <Protocol/SmmReadyToLock.h>
+#include <Protocol/SmmAccess2.h>
///
/// Structure for tracking paired information of registered Framework SMI handler
@@ -78,6 +86,8 @@ SPIN_LOCK mPFLock;
UINT64 mPhyMask;
VOID *mOriginalHandler;
EFI_SMM_CPU_SAVE_STATE *mShadowSaveState;
+EFI_SMRAM_DESCRIPTOR *mSmramRanges;
+UINTN mSmramRangeCount;
LIST_ENTRY mCallbackInfoListHead = INITIALIZE_LIST_HEAD_VARIABLE (mCallbackInfoListHead);
@@ -695,6 +705,32 @@ LoadImage (
return Status;
}
+/**
+ This function check if the address is in SMRAM.
+
+ @param Buffer the buffer address to be checked.
+ @param Length the buffer length to be checked.
+
+ @retval TRUE this address is in SMRAM.
+ @retval FALSE this address is NOT in SMRAM.
+**/
+BOOLEAN
+IsAddressInSmram (
+ IN EFI_PHYSICAL_ADDRESS Buffer,
+ IN UINT64 Length
+ )
+{
+ UINTN Index;
+
+ for (Index = 0; Index < mSmramRangeCount; Index ++) {
+ if (((Buffer >= mSmramRanges[Index].CpuStart) && (Buffer < mSmramRanges[Index].CpuStart + mSmramRanges[Index].PhysicalSize)) ||
+ ((mSmramRanges[Index].CpuStart >= Buffer) && (mSmramRanges[Index].CpuStart < Buffer + Length))) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
/**
Thunk service of EFI_SMM_BASE_PROTOCOL.Register().
@@ -998,6 +1034,10 @@ HelperCommunicate (
This SMI handler provides services for the SMM Base Thunk driver.
+ Caution: This function may receive untrusted input during runtime.
+ The communicate buffer is external input, so this function will do operations only if the communicate
+ buffer is outside of SMRAM so that returning the status code in the buffer won't overwrite anywhere in SMRAM.
+
@param[in] DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
@param[in] RegisterContext Points to an optional handler context which was specified when the
handler was registered.
@@ -1025,32 +1065,35 @@ SmmHandlerEntry (
SMMBASE_FUNCTION_DATA *FunctionData;
ASSERT (CommBuffer != NULL);
- ASSERT (*CommBufferSize == sizeof (SMMBASE_FUNCTION_DATA));
-
- FunctionData = (SMMBASE_FUNCTION_DATA *)CommBuffer;
-
- switch (FunctionData->Function) {
- case SmmBaseFunctionRegister:
- Register (FunctionData);
- break;
- case SmmBaseFunctionUnregister:
- UnRegister (FunctionData);
- break;
- case SmmBaseFunctionRegisterCallback:
- RegisterCallback (FunctionData);
- break;
- case SmmBaseFunctionAllocatePool:
- HelperAllocatePool (FunctionData);
- break;
- case SmmBaseFunctionFreePool:
- HelperFreePool (FunctionData);
- break;
- case SmmBaseFunctionCommunicate:
- HelperCommunicate (FunctionData);
- break;
- default:
- ASSERT (FALSE);
- FunctionData->Status = EFI_UNSUPPORTED;
+ ASSERT (CommBufferSize != NULL);
+
+ if (*CommBufferSize == sizeof (SMMBASE_FUNCTION_DATA) &&
+ !IsAddressInSmram ((EFI_PHYSICAL_ADDRESS)(UINTN)CommBuffer, *CommBufferSize)) {
+ FunctionData = (SMMBASE_FUNCTION_DATA *)CommBuffer;
+
+ switch (FunctionData->Function) {
+ case SmmBaseFunctionRegister:
+ Register (FunctionData);
+ break;
+ case SmmBaseFunctionUnregister:
+ UnRegister (FunctionData);
+ break;
+ case SmmBaseFunctionRegisterCallback:
+ RegisterCallback (FunctionData);
+ break;
+ case SmmBaseFunctionAllocatePool:
+ HelperAllocatePool (FunctionData);
+ break;
+ case SmmBaseFunctionFreePool:
+ HelperFreePool (FunctionData);
+ break;
+ case SmmBaseFunctionCommunicate:
+ HelperCommunicate (FunctionData);
+ break;
+ default:
+ DEBUG ((EFI_D_WARN, "SmmBaseHelper: invalid SMM Base function.\n"));
+ FunctionData->Status = EFI_UNSUPPORTED;
+ }
}
return EFI_SUCCESS;
}
@@ -1099,6 +1142,8 @@ SmmBaseHelperMain (
EFI_HANDLE Handle;
UINTN NumberOfEnabledProcessors;
VOID *Registration;
+ EFI_SMM_ACCESS2_PROTOCOL *SmmAccess;
+ UINTN Size;
Handle = NULL;
///
@@ -1144,6 +1189,28 @@ SmmBaseHelperMain (
mSmmBaseHelperReady->ServiceEntry = SmmHandlerEntry;
//
+ // Get SMRAM information
+ //
+ Status = gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VOID **)&SmmAccess);
+ ASSERT_EFI_ERROR (Status);
+
+ Size = 0;
+ Status = SmmAccess->GetCapabilities (SmmAccess, &Size, NULL);
+ ASSERT (Status == EFI_BUFFER_TOO_SMALL);
+
+ Status = gSmst->SmmAllocatePool (
+ EfiRuntimeServicesData,
+ Size,
+ (VOID **)&mSmramRanges
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = SmmAccess->GetCapabilities (SmmAccess, &Size, mSmramRanges);
+ ASSERT_EFI_ERROR (Status);
+
+ mSmramRangeCount = Size / sizeof (EFI_SMRAM_DESCRIPTOR);
+
+ //
// Register SMM Ready To Lock Protocol notification
//
Status = gSmst->SmmRegisterProtocolNotify (
diff --git a/edk2/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.inf b/edk2/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.inf
index 9a0a2d91c..f988c138f 100644
--- a/edk2/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.inf
+++ b/edk2/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.inf
@@ -1,7 +1,7 @@
## @file
# Component description file for SMM Base Helper SMM driver.
#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -72,9 +72,10 @@
gEfiSmmCpuIo2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiLoadPeImageProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiSmmReadyToLockProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiSmmAccess2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
[Depex]
gEfiSmmCpuProtocolGuid AND
gEfiMpServiceProtocolGuid AND
gEfiSmmCpuIo2ProtocolGuid AND
- gEfiLoadPeImageProtocolGuid \ No newline at end of file
+ gEfiLoadPeImageProtocolGuid
diff --git a/edk2/EdkCompatibilityPkg/Contributions.txt b/edk2/EdkCompatibilityPkg/Contributions.txt
new file mode 100644
index 000000000..667ca1035
--- /dev/null
+++ b/edk2/EdkCompatibilityPkg/Contributions.txt
@@ -0,0 +1,188 @@
+
+======================
+= Code Contributions =
+======================
+
+To make a contribution to a TianoCore project, follow these steps.
+1. Create a change description in the format specified below to
+ use in the source control commit log.
+2. Your commit message must include your "Signed-off-by" signature,
+ and "Contributed-under" message.
+3. Your "Contributed-under" message explicitly states that the
+ contribution is made under the terms of the specified
+ contribution agreement. Your "Contributed-under" message
+ must include the name of contribution agreement and version.
+ For example: Contributed-under: TianoCore Contribution Agreement 1.0
+ The "TianoCore Contribution Agreement" is included below in
+ this document.
+4. Submit your code to the TianoCore project using the process
+ that the project documents on its web page. If the process is
+ not documented, then submit the code on development email list
+ for the project.
+
+=======================================
+= Change Description / Commit Message =
+=======================================
+
+Your change description should use the standard format for a
+commit message, and must include your "Signed-off-by" signature
+and the "Contributed-under" message.
+
+== Sample Change Description / Commit Message =
+
+=== Definitions for sample change description ===
+
+* "CodeModule" is a short idenfier for the affected code. For
+ example MdePkg, or MdeModulePkg UsbBusDxe.
+* "Brief-single-line-summary" is a short summary of the change.
+* The entire first line should be less than ~70 characters.
+* "Full-commit-message" a verbose multiple line comment describing
+ the change. Each line should be less than ~70 characters.
+* "Contributed-under" explicitely states that the contribution is
+ made under the terms of the contribtion agreement. This
+ agreement is included below in this document.
+* "Signed-off-by" is the contributor's signature identifying them
+ by their real/legal name and their email address.
+
+=== Start of sample change description / commit message ===
+CodeModule: Brief-single-line-summary
+
+Full-commit-message
+
+Contributed-under: TianoCore Contribution Agreement 1.0
+Signed-off-by: Contributor Name <contributor@email.server>
+=== End of sample change description / commit message ===
+
+========================================
+= TianoCore Contribution Agreement 1.0 =
+========================================
+
+INTEL CORPORATION ("INTEL") MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
+INFORMATION AND/OR OTHER MATERIALS FOR USE IN THE TIANOCORE OPEN SOURCE
+PROJECT (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE
+TERMS AND CONDITIONS OF THIS AGREEMENT BETWEEN YOU AND INTEL AND/OR THE
+TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR
+REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE
+CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
+BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS
+AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
+AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
+USE THE CONTENT.
+
+Unless otherwise indicated, all Content made available on the TianoCore
+site is provided to you under the terms and conditions of the BSD
+License ("BSD"). A copy of the BSD License is available at
+http://opensource.org/licenses/bsd-license.php
+or when applicable, in the associated License.txt file.
+
+Certain other content may be made available under other licenses as
+indicated in or with such Content. (For example, in a License.txt file.)
+
+You accept and agree to the following terms and conditions for Your
+present and future Contributions submitted to TianoCore site. Except
+for the license granted to Intel hereunder, You reserve all right,
+title, and interest in and to Your Contributions.
+
+== SECTION 1: Definitions ==
+* "You" or "Contributor" shall mean the copyright owner or legal
+ entity authorized by the copyright owner that is making a
+ Contribution hereunder. All other entities that control, are
+ controlled by, or are under common control with that entity are
+ considered to be a single Contributor. For the purposes of this
+ definition, "control" means (i) the power, direct or indirect, to
+ cause the direction or management of such entity, whether by
+ contract or otherwise, or (ii) ownership of fifty percent (50%)
+ or more of the outstanding shares, or (iii) beneficial ownership
+ of such entity.
+* "Contribution" shall mean any original work of authorship,
+ including any modifications or additions to an existing work,
+ that is intentionally submitted by You to the TinaoCore site for
+ inclusion in, or documentation of, any of the Content. For the
+ purposes of this definition, "submitted" means any form of
+ electronic, verbal, or written communication sent to the
+ TianoCore site or its representatives, including but not limited
+ to communication on electronic mailing lists, source code
+ control systems, and issue tracking systems that are managed by,
+ or on behalf of, the TianoCore site for the purpose of
+ discussing and improving the Content, but excluding
+ communication that is conspicuously marked or otherwise
+ designated in writing by You as "Not a Contribution."
+
+== SECTION 2: License for Contributions ==
+* Contributor hereby agrees that redistribution and use of the
+ Contribution in source and binary forms, with or without
+ modification, are permitted provided that the following
+ conditions are met:
+** Redistributions of source code must retain the Contributor's
+ copyright notice, this list of conditions and the following
+ disclaimer.
+** Redistributions in binary form must reproduce the Contributor's
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+* Disclaimer. None of the names of Contributor, Intel, or the names
+ of their respective contributors may be used to endorse or
+ promote products derived from this software without specific
+ prior written permission.
+* Contributor grants a license (with the right to sublicense) under
+ claims of Contributor's patents that Contributor can license that
+ are infringed by the Contribution (as delivered by Contributor) to
+ make, use, distribute, sell, offer for sale, and import the
+ Contribution and derivative works thereof solely to the minimum
+ extent necessary for licensee to exercise the granted copyright
+ license; this patent license applies solely to those portions of
+ the Contribution that are unmodified. No hardware per se is
+ licensed.
+* EXCEPT AS EXPRESSLY SET FORTH IN SECTION 3 BELOW, THE
+ CONTRIBUTION IS PROVIDED BY THE CONTRIBUTOR "AS IS" AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ CONTRIBUTOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
+ CONTRIBUTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
+
+== SECTION 3: Representations ==
+* You represent that You are legally entitled to grant the above
+ license. If your employer(s) has rights to intellectual property
+ that You create that includes Your Contributions, You represent
+ that You have received permission to make Contributions on behalf
+ of that employer, that Your employer has waived such rights for
+ Your Contributions.
+* You represent that each of Your Contributions is Your original
+ creation (see Section 4 for submissions on behalf of others).
+ You represent that Your Contribution submissions include complete
+ details of any third-party license or other restriction
+ (including, but not limited to, related patents and trademarks)
+ of which You are personally aware and which are associated with
+ any part of Your Contributions.
+
+== SECTION 4: Third Party Contributions ==
+* Should You wish to submit work that is not Your original creation,
+ You may submit it to TianoCore site separately from any
+ Contribution, identifying the complete details of its source
+ and of any license or other restriction (including, but not
+ limited to, related patents, trademarks, and license agreements)
+ of which You are personally aware, and conspicuously marking the
+ work as "Submitted on behalf of a third-party: [named here]".
+
+== SECTION 5: Miscellaneous ==
+* Applicable Laws. Any claims arising under or relating to this
+ Agreement shall be governed by the internal substantive laws of
+ the State of Delaware or federal courts located in Delaware,
+ without regard to principles of conflict of laws.
+* Language. This Agreement is in the English language only, which
+ language shall be controlling in all respects, and all versions
+ of this Agreement in any other language shall be for accommodation
+ only and shall not be binding. All communications and notices made
+ or given pursuant to this Agreement, and all documentation and
+ support to be provided, unless otherwise noted, shall be in the
+ English language.
+
diff --git a/edk2/EdkCompatibilityPkg/Foundation/Include/Arm/EfiBind.h b/edk2/EdkCompatibilityPkg/Foundation/Include/Arm/EfiBind.h
index b2bf64743..c9ab69a65 100644
--- a/edk2/EdkCompatibilityPkg/Foundation/Include/Arm/EfiBind.h
+++ b/edk2/EdkCompatibilityPkg/Foundation/Include/Arm/EfiBind.h
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -50,7 +50,7 @@ typedef int int32_t;
typedef unsigned short uint16_t;
typedef short int16_t;
typedef unsigned char uint8_t;
-typedef char int8_t;
+typedef signed char int8_t;
//
// Native integer size in stdint.h
diff --git a/edk2/EdkCompatibilityPkg/Foundation/Include/Ebc/EfiBind.h b/edk2/EdkCompatibilityPkg/Foundation/Include/Ebc/EfiBind.h
index 123c78e3f..7fc05ca17 100644
--- a/edk2/EdkCompatibilityPkg/Foundation/Include/Ebc/EfiBind.h
+++ b/edk2/EdkCompatibilityPkg/Foundation/Include/Ebc/EfiBind.h
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -48,7 +48,7 @@ Abstract:
//
// Native integer types
//
-typedef char int8_t;
+typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
diff --git a/edk2/EdkCompatibilityPkg/Foundation/Include/Ia32/EfiBind.h b/edk2/EdkCompatibilityPkg/Foundation/Include/Ia32/EfiBind.h
index 6f4205801..e771bb658 100644
--- a/edk2/EdkCompatibilityPkg/Foundation/Include/Ia32/EfiBind.h
+++ b/edk2/EdkCompatibilityPkg/Foundation/Include/Ia32/EfiBind.h
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -186,7 +186,7 @@ Abstract:
typedef unsigned short uint16_t;
typedef short int16_t;
typedef unsigned char uint8_t;
- typedef char int8_t;
+ typedef signed char int8_t;
#else
typedef unsigned long long uint64_t;
typedef long long int64_t;
@@ -195,7 +195,7 @@ Abstract:
typedef unsigned short uint16_t;
typedef short int16_t;
typedef unsigned char uint8_t;
- typedef char int8_t;
+ typedef signed char int8_t;
#endif
//
diff --git a/edk2/EdkCompatibilityPkg/Foundation/Include/Ipf/EfiBind.h b/edk2/EdkCompatibilityPkg/Foundation/Include/Ipf/EfiBind.h
index 95887ef42..9d6248ce4 100644
--- a/edk2/EdkCompatibilityPkg/Foundation/Include/Ipf/EfiBind.h
+++ b/edk2/EdkCompatibilityPkg/Foundation/Include/Ipf/EfiBind.h
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -153,7 +153,7 @@ Abstract:
//
- // use Microsoft C complier dependent interger width types
+ // use Microsoft C complier dependent integer width types
//
typedef unsigned __int64 uint64_t;
typedef __int64 int64_t;
@@ -162,7 +162,7 @@ Abstract:
typedef unsigned short uint16_t;
typedef short int16_t;
typedef unsigned char uint8_t;
- typedef char int8_t;
+ typedef signed char int8_t;
#else
#ifdef _EFI_P64
//
@@ -176,7 +176,7 @@ Abstract:
typedef unsigned short uint16_t;
typedef short int16_t;
typedef unsigned char uint8_t;
- typedef char int8_t;
+ typedef signed char int8_t;
#else
//
// Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.
@@ -188,7 +188,7 @@ Abstract:
typedef unsigned short uint16_t;
typedef short int16_t;
typedef unsigned char uint8_t;
- typedef char int8_t;
+ typedef signed char int8_t;
#endif
#endif
#else
diff --git a/edk2/EdkCompatibilityPkg/Foundation/Include/X64/EfiBind.h b/edk2/EdkCompatibilityPkg/Foundation/Include/X64/EfiBind.h
index 9e582a71c..51f3b7685 100644
--- a/edk2/EdkCompatibilityPkg/Foundation/Include/X64/EfiBind.h
+++ b/edk2/EdkCompatibilityPkg/Foundation/Include/X64/EfiBind.h
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2005 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -139,7 +139,7 @@ Abstract:
typedef unsigned short uint16_t;
typedef short int16_t;
typedef unsigned char uint8_t;
- typedef char int8_t;
+ typedef signed char int8_t;
#else
typedef unsigned long long uint64_t;
typedef long long int64_t;
@@ -148,7 +148,7 @@ Abstract:
typedef unsigned short uint16_t;
typedef short int16_t;
typedef unsigned char uint8_t;
- typedef char int8_t;
+ typedef signed char int8_t;
#endif
//
diff --git a/edk2/EdkCompatibilityPkg/Foundation/Library/CompilerStub/CompilerStubLib.inf b/edk2/EdkCompatibilityPkg/Foundation/Library/CompilerStub/CompilerStubLib.inf
index 72f19fbca..4f1589244 100644
--- a/edk2/EdkCompatibilityPkg/Foundation/Library/CompilerStub/CompilerStubLib.inf
+++ b/edk2/EdkCompatibilityPkg/Foundation/Library/CompilerStub/CompilerStubLib.inf
@@ -45,6 +45,9 @@ COMPONENT_TYPE = LIBRARY
memcpy.c
memset.c
+[sources.ARM]
+ Dummy.c
+
[includes.common]
$(EDK_SOURCE)/Foundation
$(EDK_SOURCE)/Foundation/Framework
@@ -63,6 +66,9 @@ COMPONENT_TYPE = LIBRARY
[libraries.common]
+[libraries.ARM]
+ CompilerIntrinsicsLib
+
[nmake.common]
[nmake.ia32,nmake.x64]
diff --git a/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Graphics.c b/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Graphics.c
index 6a8183e13..954921738 100644
--- a/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Graphics.c
+++ b/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Graphics.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -162,22 +162,78 @@ Returns:
UINTN Height;
UINTN Width;
UINTN ImageIndex;
+ UINTN DataSizePerLine;
BOOLEAN IsAllocated;
+ UINT32 ColorMapNum;
+
+ if (sizeof (BMP_IMAGE_HEADER) > BmpImageSize) {
+ return EFI_INVALID_PARAMETER;
+ }
BmpHeader = (BMP_IMAGE_HEADER *) BmpImage;
+
if (BmpHeader->CharB != 'B' || BmpHeader->CharM != 'M') {
return EFI_UNSUPPORTED;
}
+ //
+ // Doesn't support compress.
+ //
if (BmpHeader->CompressionType != 0) {
return EFI_UNSUPPORTED;
}
//
+ // Only support BITMAPINFOHEADER format.
+ // BITMAPFILEHEADER + BITMAPINFOHEADER = BMP_IMAGE_HEADER
+ //
+ if (BmpHeader->HeaderSize != sizeof (BMP_IMAGE_HEADER) - ((UINTN) &(((BMP_IMAGE_HEADER *)0)->HeaderSize))) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // The data size in each line must be 4 byte alignment.
+ //
+ DataSizePerLine = ((BmpHeader->PixelWidth * BmpHeader->BitPerPixel + 31) >> 3) & (~0x3);
+ BltBufferSize = MultU64x32 (DataSizePerLine, BmpHeader->PixelHeight);
+ if (BltBufferSize > (UINT32) ~0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((BmpHeader->Size != BmpImageSize) ||
+ (BmpHeader->Size < BmpHeader->ImageOffset) ||
+ (BmpHeader->Size - BmpHeader->ImageOffset != BmpHeader->PixelHeight * DataSizePerLine)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
// Calculate Color Map offset in the image.
//
Image = BmpImage;
BmpColorMap = (BMP_COLOR_MAP *) (Image + sizeof (BMP_IMAGE_HEADER));
+ if (BmpHeader->ImageOffset < sizeof (BMP_IMAGE_HEADER)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (BmpHeader->ImageOffset > sizeof (BMP_IMAGE_HEADER)) {
+ switch (BmpHeader->BitPerPixel) {
+ case 1:
+ ColorMapNum = 2;
+ break;
+ case 4:
+ ColorMapNum = 16;
+ break;
+ case 8:
+ ColorMapNum = 256;
+ break;
+ default:
+ ColorMapNum = 0;
+ break;
+ }
+ if (BmpHeader->ImageOffset - sizeof (BMP_IMAGE_HEADER) != sizeof (BMP_COLOR_MAP) * ColorMapNum) {
+ return EFI_INVALID_PARAMETER;
+ }
+ }
//
// Calculate graphics image data address in the image
diff --git a/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Graphics.c b/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Graphics.c
index cfdccc545..5123aacf4 100644
--- a/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Graphics.c
+++ b/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Graphics.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -163,22 +163,78 @@ Returns:
UINTN Height;
UINTN Width;
UINTN ImageIndex;
+ UINTN DataSizePerLine;
BOOLEAN IsAllocated;
+ UINT32 ColorMapNum;
+
+ if (sizeof (BMP_IMAGE_HEADER) > BmpImageSize) {
+ return EFI_INVALID_PARAMETER;
+ }
BmpHeader = (BMP_IMAGE_HEADER *) BmpImage;
+
if (BmpHeader->CharB != 'B' || BmpHeader->CharM != 'M') {
return EFI_UNSUPPORTED;
}
+ //
+ // Doesn't support compress.
+ //
if (BmpHeader->CompressionType != 0) {
return EFI_UNSUPPORTED;
}
//
+ // Only support BITMAPINFOHEADER format.
+ // BITMAPFILEHEADER + BITMAPINFOHEADER = BMP_IMAGE_HEADER
+ //
+ if (BmpHeader->HeaderSize != sizeof (BMP_IMAGE_HEADER) - ((UINTN) &(((BMP_IMAGE_HEADER *)0)->HeaderSize))) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // The data size in each line must be 4 byte alignment.
+ //
+ DataSizePerLine = ((BmpHeader->PixelWidth * BmpHeader->BitPerPixel + 31) >> 3) & (~0x3);
+ BltBufferSize = MultU64x32 (DataSizePerLine, BmpHeader->PixelHeight);
+ if (BltBufferSize > (UINT32) ~0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((BmpHeader->Size != BmpImageSize) ||
+ (BmpHeader->Size < BmpHeader->ImageOffset) ||
+ (BmpHeader->Size - BmpHeader->ImageOffset != BmpHeader->PixelHeight * DataSizePerLine)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
// Calculate Color Map offset in the image.
//
Image = BmpImage;
BmpColorMap = (BMP_COLOR_MAP *) (Image + sizeof (BMP_IMAGE_HEADER));
+ if (BmpHeader->ImageOffset < sizeof (BMP_IMAGE_HEADER)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (BmpHeader->ImageOffset > sizeof (BMP_IMAGE_HEADER)) {
+ switch (BmpHeader->BitPerPixel) {
+ case 1:
+ ColorMapNum = 2;
+ break;
+ case 4:
+ ColorMapNum = 16;
+ break;
+ case 8:
+ ColorMapNum = 256;
+ break;
+ default:
+ ColorMapNum = 0;
+ break;
+ }
+ if (BmpHeader->ImageOffset - sizeof (BMP_IMAGE_HEADER) != sizeof (BMP_COLOR_MAP) * ColorMapNum) {
+ return EFI_INVALID_PARAMETER;
+ }
+ }
//
// Calculate graphics image data address in the image
diff --git a/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiCommonLib.h b/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiCommonLib.h
index 83625bfd1..a80446e36 100644
--- a/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiCommonLib.h
+++ b/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiCommonLib.h
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -1042,7 +1042,7 @@ Arguments:
Returns:
Return a positive integer if String is lexicall greater than String2; Zero if
- the two strings are identical; and a negative interger if String is lexically
+ the two strings are identical; and a negative integer if String is lexically
less than String2.
--*/
;
diff --git a/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/StdErr.c b/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/StdErr.c
index 9d110b7c1..e48cbe834 100644
--- a/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/StdErr.c
+++ b/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/StdErr.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -176,7 +176,7 @@ Returns:
return 0;
}
- for (Index = 0; Index < EFI_DRIVER_LIB_MAX_PRINT_BUFFER; Index++) {
+ for (Index = 0; Index <= MaxIndex; Index++) {
UnicodeFormat[Index] = (CHAR16) Format[Index];
}
diff --git a/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/PrintLite/StdErr.c b/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/PrintLite/StdErr.c
index 9d110b7c1..e48cbe834 100644
--- a/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/PrintLite/StdErr.c
+++ b/edk2/EdkCompatibilityPkg/Foundation/Library/Dxe/PrintLite/StdErr.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -176,7 +176,7 @@ Returns:
return 0;
}
- for (Index = 0; Index < EFI_DRIVER_LIB_MAX_PRINT_BUFFER; Index++) {
+ for (Index = 0; Index <= MaxIndex; Index++) {
UnicodeFormat[Index] = (CHAR16) Format[Index];
}
diff --git a/edk2/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/String.c b/edk2/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/String.c
index fcc962576..e0fe93a97 100644
--- a/edk2/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/String.c
+++ b/edk2/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/String.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -147,7 +147,7 @@ Arguments:
Returns:
Return a positive integer if String is lexicall greater than String2; Zero if
- the two strings are identical; and a negative interger if String is lexically
+ the two strings are identical; and a negative integer if String is lexically
less than String2.
--*/
@@ -374,7 +374,7 @@ Arguments:
Returns:
Return a positive integer if String is lexicall greater than String2; Zero if
- the two strings are identical; and a negative interger if String is lexically
+ the two strings are identical; and a negative integer if String is lexically
less than String2.
--*/
{
diff --git a/edk2/EdkCompatibilityPkg/Foundation/Library/Smm/SmmScriptLib/PiSmmDefinition.h b/edk2/EdkCompatibilityPkg/Foundation/Library/Smm/SmmScriptLib/PiSmmDefinition.h
index 981b61bfe..350b1374f 100644
--- a/edk2/EdkCompatibilityPkg/Foundation/Library/Smm/SmmScriptLib/PiSmmDefinition.h
+++ b/edk2/EdkCompatibilityPkg/Foundation/Library/Smm/SmmScriptLib/PiSmmDefinition.h
@@ -5,7 +5,7 @@
runtime s3 boot Script. This header file is to definied PI SMM related definition to locate
SmmSaveState Protocol
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions
@@ -192,10 +192,10 @@ EFI_STATUS
@param[in,out] CommBuffer Points to the optional communication buffer.
@param[in,out] CommBufferSize Points to the size of the optional communication buffer.
- @retval EFI_SUCCESS Interrupt source was processed successfully but not quiesced.
+ @retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was processed successfully but not quiesced.
@retval EFI_INTERRUPT_PENDING One or more SMI sources could not be quiesced.
- @retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was not handled or quiesced.
- @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED Interrupt source was handled and quiesced.
+ @retval EFI_NOT_FOUND Interrupt source was not handled or quiesced.
+ @retval EFI_SUCCESS Interrupt source was handled and quiesced.
**/
typedef
EFI_STATUS