Fix bugs in decompress implement in EfiLdr, and enable FAT driver in FDF file.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7254 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2009-01-13 07:41:23 +00:00
parent 5326528b2f
commit f8e01ca87b
3 changed files with 57 additions and 35 deletions

View File

@ -61,10 +61,6 @@ READ_STATUS = TRUE
READ_LOCK_CAP = TRUE READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE READ_LOCK_STATUS = TRUE
APRIORI DXE {
INF IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.inf
}
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
@ -73,7 +69,6 @@ INF DuetPkg/FSVariable/FSVariable.inf
INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
INF IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.inf
INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
@ -101,28 +96,28 @@ INF IntelFrameworkModulePkg/Bus/Pci/VgaMiniPortDxe/VgaMiniPortDxe.inf
INF IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/VgaClassDxe.inf INF IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/VgaClassDxe.inf
# IDE Support # IDE Support
#IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf #IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
# Usb Support # Usb Support
INF MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf #INF MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf
INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf #INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf #INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf #INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
# ISA Support # ISA Support
INF DuetPkg/IsaAcpiDxe/IsaAcpi.inf INF DuetPkg/IsaAcpiDxe/IsaAcpi.inf
INF IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.inf INF IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.inf
INF IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf INF IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf
#INF IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf INF IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
INF IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf INF IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
#INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
#INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
#INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
#FILE DRIVER = 961578FE-B6B7-44c3-AF35-6BC705CD2B1F { FILE DRIVER = 961578FE-B6B7-44c3-AF35-6BC705CD2B1F {
# SECTION PE32 = FatBinPkg/EnhancedFatDxe/Ia32/Fat.efi SECTION PE32 = FatBinPkg/EnhancedFatDxe/Ia32/Fat.efi
# } }
[Rule.Common.PEI_CORE] [Rule.Common.PEI_CORE]
FILE PEI_CORE = $(NAMED_GUID) { FILE PEI_CORE = $(NAMED_GUID) {

View File

@ -110,6 +110,10 @@ EfiLoader (
SystemHang(); SystemHang();
} }
AsciiSPrint (PrintBuffer, 256, "BFV decompress: DestinationSize=0x%X, ScratchSize=0x%X!\n",
DestinationSize, ScratchSize);
PrintString (PrintBuffer);
Status = TianoDecompress ( Status = TianoDecompress (
(VOID *)(UINTN)(EFILDR_HEADER_ADDRESS + EFILDRImage->Offset), (VOID *)(UINTN)(EFILDR_HEADER_ADDRESS + EFILDRImage->Offset),
EFILDRImage->Length, EFILDRImage->Length,

View File

@ -189,15 +189,19 @@ Returns:
UINT16 Start[18]; UINT16 Start[18];
UINT16 *Pointer; UINT16 *Pointer;
UINT16 Index3; UINT16 Index3;
UINT16 Index; volatile UINT16 Index;
UINT16 Len; UINT16 Len;
UINT16 Char; UINT16 Char;
UINT16 JuBits; UINT16 JuBits;
UINT16 Avail; UINT16 Avail;
UINT16 NextCode; UINT16 NextCode;
UINT16 Mask; UINT16 Mask;
UINT16 WordOfStart;
UINT16 WordOfCount;
SetMem (&Count[1], sizeof(UINT16) * 16, 0); for (Index = 1; Index <= 16; Index++) {
Count[Index] = 0;
}
for (Index = 0; Index < NumOfChar; Index++) { for (Index = 0; Index < NumOfChar; Index++) {
Count[BitLen[Index]]++; Count[BitLen[Index]]++;
@ -206,7 +210,9 @@ Returns:
Start[1] = 0; Start[1] = 0;
for (Index = 1; Index <= 16; Index++) { 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) { if (Start[17] != 0) {
@ -222,14 +228,17 @@ Returns:
} }
while (Index <= 16) { while (Index <= 16) {
Weight[Index++] = (UINT16) (1U << (16 - Index)); Weight[Index] = (UINT16) (1U << (16 - Index));
Index++;
} }
Index = (UINT16) (Start[TableBits + 1] >> JuBits); Index = (UINT16) (Start[TableBits + 1] >> JuBits);
if (Index != 0) { if (Index != 0) {
Index3 = (UINT16) (1U << TableBits); Index3 = (UINT16) (1U << TableBits);
SetMem(&Table[Index], sizeof(UINT16) * (Index3 - Index + 1), 0); while (Index != Index3) {
Table[Index++] = 0;
}
} }
Avail = NumOfChar; Avail = NumOfChar;
@ -366,7 +375,7 @@ Returns:
{ {
UINT16 Number; UINT16 Number;
UINT16 CharC; UINT16 CharC;
UINT16 Index; volatile UINT16 Index;
UINT32 Mask; UINT32 Mask;
Number = (UINT16) GetBits (Sd, nbit); Number = (UINT16) GetBits (Sd, nbit);
@ -378,7 +387,9 @@ Returns:
Sd->mPTTable[Index] = CharC; Sd->mPTTable[Index] = CharC;
} }
SetMem ((VOID*) &Sd->mPTLen, nn * sizeof(UINT8), 0); for (Index = 0; Index < nn; Index++) {
Sd->mPTLen[Index] = 0;
}
return 0; return 0;
} }
@ -409,7 +420,10 @@ Returns:
} }
} }
SetMem ((VOID*) &Sd->mPTLen[Index], (nn - Index) * sizeof(UINT8), 0); while (Index < nn) {
Sd->mPTLen[Index++] = 0;
}
return MakeTable (Sd, nn, Sd->mPTLen, 8, Sd->mPTTable); return MakeTable (Sd, nn, Sd->mPTLen, 8, Sd->mPTTable);
} }
@ -433,7 +447,7 @@ Returns: (VOID)
{ {
UINT16 Number; UINT16 Number;
UINT16 CharC; UINT16 CharC;
UINT16 Index; volatile UINT16 Index;
UINT32 Mask; UINT32 Mask;
Number = (UINT16) GetBits (Sd, CBIT); Number = (UINT16) GetBits (Sd, CBIT);
@ -441,7 +455,9 @@ Returns: (VOID)
if (Number == 0) { if (Number == 0) {
CharC = (UINT16) GetBits (Sd, CBIT); CharC = (UINT16) GetBits (Sd, CBIT);
SetMem ((VOID*)&Sd->mCLen, sizeof(UINT8) * NC, 0); for (Index = 0; Index < NC; Index++) {
Sd->mCLen[Index] = 0;
}
for (Index = 0; Index < 4096; Index++) { for (Index = 0; Index < 4096; Index++) {
Sd->mCTable[Index] = CharC; Sd->mCTable[Index] = CharC;
@ -495,7 +511,9 @@ Returns: (VOID)
} }
} }
SetMem ((VOID*) &Sd->mCLen[Index], sizeof(UINT8) * (NC - Index), 0); while (Index < NC) {
Sd->mCLen[Index++] = 0;
}
MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable); MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable);
@ -596,7 +614,7 @@ Returns: (VOID)
for (;;) { for (;;) {
CharC = DecodeC (Sd); CharC = DecodeC (Sd);
if (Sd->mBadTableFlag != 0) { if (Sd->mBadTableFlag != 0) {
return ; goto Done ;
} }
if (CharC < 256) { if (CharC < 256) {
@ -604,7 +622,7 @@ Returns: (VOID)
// Process an Original character // Process an Original character
// //
if (Sd->mOutBuf >= Sd->mOrigSize) { if (Sd->mOutBuf >= Sd->mOrigSize) {
return ; goto Done ;
} else { } else {
Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC; Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC;
} }
@ -623,7 +641,7 @@ Returns: (VOID)
while ((INT16) (BytesRemain) >= 0) { while ((INT16) (BytesRemain) >= 0) {
Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++]; Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];
if (Sd->mOutBuf >= Sd->mOrigSize) { if (Sd->mOutBuf >= Sd->mOrigSize) {
return ; goto Done ;
} }
BytesRemain--; BytesRemain--;
@ -631,6 +649,8 @@ Returns: (VOID)
} }
} }
Done:
return ;
} }
EFI_STATUS EFI_STATUS
@ -714,6 +734,7 @@ Returns:
SCRATCH_DATA *Sd; SCRATCH_DATA *Sd;
UINT8 *Src; UINT8 *Src;
UINT8 *Dst; UINT8 *Dst;
volatile UINT32 Index;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
Src = Source; Src = Source;
@ -749,7 +770,9 @@ Returns:
Src = Src + 8; Src = Src + 8;
SetMem ((VOID*) Sd, sizeof(SCRATCH_DATA), 0); for (Index = 0; Index < sizeof (SCRATCH_DATA); Index++) {
((UINT8 *) Sd)[Index] = 0;
}
// //
// The length of the field 'Position Set Code Length Array Size' in Block Header. // The length of the field 'Position Set Code Length Array Size' in Block Header.