wok-tiny diff linux/stuff/unlzma.S @ rev 174

Up linux 2.6.20 (avoid 386 & 486 problems)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jul 14 14:20:00 2021 +0000 (2021-07-14)
parents eb617e43dc08
children d5c772484b59
line diff
     1.1 --- a/linux/stuff/unlzma.S	Wed Jul 14 09:04:04 2021 +0000
     1.2 +++ b/linux/stuff/unlzma.S	Wed Jul 14 14:20:00 2021 +0000
     1.3 @@ -97,11 +97,11 @@
     1.4  #ifndef FLAT32
     1.5   *   input   ds:si=inStream, es:di=outStream
     1.6   *   output  outStream[], ds:si, es:di
     1.7 - 	.code 16
     1.8 + 	.code16
     1.9  #else
    1.10   *   input   esi=inStream, edi=outStream
    1.11   *   output  outStream[], esi, edi
    1.12 - 	.code 32
    1.13 + 	.code32
    1.14  #endif
    1.15   */
    1.16   
    1.17 @@ -252,7 +252,13 @@
    1.18  	
    1.19  //         int matchByte = outStream[nowPos - rep0];
    1.20  
    1.21 +#if defined(FLAT32) || defined(FLAT16OUT)
    1.22 +	mov	nowPos(BP), BX
    1.23 +	sub	rep0(BP), BX
    1.24 +	movb	(BX), %bl
    1.25 +#else
    1.26  	call	DicoRep02ESDI	// %bl = outStream[nowPos - rep0];
    1.27 +#endif
    1.28  	
    1.29  //         do {
    1.30  //           int bit;
    1.31 @@ -668,12 +674,26 @@
    1.32  lzd13z:
    1.33  //         previousByte = outStream[nowPos - rep0];
    1.34  //         outStream[nowPos++] = previousByte;
    1.35 -
    1.36 -	call	outcharDico 	// %bl = outStream[nowPos++] = outStream[nowPos - rep0]
    1.37 -
    1.38  //       } while(--len != 0);
    1.39  
    1.40 +#if defined(FLAT32) || defined(FLAT16OUT)
    1.41 +	push	SI
    1.42 +	mov	nowPos(BP), SI
    1.43 +	sub	rep0(BP), SI
    1.44 +lzd13zflat:
    1.45 +# ifdef FLAT32
    1.46 +	lodsb	%ds:(SI)
    1.47 +# else
    1.48 +	lodsb	%es:(SI)
    1.49 +# endif
    1.50 +	call	outchar
    1.51 +	loop	lzd13zflat
    1.52 +	pop	SI
    1.53 +#else
    1.54 +	call	outcharDico 	// %bl = outStream[nowPos++] = outStream[nowPos - rep0]
    1.55  	loop	lzd13z
    1.56 +#endif
    1.57 +
    1.58  
    1.59  //     } /* char/string */
    1.60  //   }
    1.61 @@ -684,13 +704,18 @@
    1.62  //   //RC_NORMALIZE;
    1.63  //   //*inSizeProcessed = (SizeT)(Buffer - inStream); *outSizeProcessed = nowPos;
    1.64  //   return LZMA_RESULT_OK;
    1.65 +#if !defined(FLAT32) && !defined(FLAT16OUT)
    1.66  	call	Dico2ESDI	// set es & di (rep0 = 0)
    1.67 +#else
    1.68 +	movw	nowPos(BP), DI
    1.69 +#endif
    1.70  	lea	ws2(BP), SP	// dealloc
    1.71  	ret	
    1.72  // }
    1.73  
    1.74  // al = outStream[nowPos - rep0];
    1.75  
    1.76 +#if !defined(FLAT32) && !defined(FLAT16OUT)
    1.77  /*
    1.78   * output  es:di, al
    1.79   * scratch bh, cl, flags
    1.80 @@ -707,7 +732,6 @@
    1.81   */
    1.82   
    1.83  Dico2ESDI:
    1.84 -#if !defined(FLAT32) && !defined(FLAT16OUT)
    1.85  # ifdef ONLY8086
    1.86  	pushw	%ax
    1.87  	movw	nowPos(%bp), %bx
    1.88 @@ -735,17 +759,6 @@
    1.89  	shrl	$4, %ebx
    1.90  # endif
    1.91  	movw	%bx, %es
    1.92 -#else
    1.93 -	mov	nowPos(BP), DI
    1.94 -	jnc	Dico2ESDIz
    1.95 -	sub	rep0(BP), DI
    1.96 -Dico2ESDIz:
    1.97 -#endif
    1.98 -#ifdef FLAT32
    1.99 -	movb	(DI), %bl
   1.100 -#else
   1.101 -	movb	%es:(%di), %bl
   1.102 -#endif
   1.103  	ret
   1.104  
   1.105  outcharDico:
   1.106 @@ -773,6 +786,12 @@
   1.107  	clc
   1.108  	call	Dico2ESDI
   1.109  	stosb
   1.110 +#else
   1.111 +outchar:
   1.112 +	movw	nowPos(%bp), DI
   1.113 +	stosb
   1.114 +	movw	DI, nowPos(%bp)
   1.115 +#endif
   1.116  	xchg	AX, BX		// previous byte
   1.117  
   1.118  //	int posState = (int)((nowPos) & posStateMask);
   1.119 @@ -790,13 +809,13 @@
   1.120  	andb	$((1 << PROP_LP) -1), posState2(BP)
   1.121  # endif
   1.122  #endif
   1.123 -#ifdef ONLY8086
   1.124 -	incw	nowPos(BP)
   1.125 +#if !defined(FLAT32) && !defined(FLAT16OUT)
   1.126 +	inc	nowPos(BP)
   1.127 +# if defined(ONLY8086)
   1.128  	jnz	incnowPosDone
   1.129  	incw	nowPos+2(BP)
   1.130  incnowPosDone:
   1.131 -#else
   1.132 -	incl	nowPos(BP)
   1.133 +# endif
   1.134  #endif
   1.135  	ret
   1.136