wok view syslinux/stuff/iso2exe/lzcom.S @ rev 20632

linld: 32 bits lseeks for tazboot
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jan 05 17:23:23 2019 +0100 (2019-01-05)
parents 7d300004a3b8
children
line source
1 .text
2 .code16
4 ORGCOM = 0x100
5 STKSZ = 0x4000 // unlzma needs 16Kb
7 #undef USE_CX_LOADER // CX should be set by loader
8 #undef SETUP_SS // extends max code size from 47k to 63k
10 #ifdef SETUP_SS
11 STKROOM = 256
12 #else
13 STKROOM = STKSZ
14 #endif
16 CODESZ = (0x10000-STKROOM)/2 // max < 16 sectors = 32Kb
17 .org 0
19 .globl _start
20 _start:
21 movw $ORGCOM, %ax
22 pushw %ax
23 movw $packedcode+ORGCOM-1, %si
24 #ifdef USE_CX_LOADER
25 pushw %cx
26 #endif
27 movw $-STKROOM-1, %di
28 movw $packedcode-unpack-1, %cx
29 std
30 // * max ~47k | 17k
31 // oouuuuppppppppppppppppppppp-------------------S---16k----
32 rep
33 movsb // decompressor
34 // oo----ppppppppppppppppppppp---------------uuuuS---16k----
35 #ifdef USE_CX_LOADER
36 popw %cx
37 pushw %di
38 movsb
39 movw $packedcode+ORGCOM-1, %si
40 addw %cx, %si
41 #else
42 pushw %di
43 movsb
44 #if (CODESZ % 256) == 0
45 movb $CODESZ/256, %ch
46 #else
47 movw $CODESZ, %cx // the loader should update CX ...
48 #endif
49 movw $packedcode+ORGCOM+CODESZ-1, %si
50 // unsigned char *code; // But we can patch later:
51 // size -= * (unsigned short *) (code + 19);
52 // * (unsigned short *) (code + 19) += size;
53 // * (unsigned short *) (code + 22) += size;
54 #endif
55 rep
56 movsb // packed code
57 // oo--------------------ppppppppppppppppppppuuuuS---16k----
58 // *
59 cld
60 incw %di
61 xchgw %ax, %di
62 xchgw %ax, %si
63 ret
64 // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx------uuuuS---16k----
65 // * max ~47k | 17k
67 unpack:
68 #ifdef SETUP_SS
69 movw %ss, %bx
70 leaw STKSZ/16(%bx), %ax
71 movw %ax, %ss
72 pushw %bx
73 call dounpack
74 popw %ss
75 ret
76 dounpack:
77 #endif
78 #define FLAT16
79 #include "unlzma.S"
81 packedcode: