Partially make EdkModulePkg pass intel IPF compiler with /W4 /WX switched on.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2313 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -19,59 +19,7 @@ Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Decompression algorithm begins here
|
||||
//
|
||||
#define BITBUFSIZ 32
|
||||
#define MAXMATCH 256
|
||||
#define THRESHOLD 3
|
||||
#define CODE_BIT 16
|
||||
#define BAD_TABLE - 1
|
||||
|
||||
//
|
||||
// C: Char&Len Set; P: Position Set; T: exTra Set
|
||||
//
|
||||
#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
|
||||
#define CBIT 9
|
||||
#define MAXPBIT 5
|
||||
#define TBIT 5
|
||||
#define MAXNP ((1U << MAXPBIT) - 1)
|
||||
#define NT (CODE_BIT + 3)
|
||||
#if NT > MAXNP
|
||||
#define NPT NT
|
||||
#else
|
||||
#define NPT MAXNP
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
UINT8 *mSrcBase; // Starting address of compressed data
|
||||
UINT8 *mDstBase; // Starting address of decompressed data
|
||||
UINT32 mOutBuf;
|
||||
UINT32 mInBuf;
|
||||
|
||||
UINT16 mBitCount;
|
||||
UINT32 mBitBuf;
|
||||
UINT32 mSubBitBuf;
|
||||
UINT16 mBlockSize;
|
||||
UINT32 mCompSize;
|
||||
UINT32 mOrigSize;
|
||||
|
||||
UINT16 mBadTableFlag;
|
||||
|
||||
UINT16 mLeft[2 * NC - 1];
|
||||
UINT16 mRight[2 * NC - 1];
|
||||
UINT8 mCLen[NC];
|
||||
UINT8 mPTLen[NPT];
|
||||
UINT16 mCTable[4096];
|
||||
UINT16 mPTTable[256];
|
||||
|
||||
//
|
||||
// The length of the field 'Position Set Code Length Array Size' in Block Header.
|
||||
// For EFI 1.1 de/compression algorithm, mPBit = 4
|
||||
// For Tiano de/compression algorithm, mPBit = 5
|
||||
//
|
||||
UINT8 mPBit;
|
||||
} SCRATCH_DATA;
|
||||
#include "BaseUefiTianoDecompressLibInternals.h"
|
||||
|
||||
VOID
|
||||
FillBuf (
|
||||
@@ -196,6 +144,8 @@ Returns:
|
||||
UINT16 Avail;
|
||||
UINT16 NextCode;
|
||||
UINT16 Mask;
|
||||
UINT16 WordOfStart;
|
||||
UINT16 WordOfCount;
|
||||
|
||||
for (Index = 1; Index <= 16; Index++) {
|
||||
Count[Index] = 0;
|
||||
@@ -208,7 +158,9 @@ Returns:
|
||||
Start[1] = 0;
|
||||
|
||||
for (Index = 1; Index <= 16; Index++) {
|
||||
Start[Index + 1] = (UINT16) (Start[Index] + (Count[Index] << (16 - Index)));
|
||||
WordOfStart = Start[Index];
|
||||
WordOfCount = Count[Index];
|
||||
Start[Index + 1] = (UINT16) (WordOfStart + (WordOfCount << (16 - Index)));
|
||||
}
|
||||
|
||||
if (Start[17] != 0) {
|
||||
@@ -610,7 +562,7 @@ Returns: (VOID)
|
||||
for (;;) {
|
||||
CharC = DecodeC (Sd);
|
||||
if (Sd->mBadTableFlag != 0) {
|
||||
return ;
|
||||
goto Done ;
|
||||
}
|
||||
|
||||
if (CharC < 256) {
|
||||
@@ -618,7 +570,7 @@ Returns: (VOID)
|
||||
// Process an Original character
|
||||
//
|
||||
if (Sd->mOutBuf >= Sd->mOrigSize) {
|
||||
return ;
|
||||
goto Done ;
|
||||
} else {
|
||||
Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC;
|
||||
}
|
||||
@@ -637,7 +589,7 @@ Returns: (VOID)
|
||||
while ((INT16) (BytesRemain) >= 0) {
|
||||
Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];
|
||||
if (Sd->mOutBuf >= Sd->mOrigSize) {
|
||||
return ;
|
||||
goto Done ;
|
||||
}
|
||||
|
||||
BytesRemain--;
|
||||
@@ -645,6 +597,7 @@ Returns: (VOID)
|
||||
}
|
||||
}
|
||||
|
||||
Done:
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@@ -37,6 +37,7 @@
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>BaseUefiTianoDecompressLib.c</Filename>
|
||||
<Filename>BaseUefiTianoDecompressLibInternals.h</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
|
@@ -0,0 +1,224 @@
|
||||
/** @file
|
||||
Internal include file for Base UEFI Decompress Libary.
|
||||
|
||||
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: BaseUefiDecompressLibInternals.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __BASE_UEFI_TIANO_DECOMPRESS_LIB_INTERNALS_H__
|
||||
#define __BASE_UEFI_TIANO_DECOMPRESS_LIB_INTERNALS_H__
|
||||
|
||||
//
|
||||
// Decompression algorithm begins here
|
||||
//
|
||||
#define BITBUFSIZ 32
|
||||
#define MAXMATCH 256
|
||||
#define THRESHOLD 3
|
||||
#define CODE_BIT 16
|
||||
#define BAD_TABLE - 1
|
||||
|
||||
//
|
||||
// C: Char&Len Set; P: Position Set; T: exTra Set
|
||||
//
|
||||
#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
|
||||
#define CBIT 9
|
||||
#define MAXPBIT 5
|
||||
#define TBIT 5
|
||||
#define MAXNP ((1U << MAXPBIT) - 1)
|
||||
#define NT (CODE_BIT + 3)
|
||||
#if NT > MAXNP
|
||||
#define NPT NT
|
||||
#else
|
||||
#define NPT MAXNP
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
UINT8 *mSrcBase; // Starting address of compressed data
|
||||
UINT8 *mDstBase; // Starting address of decompressed data
|
||||
UINT32 mOutBuf;
|
||||
UINT32 mInBuf;
|
||||
|
||||
UINT16 mBitCount;
|
||||
UINT32 mBitBuf;
|
||||
UINT32 mSubBitBuf;
|
||||
UINT16 mBlockSize;
|
||||
UINT32 mCompSize;
|
||||
UINT32 mOrigSize;
|
||||
|
||||
UINT16 mBadTableFlag;
|
||||
|
||||
UINT16 mLeft[2 * NC - 1];
|
||||
UINT16 mRight[2 * NC - 1];
|
||||
UINT8 mCLen[NC];
|
||||
UINT8 mPTLen[NPT];
|
||||
UINT16 mCTable[4096];
|
||||
UINT16 mPTTable[256];
|
||||
|
||||
//
|
||||
// The length of the field 'Position Set Code Length Array Size' in Block Header.
|
||||
// For EFI 1.1 de/compression algorithm, mPBit = 4
|
||||
// For Tiano de/compression algorithm, mPBit = 5
|
||||
//
|
||||
UINT8 mPBit;
|
||||
} SCRATCH_DATA;
|
||||
|
||||
/**
|
||||
Read NumOfBit of bits from source into mBitBuf
|
||||
|
||||
Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
|
||||
|
||||
@param Sd The global scratch data
|
||||
@param NumOfBits The number of bits to shift and read.
|
||||
|
||||
**/
|
||||
VOID
|
||||
FillBuf (
|
||||
IN SCRATCH_DATA *Sd,
|
||||
IN UINT16 NumOfBits
|
||||
);
|
||||
|
||||
/**
|
||||
Get NumOfBits of bits out from mBitBuf
|
||||
|
||||
Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
|
||||
NumOfBits of bits from source. Returns NumOfBits of bits that are
|
||||
popped out.
|
||||
|
||||
@param Sd The global scratch data.
|
||||
@param NumOfBits The number of bits to pop and read.
|
||||
|
||||
@return The bits that are popped out.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
GetBits (
|
||||
IN SCRATCH_DATA *Sd,
|
||||
IN UINT16 NumOfBits
|
||||
);
|
||||
|
||||
/**
|
||||
Creates Huffman Code mapping table according to code length array.
|
||||
|
||||
Creates Huffman Code mapping table for Extra Set, Char&Len Set
|
||||
and Position Set according to code length array.
|
||||
|
||||
@param Sd The global scratch data
|
||||
@param NumOfChar Number of symbols in the symbol set
|
||||
@param BitLen Code length array
|
||||
@param TableBits The width of the mapping table
|
||||
@param Table The table
|
||||
|
||||
@retval 0 OK.
|
||||
@retval BAD_TABLE The table is corrupted.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
MakeTable (
|
||||
IN SCRATCH_DATA *Sd,
|
||||
IN UINT16 NumOfChar,
|
||||
IN UINT8 *BitLen,
|
||||
IN UINT16 TableBits,
|
||||
OUT UINT16 *Table
|
||||
);
|
||||
|
||||
/**
|
||||
Decodes a position value.
|
||||
|
||||
Get a position value according to Position Huffman Table.
|
||||
|
||||
@param Sd the global scratch data
|
||||
|
||||
@return The position value decoded.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
DecodeP (
|
||||
IN SCRATCH_DATA *Sd
|
||||
);
|
||||
|
||||
/**
|
||||
Reads code lengths for the Extra Set or the Position Set.
|
||||
|
||||
Read in the Extra Set or Pointion Set Length Arrary, then
|
||||
generate the Huffman code mapping for them.
|
||||
|
||||
@param Sd The global scratch data.
|
||||
@param nn Number of symbols.
|
||||
@param nbit Number of bits needed to represent nn.
|
||||
@param Special The special symbol that needs to be taken care of.
|
||||
|
||||
@retval 0 OK.
|
||||
@retval BAD_TABLE Table is corrupted.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
ReadPTLen (
|
||||
IN SCRATCH_DATA *Sd,
|
||||
IN UINT16 nn,
|
||||
IN UINT16 nbit,
|
||||
IN UINT16 Special
|
||||
);
|
||||
|
||||
/**
|
||||
Reads code lengths for Char&Len Set.
|
||||
|
||||
Read in and decode the Char&Len Set Code Length Array, then
|
||||
generate the Huffman Code mapping table for the Char&Len Set.
|
||||
|
||||
@param Sd the global scratch data
|
||||
|
||||
**/
|
||||
VOID
|
||||
ReadCLen (
|
||||
SCRATCH_DATA *Sd
|
||||
);
|
||||
|
||||
/**
|
||||
Decode a character/length value.
|
||||
|
||||
Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates
|
||||
Huffman code mapping table for Extra Set, Code&Len Set and
|
||||
Position Set.
|
||||
|
||||
@param Sd The global scratch data.
|
||||
|
||||
@return The value decoded.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
DecodeC (
|
||||
SCRATCH_DATA *Sd
|
||||
);
|
||||
|
||||
/**
|
||||
Decode the source data and put the resulting data into the destination buffer.
|
||||
|
||||
Decode the source data and put the resulting data into the destination buffer.
|
||||
|
||||
@param Sd The global scratch data
|
||||
|
||||
**/
|
||||
VOID
|
||||
Decode (
|
||||
SCRATCH_DATA *Sd
|
||||
);
|
||||
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
UefiTianoDecompress (
|
||||
IN CONST VOID *Source,
|
||||
IN OUT VOID *Destination,
|
||||
IN OUT VOID *Scratch,
|
||||
IN UINT32 Version
|
||||
);
|
||||
|
||||
#endif
|
@@ -22,6 +22,7 @@ Abstract:
|
||||
EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *mEsalBootService = NULL;
|
||||
EFI_PLABEL mPlabel;
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
DxeSalLibInitialize (
|
||||
@@ -43,7 +44,7 @@ DxeSalLibInitialize (
|
||||
// virtual). So lets grap the physical PLABEL for the EsalEntryPoint and store it
|
||||
// away. We cache it in a module global, so we can register the vitrual version.
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, &mEsalBootService);
|
||||
Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, (VOID **) &mEsalBootService);
|
||||
if (EFI_ERROR (Status)) {
|
||||
mEsalBootService = NULL;
|
||||
return EFI_SUCCESS;
|
||||
|
@@ -105,7 +105,7 @@ Returns:
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
ConvertBmpToGopBlt (
|
||||
IN VOID *BmpImage,
|
||||
@@ -664,6 +664,7 @@ Returns:
|
||||
UINT32 VerticalResolution;
|
||||
UINT32 ColorDepth;
|
||||
UINT32 RefreshRate;
|
||||
UINTN BufferGlyphWidth;
|
||||
|
||||
GlyphStatus = 0;
|
||||
|
||||
@@ -743,6 +744,7 @@ Returns:
|
||||
//
|
||||
// Blt a character to the screen
|
||||
//
|
||||
BufferGlyphWidth = GLYPH_WIDTH * StrLen (Buffer);
|
||||
if (GraphicsOutput != NULL) {
|
||||
Status = GraphicsOutput->Blt (
|
||||
GraphicsOutput,
|
||||
@@ -752,9 +754,9 @@ Returns:
|
||||
0,
|
||||
X,
|
||||
Y,
|
||||
GLYPH_WIDTH * StrLen (Buffer),
|
||||
BufferGlyphWidth,
|
||||
GLYPH_HEIGHT,
|
||||
GLYPH_WIDTH * StrLen (Buffer) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||
BufferGlyphWidth * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||
);
|
||||
} else {
|
||||
Status = UgaDraw->Blt (
|
||||
@@ -765,9 +767,9 @@ Returns:
|
||||
0,
|
||||
X,
|
||||
Y,
|
||||
GLYPH_WIDTH * StrLen (Buffer),
|
||||
BufferGlyphWidth,
|
||||
GLYPH_HEIGHT,
|
||||
GLYPH_WIDTH * StrLen (Buffer) * sizeof (EFI_UGA_PIXEL)
|
||||
BufferGlyphWidth * sizeof (EFI_UGA_PIXEL)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -128,6 +128,8 @@ Returns:
|
||||
UINT8 *Destination;
|
||||
UINTN Index;
|
||||
BOOLEAN Finished;
|
||||
UINTN SizeofLanguage;
|
||||
UINTN SizeofString;
|
||||
|
||||
StringPack = (EFI_HII_STRING_PACK *) StringBuffer;
|
||||
Finished = FALSE;
|
||||
@@ -248,14 +250,16 @@ Returns:
|
||||
//
|
||||
// Pointing to a new string pack location
|
||||
//
|
||||
SizeofLanguage = StrSize (Language);
|
||||
SizeofString = StrSize (String);
|
||||
StringPackBuffer->Header.Length = (UINT32)
|
||||
(
|
||||
sizeof (EFI_HII_STRING_PACK) -
|
||||
sizeof (EFI_STRING) +
|
||||
sizeof (RELOFST) +
|
||||
sizeof (RELOFST) +
|
||||
StrSize (Language) +
|
||||
StrSize (String)
|
||||
SizeofLanguage +
|
||||
SizeofString
|
||||
);
|
||||
StringPackBuffer->Header.Type = EFI_HII_STRING;
|
||||
StringPackBuffer->LanguageNameString = (UINT16) ((UINTN) &PackDestination[3] - (UINTN) StringPackBuffer);
|
||||
@@ -423,7 +427,7 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
GetHiiInterface (
|
||||
OUT EFI_HII_PROTOCOL **Hii
|
||||
|
@@ -467,11 +467,15 @@ Returns:
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR16 *NameSuffixed;
|
||||
UINTN NameLength;
|
||||
UINTN SuffixLength;
|
||||
|
||||
//
|
||||
// enough to concatenate both strings.
|
||||
//
|
||||
NameSuffixed = AllocateZeroPool ((StrLen (Name) + StrLen (Suffix) + 1) * sizeof (CHAR16));
|
||||
NameLength = StrLen (Name);
|
||||
SuffixLength = StrLen (Suffix);
|
||||
NameSuffixed = AllocateZeroPool ((NameLength + SuffixLength + 1) * sizeof (CHAR16));
|
||||
|
||||
StrCpy (NameSuffixed, Name);
|
||||
StrCat (NameSuffixed, Suffix);
|
||||
|
@@ -20,7 +20,7 @@ Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
#include "EdkPeCoffLoaderLibInternals.h"
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
|
@@ -31,6 +31,7 @@
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>EdkPeCoffLoader.c</Filename>
|
||||
<Filename>EdkPeCoffLoaderLibInternals.h</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
|
@@ -0,0 +1,48 @@
|
||||
/** @file
|
||||
Declaration of internal functions in PE/COFF Lib.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
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: BasePeCoffLibInternals.h
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PECOFF_LOADER_LIB_INTERNALS__
|
||||
#define __PECOFF_LOADER_LIB_INTERNALS__
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
TianoPeCoffLoaderLibGetImageInfo (
|
||||
IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
TianoPeCoffLoaderLibLoadImage (
|
||||
IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
TianoPeCoffLoaderLibRelocateImage (
|
||||
IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
TianoPeCoffLoaderLibUnloadimage (
|
||||
IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
|
||||
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
);
|
||||
|
||||
#endif
|
@@ -52,6 +52,7 @@ Returns:
|
||||
}
|
||||
}
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
RuntimeLibVirtualNotifyEvent (
|
||||
|
Reference in New Issue
Block a user