wok-6.x diff memtest/stuff/unlz4.S @ rev 25493
Add libgnt
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Nov 19 17:37:48 2022 +0000 (19 months ago) |
parents | 2ccf00d9c1cd |
children | 7f7bd3c9775e |
line diff
1.1 --- a/memtest/stuff/unlz4.S Fri Nov 18 09:54:27 2022 +0000 1.2 +++ b/memtest/stuff/unlz4.S Sat Nov 19 17:37:48 2022 +0000 1.3 @@ -43,16 +43,15 @@ 1.4 lodsb // get token 1.5 movb %al, %bl 1.6 shrb $4, %al 1.7 - call lz4len // get literal length, %eax < 255 1.8 + call lz4len // get literal length 1.9 subl %ecx, %edx // count literal 1.10 - subl $1+2, %edx // count token & string address 1.11 -#if !defined(FLAT32) && !defined(FLAT16OUT) 1.12 - pushf 1.13 +#if !defined(FLAT32) && !defined(FLAT16OUT) && (!defined(FLAT16) || !defined(PARANOIA)) 1.14 +#define NeedLz4mov 1.15 call lz4mov // copy literals 1.16 - popf 1.17 #else 1.18 rep movsb 1.19 #endif 1.20 + subl $1+2, %edx // count token & string address 1.21 jle lz4main 1.22 lodsw // get string address 1.23 xchgw %ax, %bx 1.24 @@ -67,8 +66,25 @@ 1.25 jnc axok 1.26 subb $0x10, %ah 1.27 axok: 1.28 +.macro norm reg 1.29 + movw %si, \reg 1.30 + andw $0xF, %si 1.31 + shrw $4, \reg 1.32 + addw \reg, %ax 1.33 movw %ax, %ds 1.34 - call lz4mov // copy string 1.35 + movw %di, \reg 1.36 + andw $0xF, %di 1.37 + shrw $4, \reg 1.38 + movw %es, %ax 1.39 + addw \reg, %ax 1.40 + movw %ax, %es 1.41 +.endm 1.42 +# if !defined (NeedLz4mov) 1.43 + norm %bp 1.44 + rep movsb 1.45 +# else 1.46 + call lz4movStr // copy string 1.47 +# endif 1.48 popw %si 1.49 popw %ds 1.50 #else 1.51 @@ -80,7 +96,7 @@ 1.52 #endif 1.53 jmp lz4chunk 1.54 1.55 -#if !defined(FLAT32) && !defined(FLAT16OUT) 1.56 +#if defined(NeedLz4mov) 1.57 # if defined(PARANOIA) 1.58 lz4movlp: 1.59 xchgw %ax, %cx 1.60 @@ -90,18 +106,9 @@ 1.61 sub $0xF0, %ch 1.62 # endif 1.63 lz4mov: 1.64 - movw %di, %ax 1.65 - andw $0xF, %di 1.66 - shrw $4, %ax 1.67 - movw %es, %bp 1.68 - addw %ax, %bp 1.69 - movw %bp, %es 1.70 - movw %si, %ax 1.71 - andw $0xF, %si 1.72 - shrw $4, %ax 1.73 - movw %ds, %bp 1.74 - addw %ax, %bp 1.75 - movw %bp, %ds 1.76 + movw %ds, %ax 1.77 +lz4movStr: 1.78 + norm %bp 1.79 # if defined(PARANOIA) 1.80 cmp $0xFF, %ch // catch FFFX case 1.81 jz lz4movlp 1.82 @@ -123,4 +130,3 @@ 1.83 je lz4len2 1.84 lz4quit: 1.85 ret 1.86 -