lkml.org 
[lkml]   [2015]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 2/9] arm: do not place huge encoder tables on stack when it is too small
    Date
    Since stack on Cortex-M3 is too small, we need configuration option
    to avoid using it for huge encoder tables of zlib.

    Signed-off-by: Paul Osmialowski <pawelo@king.net.pl>
    ---
    arch/arm/Kconfig-nommu | 4 ++++
    lib/zlib_inflate/inflate.c | 5 +++++
    2 files changed, 9 insertions(+)

    diff --git a/arch/arm/Kconfig-nommu b/arch/arm/Kconfig-nommu
    index aed66d5..965ca97 100644
    --- a/arch/arm/Kconfig-nommu
    +++ b/arch/arm/Kconfig-nommu
    @@ -62,3 +62,7 @@ config ARM_MPU

    If your CPU has an MPU then you should choose 'y' here unless you
    know that you do not want to use the MPU.
    +
    +config ZLIB_INFLATE_STACK_SAVING
    + bool 'Do not place huge encoder tables on stack' if ZLIB_INFLATE
    + depends on ZLIB_INFLATE
    diff --git a/lib/zlib_inflate/inflate.c b/lib/zlib_inflate/inflate.c
    index 58a733b..917b7cf 100644
    --- a/lib/zlib_inflate/inflate.c
    +++ b/lib/zlib_inflate/inflate.c
    @@ -75,9 +75,14 @@ int zlib_inflateInit2(z_streamp strm, int windowBits)
    Return state with length and distance decoding tables and index sizes set to
    fixed code decoding. This returns fixed tables from inffixed.h.
    */
    +#ifdef CONFIG_ZLIB_INFLATE_STACK_SAVING
    +# include "inffixed.h"
    +#endif
    static void zlib_fixedtables(struct inflate_state *state)
    {
    +#ifndef CONFIG_ZLIB_INFLATE_STACK_SAVING
    # include "inffixed.h"
    +#endif
    state->lencode = lenfix;
    state->lenbits = 9;
    state->distcode = distfix;
    --
    2.3.6


    \
     
     \ /
      Last update: 2015-06-24 00:21    [W:4.204 / U:0.152 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site