This commit is contained in:
Alex Matrosov 2018-04-29 22:38:54 -07:00
parent 956a804dd5
commit a5ce9ab3d9
16 changed files with 3575 additions and 3514 deletions

View File

@ -25,7 +25,7 @@ static ISzAlloc SzAllocForLzma = { &AllocForLzma, &FreeForLzma };
SRes OnProgress(void *p, UInt64 inSize, UInt64 outSize)
{
(void)p; (void) inSize; (void) outSize;
(void)p; (void)inSize; (void)outSize;
return SZ_OK;
}
@ -34,18 +34,18 @@ static ICompressProgress g_ProgressCallback = { &OnProgress };
STATIC
UINT64
EFIAPI
RShiftU64(
UINT64 Operand,
UINT32 Count
RShiftU64 (
UINT64 Operand,
UINT32 Count
)
{
return Operand >> Count;
}
VOID
SetEncodedSizeOfBuf(
UINT64 EncodedSize,
UINT8 *EncodedData
SetEncodedSizeOfBuf (
UINT64 EncodedSize,
UINT8 *EncodedData
)
{
INT32 Index;
@ -61,10 +61,10 @@ UINT8 *EncodedData
INT32
EFIAPI
LzmaCompress(
CONST UINT8 *Source,
UINT32 SourceSize,
UINT8 *Destination,
UINT32 *DestinationSize
CONST UINT8 *Source,
UINTN SourceSize,
UINT8 *Destination,
UINTN *DestinationSize
)
{
SRes LzmaResult;
@ -98,7 +98,7 @@ UINT32 *DestinationSize
*DestinationSize = destLen + LZMA_HEADER_SIZE;
SetEncodedSizeOfBuf((UINT64)SourceSize, Destination);
SetEncodedSizeOfBuf(SourceSize, Destination);
if (LzmaResult == SZ_OK) {
return ERR_SUCCESS;

View File

@ -28,9 +28,9 @@ extern "C" {
EFIAPI
LzmaCompress(
const UINT8 *Source,
UINT32 SourceSize,
UINTN SourceSize,
UINT8 *Destination,
UINT32 *DestinationSize
UINTN *DestinationSize
);
#ifdef __cplusplus

View File

@ -20,8 +20,8 @@ WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
UINT64
EFIAPI
LShiftU64(
UINT64 Operand,
UINT32 Count
UINT64 Operand,
UINT32 Count
)
{
return Operand << Count;
@ -40,7 +40,7 @@ Get the size of the uncompressed buffer by parsing EncodeData header.
*/
UINT64
GetDecodedSizeOfBuf(
UINT8 *EncodedData
UINT8 *EncodedData
)
{
UINT64 DecodedSize;
@ -88,18 +88,14 @@ buffer was returned ScratchSize.
INT32
EFIAPI
LzmaGetInfo(
CONST VOID *Source,
UINT32 SourceSize,
UINT32 *DestinationSize
CONST VOID *Source,
UINTN SourceSize,
UINTN *DestinationSize
)
{
UInt64 DecodedSize;
ASSERT(SourceSize >= LZMA_HEADER_SIZE); (void)SourceSize;
DecodedSize = GetDecodedSizeOfBuf((UINT8*)Source);
*DestinationSize = (UINT32)DecodedSize;
*DestinationSize = (UINTN)GetDecodedSizeOfBuf((UINT8*)Source);
return ERR_SUCCESS;
}
@ -125,9 +121,9 @@ The source buffer specified by Source is corrupted
INT32
EFIAPI
LzmaDecompress(
CONST VOID *Source,
UINT32 SourceSize,
VOID *Destination
CONST VOID *Source,
UINTN SourceSize,
VOID *Destination
)
{
SRes LzmaResult;

View File

@ -61,8 +61,8 @@ extern "C" {
EFIAPI
LzmaGetInfo(
const VOID *Source,
UINT32 SourceSize,
UINT32 *DestinationSize
UINTN SourceSize,
UINTN *DestinationSize
);
/*
@ -88,7 +88,7 @@ extern "C" {
EFIAPI
LzmaDecompress(
const VOID *Source,
UINT32 SourceSize,
UINTN SourceSize,
VOID *Destination
);

View File

@ -52,9 +52,9 @@ UINT8 gPBIT = 4;
#define NT (CODE_BIT + 3)
#define TBIT 5
#if NT > NP
#define NPT NT
#define NPT NT
#else
#define NPT NP
#define NPT NP
#endif
//
@ -65,174 +65,160 @@ STATIC
VOID
PutDword(
IN UINT32 Data
);
);
STATIC
EFI_STATUS
AllocateMemory (
);
AllocateMemory(VOID);
STATIC
VOID
FreeMemory (
);
FreeMemory(VOID);
STATIC
VOID
InitSlide (
);
InitSlide(VOID);
STATIC
NODE
Child (
Child(
IN NODE q,
IN UINT8 c
);
);
STATIC
VOID
MakeChild (
MakeChild(
IN NODE q,
IN UINT8 c,
IN NODE r
);
);
STATIC
VOID
Split (
Split(
IN NODE Old
);
);
STATIC
VOID
InsertNode (
);
InsertNode(VOID);
STATIC
VOID
DeleteNode (
);
DeleteNode(VOID);
STATIC
VOID
GetNextMatch (
);
GetNextMatch(VOID);
STATIC
EFI_STATUS
Encode (
);
Encode(VOID);
STATIC
VOID
CountTFreq (
);
CountTFreq(VOID);
STATIC
VOID
WritePTLen (
WritePTLen(
IN INT32 n,
IN INT32 nbit,
IN INT32 Special
);
);
STATIC
VOID
WriteCLen (
);
WriteCLen(VOID);
STATIC
VOID
EncodeC (
EncodeC(
IN INT32 c
);
);
STATIC
VOID
EncodeP (
EncodeP(
IN UINT32 p
);
);
STATIC
VOID
SendBlock (
);
SendBlock(VOID);
STATIC
VOID
Output (
Output(
IN UINT32 c,
IN UINT32 p
);
);
STATIC
VOID
HufEncodeStart (
);
HufEncodeStart(VOID);
STATIC
VOID
HufEncodeEnd (
);
HufEncodeEnd(VOID);
STATIC
VOID
MakeCrcTable (
);
MakeCrcTable(VOID);
STATIC
VOID
PutBits (
PutBits(
IN INT32 n,
IN UINT32 x
);
);
STATIC
INT32
FreadCrc (
FreadCrc(
OUT UINT8 *p,
IN INT32 n
);
);
STATIC
VOID
InitPutBits (
);
InitPutBits(VOID);
STATIC
VOID
CountLen (
CountLen(
IN INT32 i
);
);
STATIC
VOID
MakeLen (
MakeLen(
IN INT32 Root
);
);
STATIC
VOID
DownHeap (
DownHeap(
IN INT32 i
);
);
STATIC
VOID
MakeCode (
MakeCode(
IN INT32 n,
IN UINT8 Len[],
OUT UINT16 Code[]
);
);
STATIC
INT32
MakeTree (
MakeTree(
IN INT32 NParm,
IN UINT16 FreqParm[],
OUT UINT8 LenParm[],
OUT UINT16 CodeParm[]
);
);
//
@ -248,8 +234,8 @@ STATIC UINT32 mBufSiz = 0, mOutputPos, mOutputMask, mSubBitBuf, mCrc;
STATIC UINT32 mCompSize, mOrigSize;
STATIC UINT16 *mFreq, *mSortPtr, mLenCnt[17], mLeft[2 * NC - 1], mRight[2 * NC - 1],
mCrcTable[UINT8_MAX + 1], mCFreq[2 * NC - 1],mCCode[NC],
mPFreq[2 * NP - 1], mPTCode[NPT], mTFreq[2 * NT - 1];
mCrcTable[UINT8_MAX + 1], mCFreq[2 * NC - 1], mCCode[NC],
mPFreq[2 * NP - 1], mPTCode[NPT], mTFreq[2 * NT - 1];
STATIC NODE mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NULL;
@ -259,12 +245,12 @@ STATIC NODE mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NU
//
EFI_STATUS
EfiCompress (
EfiCompress(
IN CONST VOID *SrcBuffer,
IN UINT32 SrcSize,
IN VOID *DstBuffer,
IN OUT UINT32 *DstSize
)
)
/*++
Routine Description:
@ -311,7 +297,7 @@ Returns:
PutDword(0L);
PutDword(0L);
MakeCrcTable ();
MakeCrcTable();
mOrigSize = mCompSize = 0;
mCrc = INIT_CRC;
@ -321,7 +307,7 @@ Returns:
//
Status = Encode();
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return EFI_OUT_OF_RESOURCES;
}
@ -336,7 +322,7 @@ Returns:
// Fill in compressed size and original size
//
mDst = DstBuffer;
PutDword(mCompSize+1);
PutDword(mCompSize + 1);
PutDword(mOrigSize);
//
@ -346,7 +332,8 @@ Returns:
if (mCompSize + 1 + 8 > *DstSize) {
*DstSize = mCompSize + 1 + 8;
return EFI_BUFFER_TOO_SMALL;
} else {
}
else {
*DstSize = mCompSize + 1 + 8;
return EFI_SUCCESS;
}
@ -355,10 +342,10 @@ Returns:
EFI_STATUS
TianoCompress(
IN CONST VOID *SrcBuffer,
IN UINT32 SrcSize,
IN VOID *DstBuffer,
IN OUT UINT32 *DstSize
IN CONST VOID *SrcBuffer,
IN UINT32 SrcSize,
IN VOID *DstBuffer,
IN OUT UINT32 *DstSize
)
/*++
@ -453,7 +440,7 @@ STATIC
VOID
PutDword(
IN UINT32 Data
)
)
/*++
Routine Description:
@ -469,7 +456,7 @@ Returns: (VOID)
--*/
{
if (mDst < mDstUpperLimit) {
*mDst++ = (UINT8)(((UINT8)(Data )) & 0xff);
*mDst++ = (UINT8)(((UINT8)(Data)) & 0xff);
}
if (mDst < mDstUpperLimit) {
@ -487,7 +474,7 @@ Returns: (VOID)
STATIC
EFI_STATUS
AllocateMemory ()
AllocateMemory()
/*++
Routine Description:
@ -505,17 +492,20 @@ Returns:
{
UINT32 i;
mText = malloc (WNDSIZ * 2 + MAXMATCH);
for (i = 0 ; i < WNDSIZ * 2 + MAXMATCH; i ++) {
mText = malloc(WNDSIZ * 2 + MAXMATCH);
if (NULL == mText)
return EFI_OUT_OF_RESOURCES;
for (i = 0; i < WNDSIZ * 2 + MAXMATCH; i++) {
mText[i] = 0;
}
mLevel = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof(*mLevel));
mChildCount = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof(*mChildCount));
mPosition = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof(*mPosition));
mParent = malloc (WNDSIZ * 2 * sizeof(*mParent));
mPrev = malloc (WNDSIZ * 2 * sizeof(*mPrev));
mNext = malloc ((MAX_HASH_VAL + 1) * sizeof(*mNext));
mLevel = malloc((WNDSIZ + UINT8_MAX + 1) * sizeof(*mLevel));
mChildCount = malloc((WNDSIZ + UINT8_MAX + 1) * sizeof(*mChildCount));
mPosition = malloc((WNDSIZ + UINT8_MAX + 1) * sizeof(*mPosition));
mParent = malloc(WNDSIZ * 2 * sizeof(*mParent));
mPrev = malloc(WNDSIZ * 2 * sizeof(*mPrev));
mNext = malloc((MAX_HASH_VAL + 1) * sizeof(*mNext));
mBufSiz = 16 * 1024U;
while ((mBuf = malloc(mBufSiz)) == NULL) {
@ -530,7 +520,7 @@ Returns:
}
VOID
FreeMemory ()
FreeMemory()
/*++
Routine Description:
@ -544,35 +534,35 @@ Returns: (VOID)
--*/
{
if (mText) {
free (mText);
free(mText);
}
if (mLevel) {
free (mLevel);
free(mLevel);
}
if (mChildCount) {
free (mChildCount);
free(mChildCount);
}
if (mPosition) {
free (mPosition);
free(mPosition);
}
if (mParent) {
free (mParent);
free(mParent);
}
if (mPrev) {
free (mPrev);
free(mPrev);
}
if (mNext) {
free (mNext);
free(mNext);
}
if (mBuf) {
free (mBuf);
free(mBuf);
}
return;
@ -581,7 +571,7 @@ Returns: (VOID)
STATIC
VOID
InitSlide ()
InitSlide()
/*++
Routine Description:
@ -617,10 +607,10 @@ Returns: (VOID)
STATIC
NODE
Child (
Child(
IN NODE q,
IN UINT8 c
)
)
/*++
Routine Description:
@ -651,11 +641,11 @@ Returns:
STATIC
VOID
MakeChild (
MakeChild(
IN NODE q,
IN UINT8 c,
IN NODE r
)
)
/*++
Routine Description:
@ -687,8 +677,8 @@ Returns: (VOID)
STATIC
VOID
Split (
NODE Old
)
IN NODE Old
)
/*++
Routine Description:
@ -723,7 +713,7 @@ Returns: (VOID)
STATIC
VOID
InsertNode ()
InsertNode()
/*++
Routine Description:
@ -765,7 +755,8 @@ Returns: (VOID)
if (t < (NODE)WNDSIZ) {
mPosition[t] = (NODE)(mPos | PERC_FLAG);
}
} else {
}
else {
//
// Locate the target tree
@ -787,11 +778,12 @@ Returns: (VOID)
// Node split or creation is involved.
//
for ( ; ; ) {
for (; ; ) {
if (r >= (NODE)WNDSIZ) {
j = MAXMATCH;
mMatchPos = r;
} else {
}
else {
j = mLevel[r];
mMatchPos = (NODE)(mPosition[r] & ~PERC_FLAG);
}
@ -838,7 +830,7 @@ Returns: (VOID)
STATIC
VOID
DeleteNode ()
DeleteNode()
/*++
Routine Description:
@ -912,7 +904,7 @@ Returns: (VOID)
STATIC
VOID
GetNextMatch ()
GetNextMatch()
/*++
Routine Description:
@ -941,7 +933,7 @@ Returns: (VOID)
STATIC
EFI_STATUS
Encode ()
Encode()
/*++
Routine Description:
@ -995,7 +987,8 @@ Returns:
//
Output(mText[mPos - 1], 0);
} else {
}
else {
//
// Outputting a pointer is beneficial enough, do it.
@ -1019,7 +1012,7 @@ Returns:
STATIC
VOID
CountTFreq ()
CountTFreq()
/*++
Routine Description:
@ -1052,15 +1045,19 @@ Returns: (VOID)
}
if (Count <= 2) {
mTFreq[0] = (UINT16)(mTFreq[0] + Count);
} else if (Count <= 18) {
}
else if (Count <= 18) {
mTFreq[1]++;
} else if (Count == 19) {
}
else if (Count == 19) {
mTFreq[0]++;
mTFreq[1]++;
} else {
}
else {
mTFreq[2]++;
}
} else {
}
else {
mTFreq[k + 2]++;
}
}
@ -1068,11 +1065,11 @@ Returns: (VOID)
STATIC
VOID
WritePTLen (
WritePTLen(
IN INT32 n,
IN INT32 nbit,
IN INT32 Special
)
)
/*++
Routine Description:
@ -1100,7 +1097,8 @@ Returns: (VOID)
k = mPTLen[i++];
if (k <= 6) {
PutBits(3, k);
} else {
}
else {
PutBits(k - 3, (1U << (k - 3)) - 2);
}
if (i == Special) {
@ -1114,7 +1112,7 @@ Returns: (VOID)
STATIC
VOID
WriteCLen ()
WriteCLen()
/*++
Routine Description:
@ -1147,18 +1145,22 @@ Returns: (VOID)
for (k = 0; k < Count; k++) {
PutBits(mPTLen[0], mPTCode[0]);
}
} else if (Count <= 18) {
}
else if (Count <= 18) {
PutBits(mPTLen[1], mPTCode[1]);
PutBits(4, Count - 3);
} else if (Count == 19) {
}
else if (Count == 19) {
PutBits(mPTLen[0], mPTCode[0]);
PutBits(mPTLen[1], mPTCode[1]);
PutBits(4, 15);
} else {
}
else {
PutBits(mPTLen[2], mPTCode[2]);
PutBits(CBIT, Count - 20);
}
} else {
}
else {
PutBits(mPTLen[k + 2], mPTCode[k + 2]);
}
}
@ -1166,18 +1168,18 @@ Returns: (VOID)
STATIC
VOID
EncodeC (
EncodeC(
IN INT32 c
)
)
{
PutBits(mCLen[c], mCCode[c]);
}
STATIC
VOID
EncodeP (
EncodeP(
IN UINT32 p
)
)
{
UINT32 c, q;
@ -1195,7 +1197,7 @@ EncodeP (
STATIC
VOID
SendBlock ()
SendBlock()
/*++
Routine Description:
@ -1219,12 +1221,14 @@ Returns: (VOID)
Root = MakeTree(NT, mTFreq, mPTLen, mPTCode);
if (Root >= NT) {
WritePTLen(NT, TBIT, 3);
} else {
}
else {
PutBits(TBIT, 0);
PutBits(TBIT, Root);
}
WriteCLen();
} else {
}
else {
PutBits(TBIT, 0);
PutBits(TBIT, 0);
PutBits(CBIT, 0);
@ -1233,7 +1237,8 @@ Returns: (VOID)
Root = MakeTree(NP, mPFreq, mPTLen, mPTCode);
if (Root >= NP) {
WritePTLen(NP, gPBIT, -1);
} else {
}
else {
PutBits(gPBIT, 0);
PutBits(gPBIT, Root);
}
@ -1241,7 +1246,8 @@ Returns: (VOID)
for (i = 0; i < Size; i++) {
if (i % UINT8_BIT == 0) {
Flags = mBuf[Pos++];
} else {
}
else {
Flags <<= 1;
}
if (Flags & (1U << (UINT8_BIT - 1))) {
@ -1249,7 +1255,8 @@ Returns: (VOID)
k = mBuf[Pos++] << UINT8_BIT;
k += mBuf[Pos++];
EncodeP(k);
} else {
}
else {
EncodeC(mBuf[Pos++]);
}
}
@ -1264,10 +1271,10 @@ Returns: (VOID)
STATIC
VOID
Output (
Output(
IN UINT32 c,
IN UINT32 p
)
)
/*++
Routine Description:
@ -1294,12 +1301,12 @@ Returns: (VOID)
CPos = mOutputPos++;
mBuf[CPos] = 0;
}
mBuf[mOutputPos++] = (UINT8) c;
mBuf[mOutputPos++] = (UINT8)c;
mCFreq[c]++;
if (c >= (1U << UINT8_BIT)) {
mBuf[CPos] |= mOutputMask;
mBuf[mOutputPos++] = (UINT8)(p >> UINT8_BIT);
mBuf[mOutputPos++] = (UINT8) p;
mBuf[mOutputPos++] = (UINT8)p;
c = 0;
while (p) {
p >>= 1;
@ -1311,7 +1318,7 @@ Returns: (VOID)
STATIC
VOID
HufEncodeStart ()
HufEncodeStart()
{
INT32 i;
@ -1328,7 +1335,7 @@ HufEncodeStart ()
STATIC
VOID
HufEncodeEnd ()
HufEncodeEnd()
{
SendBlock();
@ -1343,7 +1350,7 @@ HufEncodeEnd ()
STATIC
VOID
MakeCrcTable ()
MakeCrcTable()
{
UINT32 i, j, r;
@ -1352,7 +1359,8 @@ MakeCrcTable ()
for (j = 0; j < UINT8_BIT; j++) {
if (r & 1) {
r = (r >> 1) ^ CRCPOLY;
} else {
}
else {
r >>= 1;
}
}
@ -1362,10 +1370,10 @@ MakeCrcTable ()
STATIC
VOID
PutBits (
PutBits(
IN INT32 n,
IN UINT32 x
)
)
/*++
Routine Description:
@ -1385,7 +1393,8 @@ Returns: (VOID)
if (n < mBitCount) {
mSubBitBuf |= x << (mBitCount -= n);
} else {
}
else {
Temp = (UINT8)(mSubBitBuf | (x >> (n -= mBitCount)));
if (mDst < mDstUpperLimit) {
@ -1395,7 +1404,8 @@ Returns: (VOID)
if (n < UINT8_BIT) {
mSubBitBuf = x << (mBitCount = UINT8_BIT - n);
} else {
}
else {
Temp = (UINT8)(x >> (n - UINT8_BIT));
if (mDst < mDstUpperLimit) {
@ -1410,10 +1420,10 @@ Returns: (VOID)
STATIC
INT32
FreadCrc (
FreadCrc(
OUT UINT8 *p,
IN INT32 n
)
)
/*++
Routine Description:
@ -1449,7 +1459,7 @@ Returns:
STATIC
VOID
InitPutBits ()
InitPutBits()
{
mBitCount = UINT8_BIT;
mSubBitBuf = 0;
@ -1457,9 +1467,9 @@ InitPutBits ()
STATIC
VOID
CountLen (
CountLen(
IN INT32 i
)
)
/*++
Routine Description:
@ -1478,9 +1488,10 @@ Returns: (VOID)
if (i < mN) {
mLenCnt[(Depth < 16) ? Depth : 16]++;
} else {
}
else {
Depth++;
CountLen(mLeft [i]);
CountLen(mLeft[i]);
CountLen(mRight[i]);
Depth--;
}
@ -1488,9 +1499,9 @@ Returns: (VOID)
STATIC
VOID
MakeLen (
MakeLen(
IN INT32 Root
)
)
/*++
Routine Description:
@ -1525,7 +1536,7 @@ Arguments:
for (i = 15; i > 0; i--) {
if (mLenCnt[i] != 0) {
mLenCnt[i]--;
mLenCnt[i+1] += 2;
mLenCnt[i + 1] += 2;
break;
}
}
@ -1541,9 +1552,9 @@ Arguments:
STATIC
VOID
DownHeap (
DownHeap(
IN INT32 i
)
)
{
INT32 j, k;
@ -1567,11 +1578,11 @@ DownHeap (
STATIC
VOID
MakeCode (
MakeCode(
IN INT32 n,
IN UINT8 Len[],
OUT UINT16 Code[]
)
)
/*++
Routine Description:
@ -1602,12 +1613,12 @@ Returns: (VOID)
STATIC
INT32
MakeTree (
MakeTree(
IN INT32 NParm,
IN UINT16 FreqParm[],
OUT UINT8 LenParm[],
OUT UINT16 CodeParm[]
)
)
/*++
Routine Description:

View File

@ -57,12 +57,11 @@ extern "C" {
--*/
EFI_STATUS
TianoCompress(
CONST VOID *SrcBuffer,
UINT32 SrcSize,
VOID *DstBuffer,
UINT32 *DstSize
)
;
IN CONST VOID *SrcBuffer,
IN UINT32 SrcSize,
IN VOID *DstBuffer,
IN OUT UINT32 *DstSize
);
EFI_STATUS
TianoCompressLegacy(
@ -70,8 +69,7 @@ extern "C" {
UINT32 SrcSize,
VOID *DstBuffer,
UINT32 *DstSize
)
;
);
/*++
Routine Description:
@ -97,20 +95,19 @@ extern "C" {
--*/
EFI_STATUS
EfiCompress(
CONST VOID *SrcBuffer,
UINT32 SrcSize,
VOID *DstBuffer,
UINT32 *DstSize
)
;
IN CONST VOID *SrcBuffer,
IN UINT32 SrcSize,
IN VOID *DstBuffer,
IN OUT UINT32 *DstSize
);
EFI_STATUS
EfiCompressLegacy(
CONST VOID *SrcBuffer,
UINT32 SrcSize,
VOID *DstBuffer,
UINT32 *DstSize
)
;
);
#ifdef __cplusplus
}

File diff suppressed because it is too large Load Diff

View File

@ -82,8 +82,8 @@ typedef struct {
STATIC
VOID
FillBuf(
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfBits
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfBits
)
/*++
@ -130,8 +130,8 @@ Returns: (VOID)
STATIC
UINT32
GetBits(
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfBits
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfBits
)
/*++
@ -164,11 +164,11 @@ The bits that are popped out.
STATIC
UINT16
MakeTable(
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfChar,
IN UINT8 *BitLen,
IN UINT16 TableBits,
OUT UINT16 *Table
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfChar,
IN UINT8 *BitLen,
IN UINT16 TableBits,
OUT UINT16 *Table
)
/*++
@ -324,7 +324,7 @@ BAD_TABLE - The table is corrupted.
STATIC
UINT32
DecodeP(
IN SCRATCH_DATA *Sd
IN SCRATCH_DATA *Sd
)
/*++
@ -378,10 +378,10 @@ The position value decoded.
STATIC
UINT16
ReadPTLen(
IN SCRATCH_DATA *Sd,
IN UINT16 nn,
IN UINT16 nbit,
IN UINT16 Special
IN SCRATCH_DATA *Sd,
IN UINT16 nn,
IN UINT16 nbit,
IN UINT16 Special
)
/*++
@ -472,7 +472,7 @@ BAD_TABLE - Table is corrupted.
STATIC
VOID
ReadCLen(
SCRATCH_DATA *Sd
SCRATCH_DATA *Sd
)
/*++
@ -563,7 +563,7 @@ Returns: (VOID)
STATIC
UINT16
DecodeC(
SCRATCH_DATA *Sd
SCRATCH_DATA *Sd
)
/*++
@ -630,7 +630,7 @@ The value decoded.
STATIC
VOID
Decode(
SCRATCH_DATA *Sd
SCRATCH_DATA *Sd
)
/*++
@ -702,10 +702,10 @@ Returns: (VOID)
EFI_STATUS
GetInfo(
IN const VOID *Source,
IN UINT32 SrcSize,
OUT UINT32 *DstSize,
OUT UINT32 *ScratchSize
IN const VOID *Source,
IN UINT32 SrcSize,
OUT UINT32 *DstSize,
OUT UINT32 *ScratchSize
)
/*++
@ -742,13 +742,13 @@ EFI_INVALID_PARAMETER - The source data is corrupted
EFI_STATUS
Decompress(
IN const VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize,
IN UINT8 Version
IN const VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize,
IN UINT8 Version
)
/*++
@ -869,10 +869,10 @@ EFI_INVALID_PARAMETER - The source data is corrupted
EFI_STATUS
EFIAPI
EfiTianoGetInfo(
IN const VOID *Source,
IN UINT32 SrcSize,
OUT UINT32 *DstSize,
OUT UINT32 *ScratchSize
IN const VOID *Source,
IN UINT32 SrcSize,
OUT UINT32 *DstSize,
OUT UINT32 *ScratchSize
)
/*++
@ -906,12 +906,12 @@ EFI_INVALID_PARAMETER - The source data is corrupted
EFI_STATUS
EFIAPI
EfiDecompress(
IN const VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
IN const VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
)
/*++
@ -953,12 +953,12 @@ EFI_INVALID_PARAMETER - The source data is corrupted
EFI_STATUS
EFIAPI
TianoDecompress(
IN const VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
IN const VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
)
/*++

View File

@ -38,12 +38,11 @@ extern "C" {
} EFI_TIANO_HEADER;
EFI_STATUS
EFIAPI
EfiTianoGetInfo(
const VOID *Source,
UINT32 SrcSize,
UINT32 *DstSize,
UINT32 *ScratchSize
IN const VOID *Source,
IN UINT32 SrcSize,
OUT UINT32 *DstSize,
OUT UINT32 *ScratchSize
)
/*++
@ -70,12 +69,12 @@ extern "C" {
EFI_STATUS
EFIAPI
EfiDecompress(
const VOID *Source,
UINT32 SrcSize,
VOID *Destination,
UINT32 DstSize,
VOID *Scratch,
UINT32 ScratchSize
IN const VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
)
/*++
@ -104,12 +103,12 @@ extern "C" {
EFI_STATUS
EFIAPI
TianoDecompress(
const VOID *Source,
UINT32 SrcSize,
VOID *Destination,
UINT32 DstSize,
VOID *Scratch,
UINT32 ScratchSize
IN const VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
)
/*++

View File

@ -52,8 +52,9 @@ F7731B4C-58A2-4DF4-8980-5645D39ECE58 10 P:0FBA6C24380F:0FBA7424380F
299D6F8B-2EC9-4E40-9EC6-DDAA7EBF5FD9 10 P:81E10080000033C1:9090909090909090
299D6F8B-2EC9-4E40-9EC6-DDAA7EBF5FD9 12 P:81E10080000033C1:9090909090909090
# PpmInitialize | Skylake-X
3FFCAE95-23CF-4967-94F5-16352F68E43B 10 P:742CB9E2000000:752CB9E2000000
# SiInit | Skylake-X
D71C8BA4-4AF2-4D0D-B1BA-F2409F0C20D3 10 P:81E10080000033C1:9090909090909090
D71C8BA4-4AF2-4D0D-B1BA-F2409F0C20D3 12 P:81E10080000033C1:9090909090909090
# CpuInitPei | Skylake-X
01359D99-9446-456D-ADA4-50A711C03ADA 12 P:BE0080000023CE0B:BE0000000023CE0B
# PpmInitialize | Skylake-X, Kaby Lake-X
3FFCAE95-23CF-4967-94F5-16352F68E43B 10 P:0FBAE80F:0FBAE00F

View File

@ -95,6 +95,7 @@ public:
UINT8 replace(const QModelIndex & index, const QByteArray & object, const UINT8 mode);
UINT8 remove(const QModelIndex & index);
UINT8 rebuild(const QModelIndex & index);
UINT8 doNotRebuild(const QModelIndex & index);
UINT8 dump(const QModelIndex & index, const QString & path, const QString & filter = QString());
UINT8 patch(const QModelIndex & index, const QVector<PatchData> & patches);

View File

@ -150,6 +150,8 @@ QString actionTypeToQString(const UINT8 action)
return QObject::tr("Rebuild");
case Actions::Rebase:
return QObject::tr("Rebase");
case Actions::DoNotRebuild:
return QObject::tr("Do not rebuild");
default:
return QObject::tr("Unknown");
}

View File

@ -26,7 +26,8 @@ namespace Actions
Replace,
Remove,
Rebuild,
Rebase
Rebase,
DoNotRebuild
};
}

View File

@ -17,7 +17,7 @@
UEFITool::UEFITool(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::UEFITool),
version(tr("0.22.4"))
version(tr("0.23.0"))
{
clipboard = QApplication::clipboard();
@ -43,6 +43,7 @@ version(tr("0.22.4"))
connect(ui->actionReplaceBody, SIGNAL(triggered()), this, SLOT(replaceBody()));
connect(ui->actionRemove, SIGNAL(triggered()), this, SLOT(remove()));
connect(ui->actionRebuild, SIGNAL(triggered()), this, SLOT(rebuild()));
connect(ui->actionDoNotRebuild, SIGNAL(triggered()), this, SLOT(doNotRebuild()));
connect(ui->actionMessagesCopy, SIGNAL(triggered()), this, SLOT(copyMessage()));
connect(ui->actionMessagesCopyAll, SIGNAL(triggered()), this, SLOT(copyAllMessages()));
connect(ui->actionMessagesClear, SIGNAL(triggered()), this, SLOT(clearMessages()));
@ -146,6 +147,7 @@ void UEFITool::populateUi(const QModelIndex &current)
// Enable actions
ui->actionExtract->setDisabled(model->hasEmptyHeader(current) && model->hasEmptyBody(current));
ui->actionRebuild->setEnabled(type == Types::Volume || type == Types::File || type == Types::Section);
ui->actionDoNotRebuild->setEnabled(type== Types::Region || type == Types::Volume || type == Types::File || type == Types::Section);
ui->actionExtractBody->setDisabled(model->hasEmptyBody(current));
ui->actionRemove->setEnabled(type == Types::Volume || type == Types::File || type == Types::Section);
ui->actionInsertInto->setEnabled((type == Types::Volume && subtype != Subtypes::UnknownVolume) ||
@ -220,6 +222,18 @@ void UEFITool::rebuild()
ui->actionSaveImageFile->setEnabled(true);
}
void UEFITool::doNotRebuild()
{
QModelIndex index = ui->structureTreeView->selectionModel()->currentIndex();
if (!index.isValid())
return;
UINT8 result = ffsEngine->doNotRebuild(index);
if (result == ERR_SUCCESS)
ui->actionSaveImageFile->setEnabled(true);
}
void UEFITool::remove()
{
QModelIndex index = ui->structureTreeView->selectionModel()->currentIndex();

View File

@ -78,6 +78,7 @@ public:
void replaceBody();
void rebuild();
void doNotRebuild();
void remove();

View File

@ -180,7 +180,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
<height>31</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -225,6 +225,8 @@
</property>
<addaction name="actionExtract"/>
<addaction name="separator"/>
<addaction name="actionDoNotRebuild"/>
<addaction name="separator"/>
<addaction name="actionReplace"/>
</widget>
<widget class="QMenu" name="menuPaddingActions">
@ -243,6 +245,7 @@
<addaction name="actionExtractBody"/>
<addaction name="separator"/>
<addaction name="actionRebuild"/>
<addaction name="actionDoNotRebuild"/>
<addaction name="separator"/>
<addaction name="actionInsertInto"/>
<addaction name="separator"/>
@ -257,6 +260,7 @@
<addaction name="actionExtractBody"/>
<addaction name="separator"/>
<addaction name="actionRebuild"/>
<addaction name="actionDoNotRebuild"/>
<addaction name="separator"/>
<addaction name="actionInsertInto"/>
<addaction name="actionInsertBefore"/>
@ -275,6 +279,7 @@
<addaction name="actionExtractBody"/>
<addaction name="separator"/>
<addaction name="actionRebuild"/>
<addaction name="actionDoNotRebuild"/>
<addaction name="separator"/>
<addaction name="actionInsertInto"/>
<addaction name="actionInsertBefore"/>
@ -284,7 +289,6 @@
<addaction name="actionReplaceBody"/>
<addaction name="separator"/>
<addaction name="actionRemove"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="menuMessages">
<property name="title">
@ -536,6 +540,17 @@
<string>Ctrl+Shift+O</string>
</property>
</action>
<action name="actionDoNotRebuild">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Do not rebuild</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+Space</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>