wok-6.x rev 23992
linld: skip xmm_alloc
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Dec 12 10:41:29 2020 +0000 (2020-12-12) |
parents | a1fa13454a0c |
children | 34d90fb03f57 |
files | linld/stuff/src/!COMPILEX.BAT linld/stuff/src/COMMON.H linld/stuff/src/CRTL.ASM linld/stuff/src/HIMEM.CPP linld/stuff/src/ISOCRTL.ASM linld/stuff/src/LINLD.CPP linld/stuff/src/LOAD.CPP linld/stuff/src/TAZBOOT.CPP linld/stuff/src/XMM.ASM linld/stuff/src/_BEG.ASM linld/stuff/src/_END.ASM linld/stuff/src/pipehole.awk syslinux/stuff/iso2exe/bootiso.S syslinux/stuff/iso2exe/init syslinux/stuff/iso2exe/iso2exe.sh |
line diff
1.1 --- a/linld/stuff/src/!COMPILEX.BAT Sun Dec 06 10:04:52 2020 +0000 1.2 +++ b/linld/stuff/src/!COMPILEX.BAT Sat Dec 12 10:41:29 2020 +0000 1.3 @@ -1,6 +1,6 @@ 1.4 path ..\BC31;..;%PATH% 1.5 call !clean.bat 1.6 -bcc @bccopt.opt -S -mt -DMOVE_SETUP -DLARGE_IMAGES *.cpp > cpp.log 1.7 +bcc @bccopt.opt -S -mt -DEXTRA -DMOVE_SETUP -DLARGE_IMAGES *.cpp > cpp.log 1.8 ren TAZBOOT.ASM TAZBOOT.ASO 1.9 ren LOAD.ASM LOAD.ASO 1.10 ren HIMEM.ASM HIMEM.ASO
2.1 --- a/linld/stuff/src/COMMON.H Sun Dec 06 10:04:52 2020 +0000 2.2 +++ b/linld/stuff/src/COMMON.H Sat Dec 12 10:41:29 2020 +0000 2.3 @@ -55,7 +55,6 @@ 2.4 #define pm2initrd(p) (p+1) 2.5 2.6 extern u8 pm_low; 2.7 -extern u16 skip_alloc; 2.8 extern u32 base_himem; 2.9 extern u32 far *initrd_desc; 2.10 2.11 @@ -80,7 +79,10 @@ 2.12 extern u32 root_dev; 2.13 extern u32 vid_mode; 2.14 // External asm helpers 2.15 +#ifdef WITH_XMM_ALLOC 2.16 +extern u16 skip_alloc; 2.17 extern _fastcall void xmm_alloc(struct image_himem *m); 2.18 +#endif 2.19 extern u32 topmem; 2.20 extern "C" u32 memtop(); 2.21 extern "C" void enable_a20_or_die();
3.1 --- a/linld/stuff/src/CRTL.ASM Sun Dec 06 10:04:52 2020 +0000 3.2 +++ b/linld/stuff/src/CRTL.ASM Sat Dec 12 10:41:29 2020 +0000 3.3 @@ -22,9 +22,6 @@ 3.4 global overflow:byte 3.5 overflow db "/" 3.6 msg_malloc db "Out of memory",0 3.7 - ifdef EXTRA 3.8 -tazboot_cmd db "tazboot.cmd",0 3.9 - endif 3.10 3.11 ends _DATA 3.12 3.13 @@ -61,14 +58,18 @@ 3.14 global @strcatb$qpxzct1:near 3.15 proc @strcatb$qpxzct1 near 3.16 3.17 + ifdef EXTRA 3.18 mov cl,7Fh 3.19 db 0bah ; mov dx,imm opcode 3.20 global @strcpy$qpxzct1:near 3.21 @strcpy$qpxzct1: 3.22 xor cx,cx 3.23 + endif 3.24 push si 3.25 xchg ax,si ; b 3.26 + ifdef EXTRA 3.27 jcxz @@nocat 3.28 + endif 3.29 dec bx 3.30 @@catlp: 3.31 inc bx 3.32 @@ -88,8 +89,10 @@ 3.33 inc bx 3.34 or al,al 3.35 jne @@cpylp 3.36 + ifdef EXTRA 3.37 strfound: 3.38 xchg ax,dx 3.39 + endif 3.40 strend: 3.41 pop si 3.42 global @ret:near 3.43 @@ -190,12 +193,13 @@ 3.44 cwd ; action = open 3.45 stc 3.46 int 21h 3.47 - pop si bx 3.48 + pop si dx 3.49 jnc doret 3.50 + else 3.51 + mov dx,bx 3.52 endif 3.53 mov ax,3d00h ; read-only+compatibility 3.54 ;mov cl,0 ; attribute mask 3.55 - mov dx,bx 3.56 jmp dos 3.57 3.58 endp @open$qpxzc 3.59 @@ -234,15 +238,15 @@ 3.60 3.61 3.62 ;*************************************************************** 3.63 -;_fastcall int readrm(bx:struct himem *m, ax:int sz); 3.64 +;_fastcall int readrm(di:struct himem *m, ax:int sz); 3.65 ;_fastcall int read(ax:int fd, bx:void* data, dx:int sz); 3.66 ;_fastcall int write(ax:int fd, bx:const void* data, dx:int sz); 3.67 ;*************************************************************** 3.68 global @readrm$qp11image_himemi:near 3.69 @readrm$qp11image_himemi: 3.70 xchg ax,dx ; sz 3.71 - mov ax,[bx] ; fd 3.72 - mov bx,[bx-2] ; data 3.73 + mov ax,[di] ; fd 3.74 + mov bx,[di-2] ; data 3.75 global @read$qipvi:near 3.76 proc @read$qipvi near 3.77 3.78 @@ -647,14 +651,14 @@ 3.79 endif 3.80 3.81 ;*************************************************************** 3.82 -;_fastcall u32* malloc_bufv_or_die(bx:struct image_himem *m); 3.83 +;_fastcall u32* malloc_bufv_or_die(si:struct image_himem *m); 3.84 ;*************************************************************** 3.85 global @malloc_bufv_or_die$qp11image_himem:near 3.86 proc @malloc_bufv_or_die$qp11image_himem near 3.87 3.88 p386 3.89 push si 3.90 - mov si,bx 3.91 + mov bx,si 3.92 ifdef LARGE_IMAGES 3.93 movzx eax,[word ((image_himem si).size) + 2] 3.94 shr ax,4 ; pages index size = size >> 20 3.95 @@ -767,6 +771,13 @@ 3.96 ;*************************************************************** 3.97 ;_fastcall void memcpy_image(bx:struct image_himem *m); 3.98 ;*************************************************************** 3.99 + global memcpy_image_initrd:near 3.100 +memcpy_image_initrd: 3.101 + lea bx,[si+32] 3.102 + db 0A9h ; test ax,imm 3.103 + global memcpy_image_kernel:near 3.104 +memcpy_image_kernel: 3.105 + mov bx,si 3.106 global @memcpy_image$qp11image_himem:near 3.107 proc @memcpy_image$qp11image_himem near 3.108 3.109 @@ -826,15 +837,15 @@ 3.110 endp @memcpy_image$qp11image_himem 3.111 3.112 ;*************************************************************** 3.113 -;_fastcall void storepage(bx:u32 *dst); 3.114 +;_fastcall void storepage(di:u32 *dst); 3.115 ;*************************************************************** 3.116 global @storepage$qpul:near 3.117 proc @storepage$qpul near 3.118 3.119 ifndef NO386 3.120 - mov edx,[bx] 3.121 + mov edx,[di] 3.122 else 3.123 - les ax,[dword bx] 3.124 + les ax,[dword di] 3.125 mov dx,es 3.126 endif 3.127 mov cx,offset _xfer_buf 3.128 @@ -861,20 +872,20 @@ 3.129 ifdef LARGE_IMAGES 3.130 p386 3.131 ;*************************************************************** 3.132 -;_fastcall void reset_bufv(bx:u32 *p); 3.133 +;_fastcall void reset_bufv(di:u32 *p); 3.134 ;*************************************************************** 3.135 global @reset_bufv$qpul:near 3.136 proc @reset_bufv$qpul near 3.137 3.138 - mov [curdata],bx 3.139 - and [dword (data_himem bx).cacheidx],0 3.140 + mov [curdata],di 3.141 + and [dword (data_himem di).cacheidx],0 3.142 ret 3.143 3.144 endp @reset_bufv$qpul 3.145 3.146 ;*************************************************************** 3.147 -;u32* prev_bufv(); 3.148 -;u32* prev_bufv(); 3.149 +;u32* di=prev_bufv(); 3.150 +;u32* di=prev_bufv(); 3.151 ;*************************************************************** 3.152 global _prev_bufv:near 3.153 global _next_bufv:near 3.154 @@ -884,32 +895,29 @@ 3.155 db 73h ; jnc 3.156 _next_bufv: 3.157 clc 3.158 - push si 3.159 - mov si,0 3.160 + mov bx,0 3.161 org $-2 3.162 curdata dw ? 3.163 sbb ax,ax 3.164 cmc 3.165 - adc ax,[(data_himem si).cacheidx] ; -1/+1 3.166 + adc ax,[(data_himem bx).cacheidx] ; -1/+1 3.167 xor ecx,ecx 3.168 test ax,0fc00h 3.169 jz @@gotpage 3.170 push ax ; FFFF / 0400 3.171 sar ax,8 ; FFFC / 0004 3.172 and al,0fch 3.173 - add [(data_himem si).pageidx],ax 3.174 - mov bx,[(data_himem si).pageidx] 3.175 - lea bx,[(data_himem bx+si).page] 3.176 + add [(data_himem bx).pageidx],ax 3.177 + mov di,[(data_himem bx).pageidx] 3.178 + lea di,[(data_himem bx+di).page] 3.179 mov edx,ds 3.180 shl edx,4 3.181 - lea cx,[(data_himem si).cache] 3.182 + lea cx,[(data_himem bx).cache] 3.183 add edx,ecx 3.184 - mov eax,[bx] 3.185 + mov eax,[di] 3.186 or eax,eax 3.187 jnz @@pageok 3.188 pop ax 3.189 - xchg ax,bx 3.190 - pop si 3.191 ret 3.192 @@pageok: 3.193 mov cx,4096 3.194 @@ -918,15 +926,15 @@ 3.195 cbw 3.196 shr ax,6 ; 03FF / 0000 3.197 @@gotpage: 3.198 - mov [(data_himem si).cacheidx],ax 3.199 + mov [(data_himem bx).cacheidx],ax 3.200 shl ax,2 3.201 - xchg ax,bx 3.202 - lea ax,[(data_himem bx+si).cache] 3.203 - or bx,[(data_himem si).pageidx] ; !pageidx && !cacheidx 3.204 + xchg ax,di 3.205 + lea ax,[(data_himem bx+di).cache] 3.206 + or di,[(data_himem bx).pageidx] ; !pageidx && !cacheidx 3.207 jnz @@notfirst2 3.208 - xchg ax,si ; &first 3.209 + xchg ax,bx ; &first 3.210 @@notfirst2: 3.211 - pop si 3.212 + xchg ax,di 3.213 ret 3.214 3.215 endp _prev_bufv 3.216 @@ -1266,43 +1274,6 @@ 3.217 endp @strtol$qpxzc 3.218 3.219 3.220 - ifdef USE_ARGSTR 3.221 -;*************************************************************** 3.222 -;_fastcall void set_cmdline(bx:const char *filename); 3.223 -;*************************************************************** 3.224 - global @set_cmdline$qpxzc:near 3.225 - proc @set_cmdline$qpxzc near 3.226 - call openargs 3.227 - jc strtol_ret 3.228 - mov ch,15 ; cx<4096 3.229 - mov di,[_heap_top] 3.230 - extrn read_cmdline:near 3.231 - jmp near read_cmdline ; read_cmdline(ax,di,cx) 3.232 - 3.233 - endp @set_cmdline$qpxzc 3.234 - endif 3.235 - 3.236 - 3.237 - ifdef NO386 3.238 -;*************************************************************** 3.239 -;u16 topseg(); 3.240 -;*************************************************************** 3.241 - global _topseg:near 3.242 - proc _topseg near 3.243 - 3.244 - int 12h 3.245 - jnc @@max640k 3.246 - mov ax,640 ; 9000 3.247 -@@max640k: 3.248 - dec ax 3.249 - and al,0C0h 3.250 - mov cl,6 3.251 - shl ax,cl 3.252 - ret 3.253 - 3.254 - endp _topseg 3.255 - endif 3.256 - 3.257 ifdef EXTRA 3.258 p8086 3.259 ;*************************************************************** 3.260 @@ -1361,26 +1332,6 @@ 3.261 3.262 endif 3.263 3.264 -;*************************************************************** 3.265 -;void try_default_args(); 3.266 -;*************************************************************** 3.267 - ifdef EXTRA 3.268 - 3.269 - global _try_default_args:near 3.270 - proc _try_default_args near 3.271 - 3.272 - mov bx,offset tazboot_cmd 3.273 - call open 3.274 - jc kver2ulret 3.275 - mov cx,4096 3.276 - mov di,[_heap_top] 3.277 - extrn read_cmdline:near 3.278 - jmp near read_cmdline ; read_cmdline(ax,di,cx) 3.279 - 3.280 - endp _try_default_args 3.281 - 3.282 - endif 3.283 - 3.284 ends _TEXT 3.285 3.286 end
4.1 --- a/linld/stuff/src/HIMEM.CPP Sun Dec 06 10:04:52 2020 +0000 4.2 +++ b/linld/stuff/src/HIMEM.CPP Sat Dec 12 10:41:29 2020 +0000 4.3 @@ -6,20 +6,28 @@ 4.4 #include "crtl.h" 4.5 #include "common.h" 4.6 4.7 +#ifdef WITH_XMM_ALLOC 4.8 u16 skip_alloc; 4.9 +#endif 4.10 static u32 buf; 4.11 4.12 void load_image(struct image_himem *m) { 4.13 m->remaining = m->size; 4.14 m->buf = m->fallback; // set no_exit btw: die() won't return to DOS 4.15 u32* bufv= &buf; 4.16 +#ifdef WITH_XMM_ALLOC 4.17 if(((u16 *)&m->fallback)[1] >= (skip_alloc|0x10)) { // >= _1m ? 4.18 +#else 4.19 + if(((u16 *)&m->fallback)[1] >= 0x10) { // >= _1m ? 4.20 +#endif 4.21 if(vcpi) { 4.22 bufv = (u32 *)malloc_bufv_or_die(m); // update m->bufv 4.23 } 4.24 +#ifdef WITH_XMM_ALLOC 4.25 else { 4.26 xmm_alloc(m); // update m->buf 4.27 } 4.28 +#endif 4.29 } 4.30 buf = m->buf; 4.31 do {
5.1 --- a/linld/stuff/src/ISOCRTL.ASM Sun Dec 06 10:04:52 2020 +0000 5.2 +++ b/linld/stuff/src/ISOCRTL.ASM Sat Dec 12 10:41:29 2020 +0000 5.3 @@ -95,9 +95,12 @@ 5.4 ;*************************************************************** 5.5 iso_read_hack: 5.6 push dx 5.7 + xor dx,dx 5.8 + ifndef NO386 5.9 + push dx 5.10 + endif 5.11 push cx 5.12 xor cx,cx 5.13 - xor dx,dx 5.14 mov al,01h 5.15 call doseek ; bx = _isostate.fileofs 5.16 ifdef NO386 5.17 @@ -107,26 +110,18 @@ 5.18 sbb ax,dx 5.19 pop ax 5.20 ja @@axok 5.21 - je @@rem 5.22 - xor ax,ax 5.23 -@@rem: 5.24 - cmp cx,ax 5.25 - jb @@cxok 5.26 -@@axok: 5.27 + cmp ax,cx 5.28 else 5.29 push dx 5.30 push ax 5.31 - pop edx 5.32 - mov eax,[bx+4] ; _isostate.filesize 5.33 - sub eax,edx 5.34 - pop cx 5.35 - ja @@rem 5.36 - xor cx,cx 5.37 -@@rem: 5.38 - movzx ecx,cx 5.39 + pop ecx 5.40 + mov eax,[_isostate.filesize] 5.41 + sub eax,ecx 5.42 + pop ecx 5.43 cmp eax,ecx 5.44 + endif 5.45 ja @@cxok 5.46 - endif 5.47 +@@axok: 5.48 xchg ax,cx 5.49 @@cxok: 5.50 pop dx ; buffer
6.1 --- a/linld/stuff/src/LINLD.CPP Sun Dec 06 10:04:52 2020 +0000 6.2 +++ b/linld/stuff/src/LINLD.CPP Sat Dec 12 10:41:29 2020 +0000 6.3 @@ -24,7 +24,9 @@ 6.4 die("Syntax:" NL 6.5 "LINLD [image=file] [initrd=files] [vga=mode] [root=num] [mem=max] [cl=cmdline]" NL 6.6 "vga mode: ask,extended,normal or dec/oct/hex number" NL 6.7 +#ifdef WITH_XMM_ALLOC 6.8 "-f force" NL 6.9 +#endif 6.10 "-64 for cpu64 only" NL 6.11 "Defaults:" NL 6.12 "\timage=bzImage" NL 6.13 @@ -36,7 +38,11 @@ 6.14 "Use cl=@filename to get it from a file" 6.15 #if 1 6.16 NL NL "Examples:" NL 6.17 - "\tLINLD -f -b 64m " 6.18 + "\tLINLD " 6.19 +#ifdef WITH_XMM_ALLOC 6.20 + "-f " 6.21 +#endif 6.22 + "-b 64m " 6.23 "initrd=rootfs4.gz,rootfs3.gz,rootfs2.gz,rootfs1.gz " 6.24 "\"cl=root=/dev/null video=-32\"" 6.25 NL NL "\tLINLD image=memtest" 6.26 @@ -55,32 +61,34 @@ 6.27 // Parse command line 6.28 #ifdef USE_ARGSTR 6.29 if (!argv[1]) syntax(); 6.30 + const char **clp = &cmdline; 6.31 for (;;) { 6.32 - const char **clp = &cmdline; 6.33 argv++; 6.34 - if (!*argv) goto boot; 6.35 + if (!*argv) break; 6.36 if ((*(u16 *)*argv|2) == 0x362F) { // -64 /64 6.37 if (cpuhaslm() == 0) exit(); 6.38 + continue; 6.39 } 6.40 +#ifdef WITH_XMM_ALLOC 6.41 if ((*(u16 *)*argv|0x2002) == 0x662F) { // -F /f 6.42 skip_alloc--; 6.43 + continue; 6.44 } 6.45 - else if (argstr(*argv,"cl|image|initrd",clp) != -1); 6.46 - else if (fileexist(*argv) != -1) 6.47 +#endif 6.48 + if (argstr(*argv,"cl|image|initrd",clp) != -1 && **argv == 'c') continue; 6.49 + if (fileexist(*argv) != -1) { 6.50 kernel_name=*argv; 6.51 - else if (argnum(*argv,"root|vga|mem|-b",&root_dev) != -1); 6.52 - else { 6.53 - *clp = (const char *) buf_cmdline + 1; 6.54 - do strcatb((const char *) buf_cmdline,*argv++); while (*argv); 6.55 - boot: 6.56 - puts(*clp); 6.57 - set_cmdline(*clp); 6.58 - load_kernel(); 6.59 - puts(version_string); 6.60 - load_initrd(); 6.61 - boot_kernel(); 6.62 - } 6.63 + continue; 6.64 + } 6.65 + argnum(*argv,"root|vga|mem|-b",&root_dev); 6.66 + *clp = (const char *) buf_cmdline + 1; 6.67 + strcatb((const char *) buf_cmdline,*argv); 6.68 } 6.69 + puts(*clp); 6.70 + set_cmdline(*clp); 6.71 + load_kernel(); 6.72 + load_initrd(); 6.73 + boot_kernel(); 6.74 #else 6.75 if (!argv[1]) syntax(); 6.76 while (1) { 6.77 @@ -104,9 +112,11 @@ 6.78 case 0x362F: // -64 /64 6.79 if (cpuhaslm() == 0) exit(); 6.80 goto next; 6.81 +#ifdef WITH_XMM_ALLOC 6.82 case 0x662F: // -F /f 6.83 skip_alloc--; 6.84 goto next; 6.85 +#endif 6.86 case 0x622F: // -B /b 6.87 argv++; 6.88 ((u16 *)&base_himem)[1] = (u16)(strtol(*argv)>>16);
7.1 --- a/linld/stuff/src/LOAD.CPP Sun Dec 06 10:04:52 2020 +0000 7.2 +++ b/linld/stuff/src/LOAD.CPP Sat Dec 12 10:41:29 2020 +0000 7.3 @@ -178,7 +178,11 @@ 7.4 hook_int15_88(); // break _ES 7.5 } 7.6 if (kernelparams->kernel_version) 7.7 - strcpy(version_string,(char *) first1k+kernelparams->kernel_version+0x200); 7.8 +#ifndef EXTRA 7.9 + puts((char *) first1k+kernelparams->kernel_version+0x200); 7.10 +#else 7.11 + strcatb(version_string,(char *) first1k+kernelparams->kernel_version+0x200); 7.12 +#endif 7.13 kernelparams->type_of_loader = 0xff; // kernel do not know us (yet :-) 7.14 if(kernelparams->version >= 0x201) { 7.15 // * offset limit of the setup heap 7.16 @@ -224,14 +228,14 @@ 7.17 open_image(m, initrd_name); 7.18 7.19 if ((m->fallback=(memtop()-m->size)&(~PAGE_MASK))-m[-1].fallback < m[-1].size) { 7.20 + puts(m->errmsg); 7.21 close(m->fd); 7.22 - puts(m->errmsg); 7.23 return; 7.24 } 7.25 7.26 load_image(m); 7.27 7.28 - if (*version_string) { 7.29 + /* if (pm_low == 0) */ { 7.30 initrd_desc[0] = m->fallback; 7.31 initrd_desc[1] = m->size; 7.32 }
8.1 --- a/linld/stuff/src/TAZBOOT.CPP Sun Dec 06 10:04:52 2020 +0000 8.2 +++ b/linld/stuff/src/TAZBOOT.CPP Sat Dec 12 10:41:29 2020 +0000 8.3 @@ -73,7 +73,9 @@ 8.4 struct isostate *x=&isostate; 8.5 8.6 if (isoreset(*iso) == -1) return; 8.7 +#ifdef WITH_XMM_ALLOC 8.8 skip_alloc--; 8.9 +#endif 8.10 base_himem = memtop() /2; 8.11 //if (base_himem >= _64m) base_himem = _64m; 8.12 if (* ((char *) &base_himem +3) >= 4) ((short *)&base_himem)[1] = _64m/_64k; 8.13 @@ -149,8 +151,11 @@ 8.14 if (argc < 2) { 8.15 try_default_args(); 8.16 dousage: 8.17 - die("Usage: tazboot [[@commands]|[-f][-b base_himem][kernel=<bzImage>] \ 8.18 -[initrd=<rootfs>[,<rootfs2>...]] [bootfrom=<isofile>] ...]\n\n\ 8.19 + die("Usage: tazboot [[@commands]|" 8.20 +#ifdef WITH_XMM_ALLOC 8.21 +"[-f]" 8.22 +#endif 8.23 +"[-b base_himem][kernel=<bzImage>] [initrd=<rootfs>[,<rootfs2>...]] [bootfrom=<isofile>] ...]\n\n\ 8.24 Defaults: tazboot kernel=bzImage auto\n\n\ 8.25 Examples for tazboot.cmd:\n\n\ 8.26 bootfrom=\\isos\\slitaz-4.0.iso\n\ 8.27 @@ -193,10 +198,12 @@ 8.28 boot_kernel(); 8.29 } 8.30 #ifdef USE_ARGSTR 8.31 +#ifdef WITH_XMM_ALLOC 8.32 if ((*(u16 *)s|0x2002) == 0x662F) { // -F /f 8.33 skip_alloc--; 8.34 goto next; 8.35 } 8.36 +#endif 8.37 if (argstr(s,"kernel/image|initrd|bootfrom/iso",&kernel_name) != -1); 8.38 else if (argnum(s,"root|vga|mem/-e|-b",&root_dev) != -1); 8.39 else if(i == 1 && fileexist(s) != -1) { 8.40 @@ -232,9 +239,11 @@ 8.41 kernel_name = s; 8.42 } 8.43 else switch (*(u16 *)s|0x2002) { 8.44 +#ifdef WITH_XMM_ALLOC 8.45 case 0x662F: // -F /f 8.46 skip_alloc--; 8.47 goto next; 8.48 +#endif 8.49 case 0x652F: // -E /e 8.50 s=*++argv; 8.51 goto set_topmem;
9.1 --- a/linld/stuff/src/XMM.ASM Sun Dec 06 10:04:52 2020 +0000 9.2 +++ b/linld/stuff/src/XMM.ASM Sat Dec 12 10:41:29 2020 +0000 9.3 @@ -89,16 +89,17 @@ 9.4 9.5 endp xmm_driver 9.6 9.7 + ifdef WITH_XMM_ALLOC 9.8 include "himem.inc" 9.9 9.10 ;*************************************************************** 9.11 -;_fastcall void xmm_alloc(struct image_himem *m) 9.12 +;_fastcall void xmm_alloc(si:struct image_himem *m) 9.13 ;*************************************************************** 9.14 global @xmm_alloc$qp11image_himem:near 9.15 proc @xmm_alloc$qp11image_himem near 9.16 9.17 ifndef NO386 9.18 - mov edx,[(image_himem bx).size] ; m->size 9.19 + mov edx,[(image_himem si).size] ; m->size 9.20 ;dec edx 9.21 shr edx,10 ; to Kb 9.22 inc edx 9.23 @@ -106,16 +107,15 @@ 9.24 else 9.25 ;mov ax,-1 9.26 ;cwd 9.27 - ;add ax,[word (image_himem bx).size] ; lo m->size 9.28 - ;adc dx,[word (image_himem bx+2).size] ; hi m->size 9.29 - les ax,[dword (image_himem bx).size] ; m->size 9.30 + ;add ax,[word (image_himem si).size] ; lo m->size 9.31 + ;adc dx,[word (image_himem si+2).size] ; hi m->size 9.32 + les ax,[dword (image_himem si).size] ; m->size 9.33 mov cl,16-10 9.34 extrn N_LXLSH@ES:near 9.35 call N_LXLSH@ES 9.36 inc dx 9.37 mov ah,9h ;allocate blk of DX kilobytes (<64Mb) 9.38 endif 9.39 - push bx 9.40 call xmm_driver ; 9.41 jnz @@goerr 9.42 ;now: dx=handle of the blk 9.43 @@ -124,7 +124,6 @@ 9.44 ;now: dx:bx=addr of blk 9.45 xchg ax,bx 9.46 @@goerr: 9.47 - pop bx 9.48 jnz @@err 9.49 mov [word (image_himem bx).buf],ax ; lo m->buf 9.50 mov [word (image_himem bx+2).buf],dx ; hi m->buf 9.51 @@ -132,6 +131,7 @@ 9.52 ret 9.53 9.54 endp @xmm_alloc$qp11image_himem 9.55 + endif 9.56 9.57 ends _TEXT 9.58
10.1 --- a/linld/stuff/src/_BEG.ASM Sun Dec 06 10:04:52 2020 +0000 10.2 +++ b/linld/stuff/src/_BEG.ASM Sat Dec 12 10:41:29 2020 +0000 10.3 @@ -24,6 +24,9 @@ 10.4 global _vcpi:byte 10.5 _vcpi db 0 10.6 endif 10.7 + ifdef EXTRA 10.8 +tazboot_cmd db "tazboot.cmd",0 10.9 + endif 10.10 10.11 ends _DATA 10.12 10.13 @@ -283,7 +286,6 @@ 10.14 call near openargs 10.15 jc argend 10.16 pop bx ; trash argc, argv >> 1Kb ! 10.17 - global read_cmdline:near 10.18 pop cx ; sizemax=argv 10.19 read_cmdline: 10.20 mov dx,di 10.21 @@ -308,6 +310,64 @@ 10.22 10.23 ;*************************************************************** 10.24 10.25 + 10.26 + extrn _head_top:word 10.27 + ifdef USE_ARGSTR 10.28 +;*************************************************************** 10.29 +;_fastcall void set_cmdline(bx:const char *filename); 10.30 +;*************************************************************** 10.31 + global @set_cmdline$qpxzc:near 10.32 + proc @set_cmdline$qpxzc near 10.33 + extrn openargs:near 10.34 + call openargs 10.35 + jc @ret 10.36 + mov ch,15 ; cx<4096 10.37 + mov di,[_heap_top] 10.38 + jmp read_cmdline ; read_cmdline(ax,di,cx) 10.39 + 10.40 + endp @set_cmdline$qpxzc 10.41 + endif 10.42 + 10.43 +;*************************************************************** 10.44 +;void try_default_args(); 10.45 +;*************************************************************** 10.46 + 10.47 + ifdef EXTRA 10.48 + global _try_default_args:near 10.49 + proc _try_default_args near 10.50 + 10.51 + mov bx,offset tazboot_cmd 10.52 + extrn @open$qpxzc:near 10.53 + call @open$qpxzc 10.54 + jc @ret 10.55 + mov ch,15 ; cx<4096 10.56 + mov di,[_heap_top] 10.57 + jmp read_cmdline ; read_cmdline(ax,di,cx) 10.58 + 10.59 + endp _try_default_args 10.60 + endif 10.61 + 10.62 + ifdef NO386 10.63 +;*************************************************************** 10.64 +;u16 topseg(); 10.65 +;*************************************************************** 10.66 + global _topseg:near 10.67 + proc _topseg near 10.68 + 10.69 + int 12h 10.70 + jnc @@max640k 10.71 + mov ax,640 ; 9000 10.72 +@@max640k: 10.73 + dec ax 10.74 + and al,0C0h 10.75 + mov cl,6 10.76 + shl ax,cl 10.77 +@ret: 10.78 + ret 10.79 + 10.80 + endp _topseg 10.81 + endif 10.82 + 10.83 ends _TEXT 10.84 10.85
11.1 --- a/linld/stuff/src/_END.ASM Sun Dec 06 10:04:52 2020 +0000 11.2 +++ b/linld/stuff/src/_END.ASM Sat Dec 12 10:41:29 2020 +0000 11.3 @@ -18,10 +18,11 @@ 11.4 ends _DATA 11.5 11.6 segment _BSS word public use16 'BSS' 11.7 -STACK_SIZE = 1024 11.8 - 11.9 + ifdef EXTRA 11.10 global _version_string:byte 11.11 label _version_string byte 11.12 + endif 11.13 +STACK_SIZE = 1024 11.14 db STACK_SIZE dup(?) 11.15 global stktop:byte 11.16 label stktop byte
12.1 --- a/linld/stuff/src/pipehole.awk Sun Dec 06 10:04:52 2020 +0000 12.2 +++ b/linld/stuff/src/pipehole.awk Sat Dec 12 10:41:29 2020 +0000 12.3 @@ -33,11 +33,13 @@ 12.4 if (/== 0x662F/) islinld=2 12.5 if (islinld==2) { 12.6 if (/cpuhaslm/) islinld=0 12.7 - if (/mov/) { print "; " $0; next } 12.8 + if (/bx,word/) { print "; " $0; next } 12.9 } 12.10 if (/image\|initrd/) islinld=3 12.11 if (islinld==3) { 12.12 - if (/bx,word ptr/) { islinld=0; print "; " $0; next } 12.13 + if (/bx,word ptr/) { print "; " $0; next } 12.14 + if (/short @1@282/) print " mov bx,word ptr [si]" 12.15 + if (/@fileexist\$qpxzc/) islinld=0 12.16 } 12.17 if (/fileexist\$qpxzc/) islinld=4 12.18 if (islinld==4) { 12.19 @@ -45,14 +47,15 @@ 12.20 if (/ax,word ptr/) $0=" xchg ax,bx" 12.21 if (/\[si\]$/) { islinld=0; print "; " $0; next } 12.22 } 12.23 + if (/buf_cmdline\+1/) { 12.24 + islinld=5 12.25 + print " mov bx,offset DGROUP:buf_cmdline+1" 12.26 + sub(/offset DGROUP:buf_cmdline\+1/,"bx") 12.27 + } 12.28 if (islinld==5) { 12.29 - if (/si/ || /word ptr/) next 12.30 - if (/buf_cmdline/) { 12.31 - print " lodsw" 12.32 - islinld=0 12.33 - } 12.34 + if (/bx,offset DGROUP:buf_cmdline/) $0=" dec bx" 12.35 + if (/call/) islinld=0 12.36 } 12.37 - if (/do strcatb/) islinld=5 12.38 } # file == "linld.cpp" 12.39 if (file == "himem.cpp") { 12.40 if (/sp,bp/ || /pop bp/) next 12.41 @@ -65,7 +68,6 @@ 12.42 } 12.43 if (ishimem == 1) { 12.44 if (/do \{/) ishimem=2 12.45 - if (/byte ptr DGROUP:_vcpi,0/) print " mov bx,si" 12.46 if (/bx,si/ || /push bp/ || /bp,sp/ || /push di/ || /push si/) next 12.47 if (/sp,2/) next 12.48 if (/bp\+4/) { 12.49 @@ -74,7 +76,7 @@ 12.50 } 12.51 if (ishimem == 2) { 12.52 if (/movzx/) print " cwde" 12.53 - if (/bp-2/) next 12.54 + if (/bp-2/ || /di,ax/ || /bx,di/) next 12.55 if (/storepage.bufv/) { 12.56 print " inc ax" 12.57 print " push ax" 12.58 @@ -84,8 +86,35 @@ 12.59 } 12.60 if (/endp/) ishimem=0 12.61 } 12.62 + if (/@memcpy_image\$qp11image_himem/) next 12.63 + if (/far last_ditch/) { 12.64 + print " extrn memcpy_image_kernel:near" 12.65 + print " extrn memcpy_image_initrd:near" 12.66 + ishimem=3 12.67 + cpy_initrd=0 12.68 + } 12.69 + if (ishimem == 3) { 12.70 + if (/bx,di/ || /di,ax/ || /bx,32/) next 12.71 + if (/mov bx,si/) { 12.72 + if (cpy_initrd==0) sub(/mov bx,si/, "call memcpy_image_kernel") 12.73 + else sub(/mov bx,si/, "call memcpy_image_initrd") 12.74 + cpy_initrd=1-cpy_initrd 12.75 + } 12.76 + sub(/lea bx,\[si\+32\]/, "call memcpy_image_initrd") 12.77 + } 12.78 + if (/m = pm2initrd/) ishimem=4 12.79 + if (ishimem == 4) { 12.80 + if (/si,32/ || /bx,di/ || /di,ax/) next 12.81 + sub(/\[si/,"[si+32") 12.82 + sub(/mov bx,si/, "call memcpy_image_initrd") 12.83 + } 12.84 } # file == "himem.cpp" 12.85 if (file == "load.cpp") { 12.86 + if (/readrm\(m, 0x200/) isload=15 12.87 + if (isload == 15) { # LOAD.LST 12.88 + if (/bx,di/) next 12.89 + if (/call/) isload=0 12.90 + } 12.91 if (/load_image\(/) { 12.92 if (isload == 3) isload=13 12.93 else isload=14 12.94 @@ -120,7 +149,7 @@ 12.95 sub(/_imgs\+65534/,"_imgs-2") 12.96 if (/m, _rm_size/) isload=10 12.97 if (isload == 10) { # LOAD.LST 12.98 - if (/^ je /) next 12.99 + if (/^ je / || /bx,di/) next 12.100 if (/ptr @die\$qpxzc/) { 12.101 $0=" jne @die@" 12.102 isload=0 12.103 @@ -152,7 +181,7 @@ 12.104 sub(/dx/,"ax") 12.105 } 12.106 } 12.107 - if (/_version_string,0/) { 12.108 + if (/pm_low == 0/) { 12.109 print " mov ax,si" 12.110 print " push di" 12.111 isload=6 12.112 @@ -173,11 +202,11 @@ 12.113 next 12.114 } 12.115 } 12.116 - if (/version_string = /) isload=5 12.117 if (isload == 5) { # LOAD.LST 12.118 sub(/ax,/,"bx,") 12.119 - if (/_version_string,/) isload=0 12.120 + if (/strcatb/) isload=0 12.121 if (/mov bx,ax/) next 12.122 + sub(/,word ptr \[si\+29\]/,",cx") 12.123 } 12.124 if (/_base_himem\+2/ && is386 == 0) isload=4 12.125 if (isload == 4) { # LOAD.LST 12.126 @@ -192,11 +221,12 @@ 12.127 sub(/cmp /,"mov cx,") 12.128 } 12.129 sub(/je/,"jcxz") 12.130 - if (/@strcpy/) isload=0 12.131 + if (/\+0x200/) isload=5 12.132 } 12.133 if (/void load_initrd\(\)/) isload=3 12.134 if (isload == 3) { # LOAD.LST 12.135 if (/short @2@198/) sub(/@2@198/,"load_initrd_ret") 12.136 + if (/mov ax,word ptr \[si\]/) $0=" lodsw" 12.137 if( /jmp/) { 12.138 print "load_initrd_ret:" 12.139 print " pop si" 12.140 @@ -204,7 +234,7 @@ 12.141 next 12.142 } 12.143 sub(/\[di/,"[bx") 12.144 - sub(/\di,/,"bx,") 12.145 + sub(/di,/,"bx,") 12.146 } 12.147 if (/vid_mode = vid_mode/) isload=2 12.148 if (isload == 2) { # LOAD.LST 12.149 @@ -212,7 +242,7 @@ 12.150 sub(/je/,"jcxz") 12.151 if (/ax,word/) next 12.152 sub(/,ax/,",cx") 12.153 - if (/version_string/ || /starting linux 1\.3\.73/) isload=0 12.154 + if (/starting linux 1\.3\.73/) isload=0 12.155 } 12.156 if (/die\(not_kernel/ || /_rm_size=0x200/ || /heap_top = _rm_buf/) isload=1 12.157 if (isload == 1) { # LOAD.LST 12.158 @@ -894,5 +924,6 @@ 12.159 if (afterjmp) print ";" $0 12.160 else print 12.161 if (/^ jmp / || /^ call near ptr _boot_kernel/ || 12.162 - /^ call near ptr @die$qpxzc/) afterjmp=1 12.163 + /^ call near ptr @die\$qpxzc/ || 12.164 + /^ call near ptr @exit\$qv/) afterjmp=1 12.165 }
13.1 --- a/syslinux/stuff/iso2exe/bootiso.S Sun Dec 06 10:04:52 2020 +0000 13.2 +++ b/syslinux/stuff/iso2exe/bootiso.S Sat Dec 12 10:41:29 2020 +0000 13.3 @@ -158,7 +158,7 @@ 13.4 linld: 13.5 .asciz "linld.com" 13.6 cmdline: 13.7 - .ascii "-f " 13.8 +// .ascii "-f " 13.9 // .ascii "image=\boot\" 13.10 // .ascii "bzImage " 13.11 .ascii "initrd=" 13.12 @@ -172,8 +172,8 @@ 13.13 // .ascii " mode=menu" 13.14 .ascii " autologin rdinit=/init.exe magic=" 13.15 magicstr: 13.16 - .ascii "0 bootfrom=" 13.17 -// .ascii "65535 bootfrom=" 13.18 + .ascii "0 iso=" 13.19 +// .ascii "65535 iso=" 13.20 filename: 13.21 exestart: 13.22 movb $0x30,%ah // get DOS version
14.1 --- a/syslinux/stuff/iso2exe/init Sun Dec 06 10:04:52 2020 +0000 14.2 +++ b/syslinux/stuff/iso2exe/init Sat Dec 12 10:41:29 2020 +0000 14.3 @@ -5,31 +5,6 @@ 14.4 sed "/$1=/!d;s/.*$1=\\([^ ]*\\).*/\\1/" /proc/cmdline 14.5 } 14.6 14.7 -myget() 14.8 -{ 14.9 - hexdump -v -s $1 -n ${4:-${3:-2}} -e "\"\" 1/${3:-2} \" %u\n\"" $2 14.10 -} 14.11 - 14.12 -mount_proc() 14.13 -{ 14.14 - mount -t proc /proc /proc 14.15 - mount -t sysfs /sys /sys 14.16 - udevd --daemon 2>/dev/null && udevadm trigger && sleep 5 14.17 -} 14.18 - 14.19 -umount_proc() 14.20 -{ 14.21 - killall udevd 2>/dev/null 14.22 - umount /sys/fs/fuse/connections 2>/dev/null 14.23 - umount /sys 14.24 - umount /proc 14.25 -} 14.26 - 14.27 -checkmagic() 14.28 -{ 14.29 - [ -s $1 ] && [ $(getarg magic) = $(myget 18 $1 2) ] 14.30 -} 14.31 - 14.32 media=/media/cdrom 14.33 mnt=/mnt 14.34 getiso() 14.35 @@ -39,16 +14,16 @@ 14.36 for dev in $(ls -d $dev/$(basename $dev)*); do 14.37 [ "$dev" ] || continue 2 14.38 mount /dev/$(basename $dev) $mnt 14.39 - if checkmagic $mnt/$ISO; then 14.40 + if [ -s $mnt/$ISO ] && [ $(getarg magic) = $(hexdump -v -s 18 -n 2 -e "\"\" 1/2 \" %u\n\"" $mnt/$ISO) ]; then 14.41 echo "Found $ISO on $(basename $dev)" 14.42 ISO=$mnt/$ISO 14.43 mount -o loop,ro $ISO $media 14.44 - return 0 14.45 + return 14.46 fi 14.47 umount $mnt 14.48 done 14.49 done 14.50 - return 1 14.51 + text 14.52 } 14.53 14.54 uncpio=uncpio64 14.55 @@ -78,46 +53,22 @@ 14.56 echo -en "\"$1\" \"$2\"" 14.57 } 14.58 14.59 -myis_loram() 14.60 -{ 14.61 - [ -s /lib/modules/squashfs.ko* ] 14.62 -} 14.63 - 14.64 -mount_loram() 14.65 -{ 14.66 - myis_loram || return 14.67 - insmod /lib/modules/squashfs.ko* 2>/dev/null 14.68 - if [ -d $media/fs ]; then 14.69 - ln -s $media/fs /sqfs 14.70 - else 14.71 - mkdir /sqfs 14.72 - losetup -o 124 /dev/loop6 $(ls -r $media/boot/rootfs?*.* | sed q) 14.73 - mount -r /dev/loop6 /sqfs 14.74 - fi 14.75 - cp -a /sqfs/dev/fuse /sqfs/dev/tty[12] /dev 14.76 - for i in /sqfs/dev/* ; do [ -b $i ] && cp -a $i /dev ; done 14.77 - ln -s /sqfs/lib/* lib 2>/dev/null 14.78 - ln -fs /sqfs/usr /sqfs/var / 14.79 - mkdir /etc && cp /sqfs/etc/dialogrc /etc 2>/dev/null 14.80 -} 14.81 - 14.82 -umount_loram() 14.83 -{ 14.84 - myis_loram || return 14.85 - rm /var /usr 14.86 - umount -d /sqfs 14.87 - rmdir /sqfs 2>/dev/null || rm -f /sqfs 14.88 - rm -rf /etc 14.89 -} 14.90 - 14.91 dosync() 14.92 { 14.93 sync 14.94 - umount_loram 14.95 + if [ -s /lib/modules/squashfs.ko* ]; then 14.96 + rm /var /usr 14.97 + umount -d /sqfs 14.98 + rmdir /sqfs 2>/dev/null || rm -f /sqfs 14.99 + rm -rf /etc 14.100 + fi 14.101 umount -d $media 14.102 rm -f /dev/cdrom 14.103 umount $mnt 14.104 - umount_proc 14.105 + killall udevd 2>/dev/null 14.106 + umount /sys/fs/fuse/connections 2>/dev/null 14.107 + umount /sys 14.108 + umount /proc 14.109 } 14.110 14.111 xhascustomconf=false 14.112 @@ -130,11 +81,11 @@ 14.113 getcustomconf /tmp > /dev/null 14.114 [ -s /tmp/cmdline ] && 14.115 cmdline="$cmdline $(cat /tmp/cmdline)" && 14.116 - init="$(sed '/rdinit=/!d;s/.*rdinit=\([^ ]*\).*/\1/' < /tmp/cmdline)" 14.117 + init="$(sed '/rdinit=/!d;s/.*rdinit=\([^ ]*\).*/\1/' /tmp/cmdline)" 14.118 [ -s /tmp/initrd ] && $uncpio /tmp/initrd 14.119 fi 14.120 dosync 14.121 - sed -i 's/ || exit//' /init 14.122 + sed 's/ || exit//' -i /init 14.123 exec ${init:-/init} $cmdline 14.124 } 14.125 14.126 @@ -176,9 +127,10 @@ 14.127 } 14.128 14.129 BIN=bin/mount.posixovl 14.130 -[ -x /usr/s$BIN ] || mv /bin/mount.posixovl.iso2exe \ 14.131 -/usr/s$BIN 2>/dev/null || mv /bin/mount.posixovl.iso2exe /$BIN 2>/dev/null 14.132 -mount_proc 14.133 +[ -x /usr/s$BIN ] || mv /$BIN.iso2exe /usr/s$BIN 2>/dev/null || mv /$BIN.iso2exe /$BIN 2>/dev/null 14.134 +mount -t proc /proc /proc 14.135 +mount -t sysfs /sys /sys 14.136 +udevd --daemon 2>/dev/null && udevadm trigger && sleep 5 14.137 mdev -s 2> /dev/null || 14.138 for i in /sys/block/*/dev /sys/block/*/*/dev; do 14.139 [ -s "$i" ] || continue 14.140 @@ -187,8 +139,22 @@ 14.141 [ -e $n ] && continue 14.142 mknod $n b $(sed 's/:/ /' < $i) 14.143 done 2>/dev/null 14.144 -ISO="$(getarg bootfrom | sed 's/.://;s|\\|/|g')" 14.145 +ISO="$(getarg iso | sed 's/.://;s|\\|/|g')" 14.146 getiso 2>/dev/null || text 14.147 -mount_loram 14.148 +if [ -s /lib/modules/squashfs.ko* ]; then 14.149 + insmod /lib/modules/squashfs.ko* 2>/dev/null 14.150 + if [ -d $media/fs ]; then 14.151 + ln -s $media/fs /sqfs 14.152 + else 14.153 + mkdir /sqfs 14.154 + losetup -o 124 /dev/loop6 $(ls -r $media/boot/rootfs?*.* | sed q) 14.155 + mount -r /dev/loop6 /sqfs 14.156 + fi 14.157 + cp -a /sqfs/dev/fuse /sqfs/dev/tty[12] /dev 14.158 + for i in /sqfs/dev/* ; do [ -b $i ] && cp -a $i /dev ; done 14.159 + ln -s /sqfs/lib/* lib 2>/dev/null 14.160 + ln -fs /sqfs/usr /sqfs/var / 14.161 + mkdir /etc && cp /sqfs/etc/dialogrc /etc 2>/dev/null 14.162 +fi 14.163 [ -s /usr/bin/taziso ] || live 14.164 . /usr/bin/taziso
15.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh Sun Dec 06 10:04:52 2020 +0000 15.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh Sat Dec 12 10:41:29 2020 +0000 15.3 @@ -293,15 +293,21 @@ 15.4 --build) 15.5 shift 15.6 TMP=/tmp/iso2exe$$ 15.7 + dd if=/dev/zero bs=1k count=100 of=/tmp/fs$$ 15.8 + mke2fs /tmp/fs$$ 15.9 + mkdir $TMP 15.10 + mount -o loop /tmp/fs$$ $TMP 15.11 + rm -rf $TMP/* 15.12 mkdir -p $TMP/dev 15.13 cp -a /dev/tty /dev/tty0 $TMP/dev 15.14 sed 's|^[ |\t]*||' init > $TMP/init.exe 15.15 find $TMP -type f -print0 | xargs -0 chmod +x 15.16 find $TMP -print0 | xargs -0 touch -t 197001010100.00 15.17 - ( cd $TMP; find dev init.exe | cpio -o -H newc ) | compress > rootfs.gz 15.18 + ( cd $TMP; find dev init.exe | cpio -o -H newc ) | compress rootfs.gz 15.19 + umount -d $TMP 15.20 + rm -rf $TMP /tmp/fs$$ 15.21 p=$((4-($(stat -c %s rootfs.gz)%4))) 15.22 [ $p = 4 ] || dd if=/dev/zero bs=1 count=$p >> rootfs.gz 15.23 - rm -rf $TMP 15.24 chmod 644 ${@/init/rootfs.gz} 15.25 chown root.root ${@/init/rootfs.gz} 15.26 touch -t 197001010100.00 ${@/init/rootfs.gz}