Changeset 9991


Ignore:
Timestamp:
07/26/08 00:40:42 (5 years ago)
Author:
BrainSlayer
Message:

port for tonze boards and some lzma decoder enhancements

Location:
src/linux/sl2312/linux-2.6.23
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/linux/sl2312/linux-2.6.23/Makefile

    r9980 r9991  
    182182 
    183183ARCH            = $(SUBARCH) 
    184 CROSS_COMPILE   = armeb-linux-uclibc- 
     184CROSS_COMPILE   = arm-linux-uclibc- 
    185185 
    186186# Architecture as present in compile.h 
  • src/linux/sl2312/linux-2.6.23/arch/arm/Makefile

    r9980 r9991  
    1313LDFLAGS_vmlinux :=-p --no-undefined -X 
    1414CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) 
    15 OBJCOPYFLAGS    :=-O binary -R .note -R .comment -S 
     15OBJCOPYFLAGS    :=-O binary -R .note -R .note.gnu.build-id -R .comment -S 
     16#OBJCOPYFLAGS   :=-O binary -R .note -R .comment -S 
    1617GZFLAGS         :=-9 
    1718#CFLAGS         +=-pipe 
  • src/linux/sl2312/linux-2.6.23/arch/arm/boot/compressed/LzmaDecode.c

    r9980 r9991  
    11/* 
    2   LzmaDecodeSize.c 
    3   LZMA Decoder (optimized for Size version) 
     2  LzmaDecode.c 
     3  LZMA Decoder 
    44   
    5   LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) 
     5  LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25) 
    66  http://www.7-zip.org/ 
    77 
     
    2222#include "LzmaDecode.h" 
    2323 
     24#ifndef Byte 
     25#define Byte unsigned char 
     26#endif 
     27 
    2428#define kNumTopBits 24 
    2529#define kTopValue ((UInt32)1 << kNumTopBits) 
     
    3135typedef struct _CRangeDecoder 
    3236{ 
    33   const Byte *Buffer; 
    34   const Byte *BufferLim; 
     37  Byte *Buffer; 
     38  Byte *BufferLim; 
    3539  UInt32 Range; 
    3640  UInt32 Code; 
    3741  #ifdef _LZMA_IN_CB 
    38   ILzmaInCallback *InCallback; 
    3942  int Result; 
    4043  #endif 
     
    4750  { 
    4851    #ifdef _LZMA_IN_CB 
    49     SizeT size; 
    50     rd->Result = rd->InCallback->Read(rd->InCallback, &rd->Buffer, &size); 
     52    UInt32 size; 
     53    rd->Result = read_byte(&rd->Buffer, &size); 
    5154    rd->BufferLim = rd->Buffer + size; 
    5255    if (size == 0) 
     
    6366#define ReadByte (RangeDecoderReadByte(rd)) 
    6467 
    65 void RangeDecoderInit(CRangeDecoder *rd 
    66   #ifndef _LZMA_IN_CB 
    67     , const Byte *stream, SizeT bufferSize 
    68   #endif 
    69     ) 
     68void RangeDecoderInit(CRangeDecoder *rd) 
    7069{ 
    7170  int i; 
     
    9291  UInt32 result = 0; 
    9392  int i; 
    94   for (i = numTotalBits; i != 0; i--) 
     93  for (i = numTotalBits; i > 0; i--) 
    9594  { 
    9695    /* UInt32 t; */ 
     
    160159  RC_INIT_VAR 
    161160  #endif 
    162   for(i = numLevels; i != 0; i--) 
     161  for(i = numLevels; i > 0; i--) 
    163162  { 
    164163    #ifdef _LZMA_LOC_OPT 
     
    235234    #ifdef _LZMA_LOC_OPT 
    236235    { 
    237       CProb *prob = probs + 0x100 + (matchBit << 8) + symbol; 
     236      CProb *prob = probs + ((1 + matchBit) << 8) + symbol; 
    238237      RC_GET_BIT2(prob, symbol, bit = 0, bit = 1) 
    239238    } 
    240239    #else 
    241     bit = RangeDecoderBitDecode(probs + 0x100 + (matchBit << 8) + symbol, rd); 
     240    bit = RangeDecoderBitDecode(probs + ((1 + matchBit) << 8) + symbol, rd); 
    242241    symbol = (symbol << 1) | bit; 
    243242    #endif 
     
    293292 
    294293#define kNumStates 12 
    295 #define kNumLitStates 7 
    296294 
    297295#define kStartPosModelIndex 4 
     
    324322#endif 
    325323 
    326 int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size) 
    327 { 
    328   unsigned char prop0; 
    329   if (size < LZMA_PROPERTIES_SIZE) 
    330     return LZMA_RESULT_DATA_ERROR; 
    331   prop0 = propsData[0]; 
    332   if (prop0 >= (9 * 5 * 5)) 
    333     return LZMA_RESULT_DATA_ERROR; 
    334   { 
    335     for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5)); 
    336     for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9); 
    337     propsRes->lc = prop0; 
    338     /* 
    339     unsigned char remainder = (unsigned char)(prop0 / 9); 
    340     propsRes->lc = prop0 % 9; 
    341     propsRes->pb = remainder / 5; 
    342     propsRes->lp = remainder % 5; 
    343     */ 
    344   } 
    345  
    346   #ifdef _LZMA_OUT_READ 
    347   { 
    348     int i; 
    349     propsRes->DictionarySize = 0; 
    350     for (i = 0; i < 4; i++) 
    351       propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8); 
    352     if (propsRes->DictionarySize == 0) 
    353       propsRes->DictionarySize = 1; 
    354   } 
    355   #endif 
     324#ifdef _LZMA_OUT_READ 
     325 
     326typedef struct _LzmaVarState 
     327{ 
     328  CRangeDecoder RangeDecoder; 
     329  Byte *Dictionary; 
     330  UInt32 DictionarySize; 
     331  UInt32 DictionaryPos; 
     332  UInt32 GlobalPos; 
     333  UInt32 Reps[4]; 
     334  int lc; 
     335  int lp; 
     336  int pb; 
     337  int State; 
     338  int PreviousIsMatch; 
     339  int RemainLen; 
     340} LzmaVarState; 
     341 
     342int LzmaDecoderInit( 
     343    unsigned char *buffer, UInt32 bufferSize, 
     344    int lc, int lp, int pb, 
     345    unsigned char *dictionary, UInt32 dictionarySize, 
     346    ) 
     347{ 
     348  LzmaVarState *vs = (LzmaVarState *)buffer; 
     349  CProb *p = (CProb *)(buffer + sizeof(LzmaVarState)); 
     350  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp)); 
     351  UInt32 i; 
     352  if (bufferSize < numProbs * sizeof(CProb) + sizeof(LzmaVarState)) 
     353    return LZMA_RESULT_NOT_ENOUGH_MEM; 
     354  vs->Dictionary = dictionary; 
     355  vs->DictionarySize = dictionarySize; 
     356  vs->DictionaryPos = 0; 
     357  vs->GlobalPos = 0; 
     358  vs->Reps[0] = vs->Reps[1] = vs->Reps[2] = vs->Reps[3] = 1; 
     359  vs->lc = lc; 
     360  vs->lp = lp; 
     361  vs->pb = pb; 
     362  vs->State = 0; 
     363  vs->PreviousIsMatch = 0; 
     364  vs->RemainLen = 0; 
     365  dictionary[dictionarySize - 1] = 0; 
     366  for (i = 0; i < numProbs; i++) 
     367    p[i] = kBitModelTotal >> 1;  
     368  RangeDecoderInit(&vs->RangeDecoder,  
     369  ); 
    356370  return LZMA_RESULT_OK; 
    357371} 
    358372 
    359 #define kLzmaStreamWasFinishedId (-1) 
    360  
    361 int LzmaDecode(CLzmaDecoderState *vs, 
    362     #ifdef _LZMA_IN_CB 
    363     ILzmaInCallback *InCallback, 
    364     #else 
    365     const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, 
    366     #endif 
    367     unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed) 
    368 { 
    369   CProb *p = vs->Probs; 
    370   SizeT nowPos = 0; 
    371   Byte previousByte = 0; 
    372   UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1; 
    373   UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1; 
    374   int lc = vs->Properties.lc; 
    375   CRangeDecoder rd; 
    376  
    377   #ifdef _LZMA_OUT_READ 
    378    
     373int LzmaDecode(unsigned char *buffer,  
     374    unsigned char *outStream, UInt32 outSize, 
     375    UInt32 *outSizeProcessed) 
     376{ 
     377  LzmaVarState *vs = (LzmaVarState *)buffer; 
     378  CProb *p = (CProb *)(buffer + sizeof(LzmaVarState)); 
     379  CRangeDecoder rd = vs->RangeDecoder; 
    379380  int state = vs->State; 
     381  int previousIsMatch = vs->PreviousIsMatch; 
     382  Byte previousByte; 
    380383  UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3]; 
     384  UInt32 nowPos = 0; 
     385  UInt32 posStateMask = (1 << (vs->pb)) - 1; 
     386  UInt32 literalPosMask = (1 << (vs->lp)) - 1; 
     387  int lc = vs->lc; 
    381388  int len = vs->RemainLen; 
    382389  UInt32 globalPos = vs->GlobalPos; 
    383   UInt32 distanceLimit = vs->DistanceLimit; 
    384390 
    385391  Byte *dictionary = vs->Dictionary; 
    386   UInt32 dictionarySize = vs->Properties.DictionarySize; 
     392  UInt32 dictionarySize = vs->DictionarySize; 
    387393  UInt32 dictionaryPos = vs->DictionaryPos; 
    388394 
    389   Byte tempDictionary[4]; 
    390  
    391   rd.Range = vs->Range; 
    392   rd.Code = vs->Code; 
    393   #ifdef _LZMA_IN_CB 
    394   rd.InCallback = InCallback; 
    395   rd.Buffer = vs->Buffer; 
    396   rd.BufferLim = vs->BufferLim; 
    397   #else 
    398   rd.Buffer = inStream; 
    399   rd.BufferLim = inStream + inSize; 
    400   #endif 
    401  
    402   #ifndef _LZMA_IN_CB 
    403   *inSizeProcessed = 0; 
    404   #endif 
    405   *outSizeProcessed = 0; 
    406   if (len == kLzmaStreamWasFinishedId) 
     395  if (len == -1) 
     396  { 
     397    *outSizeProcessed = 0; 
    407398    return LZMA_RESULT_OK; 
    408  
    409   if (dictionarySize == 0) 
    410   { 
    411     dictionary = tempDictionary; 
    412     dictionarySize = 1; 
    413     tempDictionary[0] = vs->TempDictionary[0]; 
    414   } 
    415  
    416   if (len == kLzmaNeedInitId) 
    417   { 
    418     { 
    419       UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); 
    420       UInt32 i; 
    421       for (i = 0; i < numProbs; i++) 
    422         p[i] = kBitModelTotal >> 1;  
    423       rep0 = rep1 = rep2 = rep3 = 1; 
    424       state = 0; 
    425       globalPos = 0; 
    426       distanceLimit = 0; 
    427       dictionaryPos = 0; 
    428       dictionary[dictionarySize - 1] = 0; 
    429       RangeDecoderInit(&rd 
    430           #ifndef _LZMA_IN_CB 
    431           , inStream, inSize 
    432           #endif 
    433           ); 
    434       #ifdef _LZMA_IN_CB 
    435       if (rd.Result != LZMA_RESULT_OK) 
    436         return rd.Result; 
    437       #endif 
    438       if (rd.ExtraBytes != 0) 
    439         return LZMA_RESULT_DATA_ERROR; 
    440     } 
    441     len = 0; 
    442   } 
    443   while(len != 0 && nowPos < outSize) 
     399  } 
     400 
     401  while(len > 0 && nowPos < outSize) 
    444402  { 
    445403    UInt32 pos = dictionaryPos - rep0; 
     
    455413  else 
    456414    previousByte = dictionary[dictionaryPos - 1]; 
    457  
    458   #ifdef _LZMA_IN_CB 
    459   rd.Result = LZMA_RESULT_OK; 
    460   #endif 
    461   rd.ExtraBytes = 0; 
    462  
    463   #else /* if !_LZMA_OUT_READ */ 
    464  
     415#else 
     416 
     417int LzmaDecode( 
     418    Byte *buffer, UInt32 bufferSize, 
     419    int lc, int lp, int pb, 
     420    unsigned char *outStream, UInt32 outSize, 
     421    UInt32 *outSizeProcessed) 
     422{ 
     423  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp)); 
     424  CProb *p = (CProb *)buffer; 
     425  CRangeDecoder rd; 
     426  UInt32 i; 
    465427  int state = 0; 
     428  int previousIsMatch = 0; 
     429  Byte previousByte = 0; 
    466430  UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1; 
     431  UInt32 nowPos = 0; 
     432  UInt32 posStateMask = (1 << pb) - 1; 
     433  UInt32 literalPosMask = (1 << lp) - 1; 
    467434  int len = 0; 
    468  
    469   #ifndef _LZMA_IN_CB 
    470   *inSizeProcessed = 0; 
    471   #endif 
     435  if (bufferSize < numProbs * sizeof(CProb)) 
     436    return LZMA_RESULT_NOT_ENOUGH_MEM; 
     437  for (i = 0; i < numProbs; i++) 
     438    p[i] = kBitModelTotal >> 1;  
     439  RangeDecoderInit(&rd); 
     440#endif 
     441 
    472442  *outSizeProcessed = 0; 
    473  
    474   { 
    475     UInt32 i; 
    476     UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); 
    477     for (i = 0; i < numProbs; i++) 
    478       p[i] = kBitModelTotal >> 1; 
    479   } 
    480    
    481   #ifdef _LZMA_IN_CB 
    482   rd.InCallback = InCallback; 
    483   #endif 
    484   RangeDecoderInit(&rd 
    485       #ifndef _LZMA_IN_CB 
    486       , inStream, inSize 
    487       #endif 
    488       ); 
    489  
    490   #ifdef _LZMA_IN_CB 
    491   if (rd.Result != LZMA_RESULT_OK) 
    492     return rd.Result; 
    493   #endif 
    494   if (rd.ExtraBytes != 0) 
    495     return LZMA_RESULT_DATA_ERROR; 
    496  
    497   #endif /* _LZMA_OUT_READ */ 
    498  
    499  
    500443  while(nowPos < outSize) 
    501444  { 
     
    524467        & literalPosMask) << lc) + (previousByte >> (8 - lc)))); 
    525468 
    526       if (state >= kNumLitStates) 
     469      if (state < 4) state = 0; 
     470      else if (state < 10) state -= 3; 
     471      else state -= 6; 
     472      if (previousIsMatch) 
    527473      { 
    528474        Byte matchByte; 
     
    536482        #endif 
    537483        previousByte = LzmaLiteralDecodeMatch(probs, &rd, matchByte); 
     484        previousIsMatch = 0; 
    538485      } 
    539486      else 
     
    541488      outStream[nowPos++] = previousByte; 
    542489      #ifdef _LZMA_OUT_READ 
    543       if (distanceLimit < dictionarySize) 
    544         distanceLimit++; 
    545  
    546490      dictionary[dictionaryPos] = previousByte; 
    547491      if (++dictionaryPos == dictionarySize) 
    548492        dictionaryPos = 0; 
    549493      #endif 
    550       if (state < 4) state = 0; 
    551       else if (state < 10) state -= 3; 
    552       else state -= 6; 
    553494    } 
    554495    else              
    555496    { 
     497      previousIsMatch = 1; 
    556498      if (RangeDecoderBitDecode(p + IsRep + state, &rd) == 1) 
    557499      { 
     
    563505            UInt32 pos; 
    564506            #endif 
    565        
    566             #ifdef _LZMA_OUT_READ 
    567             if (distanceLimit == 0) 
    568             #else 
    569             if (nowPos == 0) 
    570             #endif 
     507            if ( 
     508               (nowPos  
     509                #ifdef _LZMA_OUT_READ 
     510                + globalPos 
     511                #endif 
     512               ) 
     513               == 0) 
    571514              return LZMA_RESULT_DATA_ERROR; 
    572  
    573515            state = state < 7 ? 9 : 11; 
    574516            #ifdef _LZMA_OUT_READ 
     
    584526            #endif 
    585527            outStream[nowPos++] = previousByte; 
    586  
    587             #ifdef _LZMA_OUT_READ 
    588             if (distanceLimit < dictionarySize) 
    589               distanceLimit++; 
    590             #endif 
    591528            continue; 
    592529          } 
     
    643580        else 
    644581          rep0 = posSlot; 
    645         if (++rep0 == (UInt32)(0)) 
    646         { 
    647           /* it's for stream version */ 
    648           len = kLzmaStreamWasFinishedId; 
    649           break; 
    650         } 
     582        rep0++; 
    651583      } 
    652  
     584      if (rep0 == (UInt32)(0)) 
     585      { 
     586        /* it's for stream version */ 
     587        len = -1; 
     588        break; 
     589      } 
     590      if (rep0 > nowPos  
     591        #ifdef _LZMA_OUT_READ 
     592        + globalPos 
     593        #endif 
     594        ) 
     595      { 
     596        return LZMA_RESULT_DATA_ERROR; 
     597      } 
    653598      len += kMatchMinLen; 
    654       #ifdef _LZMA_OUT_READ 
    655       if (rep0 > distanceLimit)  
    656       #else 
    657       if (rep0 > nowPos) 
    658       #endif 
    659         return LZMA_RESULT_DATA_ERROR; 
    660  
    661       #ifdef _LZMA_OUT_READ 
    662       if (dictionarySize - distanceLimit > (UInt32)len) 
    663         distanceLimit += len; 
    664       else 
    665         distanceLimit = dictionarySize; 
    666       #endif 
    667  
    668599      do 
    669600      { 
     
    679610        previousByte = outStream[nowPos - rep0]; 
    680611        #endif 
     612        outStream[nowPos++] = previousByte; 
    681613        len--; 
    682         outStream[nowPos++] = previousByte; 
    683614      } 
    684       while(len != 0 && nowPos < outSize); 
    685     } 
    686   } 
    687  
     615      while(len > 0 && nowPos < outSize); 
     616    } 
     617  } 
    688618 
    689619  #ifdef _LZMA_OUT_READ 
    690   vs->Range = rd.Range; 
    691   vs->Code = rd.Code; 
     620  vs->RangeDecoder = rd; 
    692621  vs->DictionaryPos = dictionaryPos; 
    693   vs->GlobalPos = globalPos + (UInt32)nowPos; 
    694   vs->DistanceLimit = distanceLimit; 
     622  vs->GlobalPos = globalPos + nowPos; 
    695623  vs->Reps[0] = rep0; 
    696624  vs->Reps[1] = rep1; 
     
    698626  vs->Reps[3] = rep3; 
    699627  vs->State = state; 
     628  vs->PreviousIsMatch = previousIsMatch; 
    700629  vs->RemainLen = len; 
    701   vs->TempDictionary[0] = tempDictionary[0]; 
    702   #endif 
    703  
    704   #ifdef _LZMA_IN_CB 
    705   vs->Buffer = rd.Buffer; 
    706   vs->BufferLim = rd.BufferLim; 
    707   #else 
    708   *inSizeProcessed = (SizeT)(rd.Buffer - inStream); 
    709   #endif 
     630  #endif 
     631 
    710632  *outSizeProcessed = nowPos; 
    711633  return LZMA_RESULT_OK; 
  • src/linux/sl2312/linux-2.6.23/arch/arm/boot/compressed/LzmaDecode.h

    r9980 r9991  
    33  LZMA Decoder interface 
    44 
    5   LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) 
     5  LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25) 
    66  http://www.7-zip.org/ 
    77 
     
    2323#define __LZMADECODE_H 
    2424 
    25 #include "LzmaTypes.h" 
    26  
    2725/* #define _LZMA_IN_CB */ 
    2826/* Use callback for input data */ 
     
    3836/* Enable local speed optimizations inside code */ 
    3937 
     38#ifndef UInt32 
     39#ifdef _LZMA_UINT32_IS_ULONG 
     40#define UInt32 unsigned long 
     41#else 
     42#define UInt32 unsigned int 
     43#endif 
     44#endif 
     45 
    4046#ifdef _LZMA_PROB32 
    4147#define CProb UInt32 
    4248#else 
    43 #define CProb UInt16 
     49#define CProb unsigned short 
    4450#endif 
    4551 
    4652#define LZMA_RESULT_OK 0 
    4753#define LZMA_RESULT_DATA_ERROR 1 
     54#define LZMA_RESULT_NOT_ENOUGH_MEM 2 
    4855 
    49 #ifdef _LZMA_IN_CB 
    50 typedef struct _ILzmaInCallback 
    51 { 
    52   int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize); 
    53 } ILzmaInCallback; 
    54 #endif 
    5556 
    5657#define LZMA_BASE_SIZE 1846 
    5758#define LZMA_LIT_SIZE 768 
    5859 
    59 #define LZMA_PROPERTIES_SIZE 5 
    60  
    61 typedef struct _CLzmaProperties 
    62 { 
    63   int lc; 
    64   int lp; 
    65   int pb; 
    66   #ifdef _LZMA_OUT_READ 
    67   UInt32 DictionarySize; 
    68   #endif 
    69 }CLzmaProperties; 
    70  
    71 int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size); 
    72  
    73 #define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp))) 
    74  
    75 #define kLzmaNeedInitId (-2) 
    76  
    77 typedef struct _CLzmaDecoderState 
    78 { 
    79   CLzmaProperties Properties; 
    80   CProb *Probs; 
    81  
    82   #ifdef _LZMA_IN_CB 
    83   const unsigned char *Buffer; 
    84   const unsigned char *BufferLim; 
    85   #endif 
    86  
    87   #ifdef _LZMA_OUT_READ 
    88   unsigned char *Dictionary; 
    89   UInt32 Range; 
    90   UInt32 Code; 
    91   UInt32 DictionaryPos; 
    92   UInt32 GlobalPos; 
    93   UInt32 DistanceLimit; 
    94   UInt32 Reps[4]; 
    95   int State; 
    96   int RemainLen; 
    97   unsigned char TempDictionary[4]; 
    98   #endif 
    99 } CLzmaDecoderState; 
     60/*  
     61bufferSize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)))* sizeof(CProb) 
     62bufferSize += 100 in case of _LZMA_OUT_READ 
     63by default CProb is unsigned short,  
     64but if specify _LZMA_PROB_32, CProb will be UInt32(unsigned int) 
     65*/ 
    10066 
    10167#ifdef _LZMA_OUT_READ 
    102 #define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; } 
     68int LzmaDecoderInit( 
     69    unsigned char *buffer, UInt32 bufferSize, 
     70    int lc, int lp, int pb, 
     71    unsigned char *dictionary, UInt32 dictionarySize, 
     72); 
    10373#endif 
    10474 
    105 int LzmaDecode(CLzmaDecoderState *vs, 
    106     #ifdef _LZMA_IN_CB 
    107     ILzmaInCallback *inCallback, 
    108     #else 
    109     const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, 
    110     #endif 
    111     unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed); 
     75int LzmaDecode( 
     76    unsigned char *buffer,  
     77  #ifndef _LZMA_OUT_READ 
     78    UInt32 bufferSize, 
     79    int lc, int lp, int pb, 
     80  #endif 
     81    unsigned char *outStream, UInt32 outSize, 
     82    UInt32 *outSizeProcessed); 
    11283 
    11384#endif 
  • src/linux/sl2312/linux-2.6.23/arch/arm/boot/compressed/Makefile

    r9980 r9991  
    7878targets       := vmlinux vmlinux.lds piggy.lzma piggy.o font.o font.c \ 
    7979                 head.o misc_lzma.o print.o $(OBJS) 
    80 EXTRA_CFLAGS  := -fpic -fno-builtin -Os 
     80EXTRA_CFLAGS  := -fpic -fno-builtin -O2 
    8181EXTRA_AFLAGS  := 
    8282 
  • src/linux/sl2312/linux-2.6.23/arch/arm/boot/compressed/misc_lzma.c

    r9980 r9991  
    149149 
    150150#define _LZMA_IN_CB 
     151 
    151152#include "LzmaDecode.h" 
     153static __inline__ int read_byte(unsigned char **buffer, UInt32 *bufferSize); 
    152154#include "LzmaDecode.c" 
    153  
    154 static int read_byte(void *object, const unsigned char **buffer, SizeT *bufferSize); 
    155155 
    156156 
     
    162162 
    163163        unsigned int i; 
    164         CLzmaDecoderState state; 
    165164        unsigned int uncompressedSize = 0; 
    166          
    167         ILzmaInCallback callback; 
    168         callback.Read = read_byte; 
     165        unsigned char *workspace; 
     166        unsigned int lc,lp,pb; 
    169167 
    170168        // lzma args 
    171169        i = get_byte(); 
    172         state.Properties.lc = i % 9, i = i / 9; 
    173         state.Properties.lp = i % 5, state.Properties.pb = i / 5; 
     170        lc = i % 9, i = i / 9; 
     171        lp = i % 5, pb = i / 5; 
    174172         
    175173        // skip dictionary size 
     
    181179                (get_byte() << 16) + 
    182180                (get_byte() << 24); 
    183              
     181        workspace = output_data + uncompressedSize; 
    184182        // skip high order bytes 
    185183        for (i = 0; i < 4; i++)  
    186184                get_byte(); 
    187         // point it beyond uncompresedSize 
    188         state.Probs = (CProb*) (output_data + uncompressedSize); 
    189185        // decompress kernel 
    190         if (LzmaDecode( &state, &callback, 
    191            (unsigned char*)output_data, uncompressedSize, &i) == LZMA_RESULT_OK) 
     186//      if (LzmaDecode(workspace, ~0, lc, lp, pb, 
     187//              (unsigned char*)LOADADDR, osize, &i) == LZMA_RESULT_OK) 
     188        if (LzmaDecode(workspace, ~0, lc,lp,pb,(unsigned char*)output_data, uncompressedSize, &i) == LZMA_RESULT_OK) 
    192189        { 
    193190                if ( i != uncompressedSize ) 
     
    203200 
    204201static unsigned int icnt = 0; 
    205 static int read_byte(void *object, const unsigned char **buffer, SizeT *bufferSize) 
     202static __inline__ int read_byte(unsigned char **buffer, UInt32 *bufferSize) 
    206203{ 
    207204        static unsigned char val; 
Note: See TracChangeset for help on using the changeset viewer.