]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Merge PEI & DXE LzmaCustomDecompressLib. A previous implementation
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 4 May 2009 20:00:04 +0000 (20:00 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 4 May 2009 20:00:04 +0000 (20:00 +0000)
was causing the LZMA decompression code to request a large buffer,
which caused an ASSERT to fail for PEI's AllocatePool.  The
current implementation, which uses the LzmaDecode function, does
not have this issue and therefore both the PEI & DXE versions can
use AllocatePool/FreePool.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8236 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Dxe/LzmaCustomDecompressLib.inf [deleted file]
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Dxe/LzmaDxeMemory.c [deleted file]
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf [new file with mode: 0644]
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Pei/LzmaCustomDecompressLib.inf [deleted file]
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Pei/LzmaPeiMemory.c [deleted file]
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/UefiLzma.h

index a5ed7ec06138d0cad25ed0b5cc328f1cd05f5e09..31e97a3262e79dde6cf3efa0ed08ec2713f21275 100644 (file)
 \r
 [Components.common]\r
   IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf\r
-  IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Pei/LzmaCustomDecompressLib.inf\r
-  IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Dxe/LzmaCustomDecompressLib.inf\r
+  IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf\r
   IntelFrameworkModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf\r
   IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.inf\r
   IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf\r
diff --git a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Dxe/LzmaCustomDecompressLib.inf b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Dxe/LzmaCustomDecompressLib.inf
deleted file mode 100644 (file)
index cfeed7c..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#/** @file\r
-# LZMA GUIDed Section Extraction Protocol Library\r
-#\r
-# Uefi Decompression library instance\r
-# Copyright (c) 2006, 2009, Intel Corporation.\r
-#\r
-#  All rights reserved. This program and the accompanying materials\r
-#  are licensed and made available under the terms and conditions of the BSD License\r
-#  which accompanies this distribution. The full text of the license may be found at\r
-#  http://opensource.org/licenses/bsd-license.php\r
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-#\r
-#**/\r
-\r
-[Defines]\r
-  INF_VERSION                    = 0x00010005\r
-  BASE_NAME                      = LzmaDxeDecompressLib\r
-  FILE_GUID                      = 35194660-7421-44ad-9636-e44885f092d1\r
-  MODULE_TYPE                    = BASE\r
-  VERSION_STRING                 = 1.0\r
-  LIBRARY_CLASS                  = BASE\r
-  EDK_RELEASE_VERSION            = 0x00020000\r
-  EFI_SPECIFICATION_VERSION      = 0x00020000\r
-\r
-  CONSTRUCTOR                    = LzmaDecompressLibConstructor\r
-\r
-#\r
-# The following information is for reference only and not required by the build tools.\r
-#\r
-#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
-#\r
-\r
-[Sources.common]\r
-  LzmaDxeMemory.c\r
-  ../LzmaDecompress.c\r
-  ../Sdk/C/LzFind.c\r
-  ../Sdk/C/LzmaDec.c\r
-  ../GuidedSectionExtraction.c\r
-\r
-[Packages]\r
-  MdePkg/MdePkg.dec\r
-  IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec\r
-\r
-[Guids]\r
-  gLzmaCustomDecompressGuid \r
-\r
-[LibraryClasses]\r
-  BaseLib\r
-  DebugLib\r
-  BaseMemoryLib\r
-  MemoryAllocationLib\r
-  ExtractGuidedSectionLib\r
-\r
diff --git a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Dxe/LzmaDxeMemory.c b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Dxe/LzmaDxeMemory.c
deleted file mode 100644 (file)
index 2973306..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/** @file\r
-  LZMA Memory Allocation for DXE\r
-\r
-  Copyright (c) 2006 - 2009, Intel Corporation<BR>\r
-  All rights reserved. This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <Uefi.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include "Sdk/C/Types.h"\r
-\r
-STATIC\r
-VOID *\r
-SzAlloc(\r
-  void *p,\r
-  size_t size\r
-  )\r
-{\r
-  void *np;\r
-  p = p;\r
-  np = AllocatePool(size);\r
-  return np;\r
-}\r
-\r
-STATIC\r
-VOID\r
-SzFree(\r
-  void *p,\r
-  void *address\r
-  )\r
-{\r
-  p = p;\r
-  if (address != NULL) {\r
-    FreePool(address);\r
-  }\r
-}\r
-\r
-ISzAlloc g_Alloc = { SzAlloc, SzFree };\r
-\r
diff --git a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
new file mode 100644 (file)
index 0000000..9b4d784
--- /dev/null
@@ -0,0 +1,54 @@
+#/** @file\r
+# LZMA GUIDed Section Extraction Protocol Library\r
+#\r
+# Uefi Decompression library instance\r
+# Copyright (c) 2006, 2009, Intel Corporation.\r
+#\r
+#  All rights reserved. This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution. The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+#**/\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = LzmaDecompressLib\r
+  FILE_GUID                      = 35194660-7421-44ad-9636-e44885f092d1\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = BASE\r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+  CONSTRUCTOR                    = LzmaDecompressLibConstructor\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources.common]\r
+  LzmaDecompress.c\r
+  Sdk/C/LzFind.c\r
+  Sdk/C/LzmaDec.c\r
+  GuidedSectionExtraction.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec\r
+\r
+[Guids]\r
+  gLzmaCustomDecompressGuid \r
+\r
+[LibraryClasses]\r
+  BaseLib\r
+  DebugLib\r
+  BaseMemoryLib\r
+  MemoryAllocationLib\r
+  ExtractGuidedSectionLib\r
+\r
index f1729825c746a8534ca3579c7929b67994f043e8..439e15beaba74b594dc9167b6a62c7c53032beb6 100644 (file)
 #include "Sdk/C/7zVersion.h"\r
 #include "Sdk/C/LzmaDec.h"\r
 \r
-extern ISzAlloc g_Alloc;\r
+/**\r
+  Allocation routine used by LZMA decompression.\r
+\r
+  @param p                Pointer to the ISzAlloc instance\r
+  @param size             The size in bytes to be allocated\r
+\r
+  @return The allocated pointer address, or NULL on failure\r
+**/\r
+STATIC\r
+VOID *\r
+SzAlloc (\r
+  void *p,\r
+  size_t size\r
+  )\r
+{\r
+  return AllocatePool (size);\r
+}\r
+\r
+/**\r
+  Free routine used by LZMA decompression.\r
+\r
+  @param p                Pointer to the ISzAlloc instance\r
+  @param address          The address to be freed\r
+**/\r
+STATIC\r
+VOID\r
+SzFree (\r
+  void *p,\r
+  void *address\r
+  )\r
+{\r
+  if (address != NULL) {\r
+    FreePool (address);\r
+  }\r
+}\r
+\r
+STATIC ISzAlloc g_Alloc = { SzAlloc, SzFree };\r
 \r
 #define LZMA_HEADER_SIZE (LZMA_PROPS_SIZE + 8)\r
 \r
diff --git a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Pei/LzmaCustomDecompressLib.inf b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Pei/LzmaCustomDecompressLib.inf
deleted file mode 100644 (file)
index a9b347b..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#/** @file\r
-# LZMA GUIDed Section Extraction Protocol Library\r
-#\r
-# Uefi Decompression library instance\r
-# Copyright (c) 2006, 2009, Intel Corporation.\r
-#\r
-#  All rights reserved. This program and the accompanying materials\r
-#  are licensed and made available under the terms and conditions of the BSD License\r
-#  which accompanies this distribution. The full text of the license may be found at\r
-#  http://opensource.org/licenses/bsd-license.php\r
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-#\r
-#**/\r
-\r
-[Defines]\r
-  INF_VERSION                    = 0x00010005\r
-  BASE_NAME                      = LzmaPeiDecompressLib\r
-  FILE_GUID                      = 6725ae86-6ed1-43bd-aeec-0517c0749d70\r
-  MODULE_TYPE                    = BASE\r
-  VERSION_STRING                 = 1.0\r
-  LIBRARY_CLASS                  = BASE\r
-  EDK_RELEASE_VERSION            = 0x00020000\r
-  EFI_SPECIFICATION_VERSION      = 0x00020000\r
-\r
-  CONSTRUCTOR                    = LzmaDecompressLibConstructor\r
-\r
-#\r
-# The following information is for reference only and not required by the build tools.\r
-#\r
-#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
-#\r
-\r
-[Sources.common]\r
-  LzmaPeiMemory.c\r
-  ../LzmaDecompress.c\r
-  ../Sdk/C/LzFind.c\r
-  ../Sdk/C/LzmaDec.c\r
-  ../GuidedSectionExtraction.c\r
-\r
-[Packages]\r
-  MdePkg/MdePkg.dec\r
-  IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec\r
-\r
-[Guids]\r
-  gLzmaCustomDecompressGuid \r
-\r
-[LibraryClasses]\r
-  BaseLib\r
-  DebugLib\r
-  BaseMemoryLib\r
-  MemoryAllocationLib\r
-  ExtractGuidedSectionLib\r
-\r
diff --git a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Pei/LzmaPeiMemory.c b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Pei/LzmaPeiMemory.c
deleted file mode 100644 (file)
index a6824f1..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/** @file\r
-  LZMA Memory Allocation for PEI\r
-\r
-  AllocatePool does not work for large blocks during PEI, so we must\r
-  use AllocatePages.\r
-\r
-  Copyright (c) 2006 - 2009, Intel Corporation<BR>\r
-  All rights reserved. This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <Uefi.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include "Sdk/C/Types.h"\r
-\r
-STATIC\r
-VOID *\r
-SzAlloc(\r
-  void *p,\r
-  size_t size\r
-  )\r
-{\r
-  void *np;\r
-  p = p;\r
-  if (size > EFI_PAGE_SIZE) {\r
-    np = AllocatePages(EFI_SIZE_TO_PAGES(size));\r
-  } else {\r
-    np = AllocatePool(size);\r
-  }\r
-  return np;\r
-}\r
-\r
-STATIC\r
-VOID\r
-SzFree(\r
-  void *p,\r
-  void *address\r
-  )\r
-{\r
-  p = p;\r
-  if (address != NULL) {\r
-    FreePool(address);\r
-  }\r
-}\r
-\r
-ISzAlloc g_Alloc = { SzAlloc, SzFree };\r
-\r
index f6db7f15cbf50ef12840fa533d754f5907364d5b..fdd013c5e36a716bef3aa63b1564829438fa4d93 100644 (file)
@@ -37,5 +37,7 @@ typedef int ptrdiff_t;
 #define memcpy CopyMem\r
 #define memmove CopyMem\r
 \r
+#define _LZMA_SIZE_OPT\r
+\r
 #endif // __UEFILZMA_H__\r
 \r