wok diff memtest/stuff/unzx0.S @ rev 25613
Add grub-btrfs
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Aug 02 09:46:03 2023 +0000 (23 months ago) |
parents | f1ad7cb7989b |
children | a794ec0a6495 |
line diff
1.1 --- a/memtest/stuff/unzx0.S Tue Aug 01 19:11:36 2023 +0000 1.2 +++ b/memtest/stuff/unzx0.S Wed Aug 02 09:46:03 2023 +0000 1.3 @@ -47,6 +47,15 @@ 1.4 sbb BX, BX // initialize rep-offset to 1 1.5 1.6 .literals: 1.7 +#if !defined(FLAT16) && !defined(FLAT32) 1.8 + cmpw $32768, %si // assume 32767 literals max 1.9 + jb .si_ok 1.10 + subw $32768, %si 1.11 + movw %ds, %dx 1.12 + addb $8, %dh 1.13 + movw %dx, %ds 1.14 +.si_ok: 1.15 +#endif 1.16 call .get_elias // read number of literals to copy 1.17 rep movsb // copy literal bytes 1.18 1.19 @@ -55,45 +64,22 @@ 1.20 1.21 call .get_elias // read rep-match length (starts at 1) 1.22 1.23 -.macro norm ds,si,reg,reg2 1.24 - movw \si, \reg 1.25 - andw $0xF, \si 1.26 -# ifdef ONLY8086 1.27 - shrw $1, \reg 1.28 - shrw $1, \reg 1.29 - shrw $1, \reg 1.30 - shrw $1, \reg 1.31 -# else 1.32 - shrw $4, \reg 1.33 -# endif 1.34 - addw \reg, \reg2 1.35 - movw \reg2, \ds 1.36 -.endm 1.37 - 1.38 +#if !defined(FLAT16OUT) && !defined(FLAT32) 1.39 + jmp .copy_match 1.40 +.fix_di: 1.41 + subw $256, %di 1.42 + movw %es, %dx 1.43 + addw $16, %dx 1.44 + movw %dx, %es 1.45 .copy_match: 1.46 -#if !defined(FLAT16) && !defined(FLAT32) 1.47 - movw %ds, %dx 1.48 - norm %ds, %si, %bp, %dx 1.49 -#endif 1.50 -#if !defined(FLAT16OUT) && !defined(FLAT32) 1.51 - movw %es, %dx 1.52 - norm %es, %di, %bp, %dx 1.53 + cmpw $-32640, %di // assume 32639 max window 1.54 + ja .fix_di 1.55 +#else 1.56 +.copy_match: 1.57 #endif 1.58 push SI // save si (current pointer to compressed data) 1.59 lea (BX,DI), SI // point to destination in es:di + offset in bx 1.60 -#if !defined(FLAT16OUT) && !defined(FLAT32) 1.61 - pushw %ds 1.62 - movw %es, %dx 1.63 - cmpw %si, %di 1.64 - ja .sameseg 1.65 - subb $0x10, %dh 1.66 -.sameseg: 1.67 - norm %ds, %si, %bp, %dx 1.68 - rep movsb // copy matched bytes 1.69 - popw %ds 1.70 -#else 1.71 rep movsb %es:(SI), %es:(DI) // copy matched bytes 1.72 -#endif 1.73 pop SI // restore si 1.74 1.75 addb %al, %al // read 'literal or match' bit