public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: rhabarber1848 <rhabarber1848@web.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] add WATCHDOG_RESET to allow LZMA kernel decompression on slow machines
Date: Wed, 22 Jul 2009 12:28:49 +0200	[thread overview]
Message-ID: <h46pl1$hbd$1@ger.gmane.org> (raw)
In-Reply-To: 20090722075345.1CE0F832E416@gemini.denx.de


Signed-off-by: rhabarber1848 <rhabarber1848@web.de>

---
 lib_generic/lzma/LzmaDec.c   |   26 ++++++++++++++++++++++++++
 lib_generic/lzma/LzmaTools.c |    4 ++++
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/lib_generic/lzma/LzmaDec.c b/lib_generic/lzma/LzmaDec.c
index 89d934a..acffb14 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 <config.h>
+#include <common.h>
+#include <watchdog.h>
 #include "LzmaDec.h"
 
 #include <string.h>
@@ -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 c2a91e5..88ba399 100644
--- a/lib_generic/lzma/LzmaTools.c
+++ b/lib_generic/lzma/LzmaTools.c
@@ -36,6 +36,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <watchdog.h>
 
 #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,
-- 
1.5.6.5

  reply	other threads:[~2009-07-22 10:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21  8:45 [U-Boot] Refresh LZMA-lib to v4.65 (v3 resend) Luigi 'Comio' Mantellini
2009-07-21  8:45 ` [U-Boot] [PATCH] Refresh LZMA-lib to v4.65 Luigi 'Comio' Mantellini
2009-07-22  7:53   ` Wolfgang Denk
2009-07-22 10:28     ` rhabarber1848 [this message]
2009-07-23 19:56       ` [U-Boot] [PATCH] add WATCHDOG_RESET to allow LZMA kernel decompression on slow machines Wolfgang Denk
2009-07-24  6:16         ` [U-Boot] [PATCH v2] " rhabarber1848 at web.de
2009-07-26 22:16           ` Wolfgang Denk
2009-07-26 22:36           ` Mike Frysinger
2009-07-22 11:34     ` [U-Boot] [PATCH] Refresh LZMA-lib to v4.65 Luigi 'Comio' Mantellini
2009-07-27 17:40   ` Mike Frysinger
2009-07-27 18:17     ` Luigi Mantellini
2009-07-27 18:27       ` Mike Frysinger
2009-07-27 18:48         ` Luigi Mantellini
2009-07-27 18:58           ` Mike Frysinger
2009-07-27 19:12             ` Luigi Mantellini
2009-07-27 19:33               ` Mike Frysinger
2009-07-27 19:45                 ` Luigi Mantellini
2009-07-27 20:02                 ` Luigi Mantellini
2009-07-27 20:49                   ` Wolfgang Denk
2009-07-27 21:04                     ` Luigi Mantellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='h46pl1$hbd$1@ger.gmane.org' \
    --to=rhabarber1848@web.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox