From: rhabarber1848@web.de Date: Fri, 24 Jul 2009 06:16:30 +0000 (+0200) Subject: add WATCHDOG_RESET to allow LZMA kernel decompression on slow machines X-Git-Tag: v2009.08-rc1~7 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fafbb2c3e4b35b60ca303ed2ad1c6cf400cd9a22;p=oweals%2Fu-boot.git add WATCHDOG_RESET to allow LZMA kernel decompression on slow machines Signed-off-by: rhabarber1848@web.de --- diff --git a/lib_generic/lzma/LzmaDec.c b/lib_generic/lzma/LzmaDec.c index 89d934ad09..acffb14aae 100644 --- a/lib_generic/lzma/LzmaDec.c +++ b/lib_generic/lzma/LzmaDec.c @@ -1,6 +1,9 @@ /* LzmaDec.c -- LZMA Decoder 2008-11-06 : Igor Pavlov : Public domain */ +#include +#include +#include #include "LzmaDec.h" #include @@ -156,6 +159,8 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte UInt32 range = p->range; UInt32 code = p->code; + WATCHDOG_RESET(); + do { CLzmaProb *prob; @@ -176,6 +181,9 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte if (state < kNumLitStates) { symbol = 1; + + WATCHDOG_RESET(); + do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100); } else @@ -183,6 +191,9 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; unsigned offs = 0x100; symbol = 1; + + WATCHDOG_RESET(); + do { unsigned bit; @@ -316,6 +327,9 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte { UInt32 mask = 1; unsigned i = 1; + + WATCHDOG_RESET(); + do { GET_BIT2(prob + i, i, ; , distance |= mask); @@ -327,6 +341,9 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte else { numDirectBits -= kNumAlignBits; + + WATCHDOG_RESET(); + do { NORMALIZE @@ -399,12 +416,18 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos; const Byte *lim = dest + curLen; dicPos += curLen; + + WATCHDOG_RESET(); + do *(dest) = (Byte)*(dest + src); while (++dest != lim); } else { + + WATCHDOG_RESET(); + do { dic[dicPos++] = dic[pos]; @@ -417,6 +440,9 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte } } while (dicPos < limit && buf < bufLimit); + + WATCHDOG_RESET(); + NORMALIZE; p->buf = buf; p->range = range; diff --git a/lib_generic/lzma/LzmaTools.c b/lib_generic/lzma/LzmaTools.c index c2a91e528d..88ba399c7c 100644 --- a/lib_generic/lzma/LzmaTools.c +++ b/lib_generic/lzma/LzmaTools.c @@ -36,6 +36,7 @@ #include #include +#include #ifdef CONFIG_LZMA @@ -112,6 +113,9 @@ int lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT *uncompressedSize, /* Decompress */ outProcessed = outSizeFull; + + WATCHDOG_RESET(); + res = LzmaDecode( outStream, &outProcessed, inStream + LZMA_DATA_OFFSET, &compressedSize,