wok rev 21791

Fix loram dos boot
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Aug 01 15:16:29 2019 +0200 (2019-08-01)
parents e66efc062996
children 3937da23fe1e
files linld/stuff/src/CRTL.ASM linld/stuff/src/CRTLX.H linld/stuff/src/LINLD.CPP linld/stuff/src/MEMCPY32.ASM linld/stuff/src/MEMTOP.ASM linld/stuff/src/TAZBOOT.CPP linld/stuff/src/XMM.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/CRTL.ASM	Tue Jul 30 10:35:07 2019 +0200
     1.2 +++ b/linld/stuff/src/CRTL.ASM	Thu Aug 01 15:16:29 2019 +0200
     1.3 @@ -1327,101 +1327,6 @@
     1.4  		ifdef	EXTRA
     1.5                  p8086
     1.6  ;***************************************************************
     1.7 -;char *progname(void)
     1.8 -;***************************************************************
     1.9 -        global  _progname:near
    1.10 -        proc    _progname near
    1.11 -
    1.12 -		push	si di
    1.13 -		mov	ah,30h
    1.14 -		int	21h
    1.15 -		xor	di,di
    1.16 -		cmp	al,3
    1.17 -		mov	ax,di
    1.18 -		jb	@@skip
    1.19 -		;mov	es,[cs:2Ch]
    1.20 -		mov	es,[di+2Ch]
    1.21 -		mov	cx,sp			; big enough
    1.22 -@@loop:
    1.23 -		repne
    1.24 -		  scasb
    1.25 -		scasb
    1.26 -		jne	@@loop
    1.27 -		inc	di
    1.28 -		inc	di
    1.29 -; ax = strdup(bx) ?
    1.30 -		mov	si,di			; progname @es:di
    1.31 -		repne
    1.32 -		  scasb
    1.33 -		mov	ax,di
    1.34 -		sub	ax,si			; progname len
    1.35 -		push	ax
    1.36 -		call	malloc_or_die
    1.37 -		mov	di,ax
    1.38 -		pop	cx
    1.39 -		push	ds
    1.40 -		push	es
    1.41 -		pop	ds
    1.42 -		pop	es
    1.43 -		rep
    1.44 -		  movsb
    1.45 -		push	es
    1.46 -		pop	ds
    1.47 -@@skip:
    1.48 -		pop	di si
    1.49 -		ret
    1.50 -
    1.51 -        endp    _progname
    1.52 -
    1.53 -
    1.54 -;***************************************************************
    1.55 -;_fastcall void chdirname(bx:char *path)
    1.56 -;***************************************************************
    1.57 -        global  @chdirname$qpzc:near
    1.58 -        proc    @chdirname$qpzc near
    1.59 -
    1.60 -		cmp	[byte bx+1],3Ah		; ':'
    1.61 -		jne	@@nodisk
    1.62 -		mov	dl,20h
    1.63 -		or	dl,[bx]
    1.64 -		sub	dl,61h
    1.65 -		mov	ah,0Eh
    1.66 -		int	21h
    1.67 -		inc	bx
    1.68 -		inc	bx
    1.69 -@@nodisk:
    1.70 -		xor	cx,cx
    1.71 -@@next:
    1.72 -		mov	al,[bx]
    1.73 -		cmp	al,5Ch
    1.74 -		jne	@@tsteos
    1.75 -		mov	dx,bx
    1.76 -		inc	cx
    1.77 -@@tsteos:
    1.78 -		inc	bx
    1.79 -		or	al,al
    1.80 -		jnz	@@next
    1.81 -		jcxz	@@end
    1.82 -		mov	bx,dx
    1.83 -		push	[word bx]
    1.84 -		mov	[bx],al
    1.85 -	ifdef	LONG_FILENAME
    1.86 -		stc
    1.87 -		mov	ax,713Bh		; chdir long filename (ds:dx)
    1.88 -		int	21h
    1.89 -		jnc	@@chdirdone
    1.90 -	endif
    1.91 -		mov	ah,3Bh			; chdir(ds:dx)
    1.92 -		int	21h
    1.93 -@@chdirdone:
    1.94 -		pop	[word bx]
    1.95 -@@end:
    1.96 -		ret
    1.97 -
    1.98 -        endp    @chdirname$qpzc
    1.99 -
   1.100 -
   1.101 -;***************************************************************
   1.102  ;_fastcall char *ultoa(axdx:unsigned long n);
   1.103  ;***************************************************************
   1.104          global  @ultoa$qul:near
     2.1 --- a/linld/stuff/src/CRTLX.H	Tue Jul 30 10:35:07 2019 +0200
     2.2 +++ b/linld/stuff/src/CRTLX.H	Thu Aug 01 15:16:29 2019 +0200
     2.3 @@ -5,8 +5,6 @@
     2.4  extern _fastcall int strcmp(const char* a,const char* b);
     2.5  //extern "C" char* strstr(const char* a,const char* b);
     2.6  extern _fastcall int strstr(const char* a,const char* b);
     2.7 -extern "C" char *progname(void);
     2.8 -extern _fastcall void chdirname(char *path);
     2.9  extern _fastcall unsigned long kver2ul(char *kernel_version);
    2.10  //extern "C" char *ultoa(unsigned long n);
    2.11  extern _fastcall int ultoa(unsigned long n);
     3.1 --- a/linld/stuff/src/LINLD.CPP	Tue Jul 30 10:35:07 2019 +0200
     3.2 +++ b/linld/stuff/src/LINLD.CPP	Thu Aug 01 15:16:29 2019 +0200
     3.3 @@ -89,12 +89,7 @@
     3.4  	    load_initrd();
     3.5  	    boot_kernel();
     3.6  	}
     3.7 -        if(strhead(s,"image=") != -1) {
     3.8 -	    s+=6;
     3.9 -	set_kernel_name:
    3.10 -            kernel_name=s;
    3.11 -        }
    3.12 -        else if(strhead(s,"initrd=") != -1) {
    3.13 +        if(strhead(s,"initrd=") != -1) {
    3.14              initrd_name=s+7;
    3.15          }
    3.16          else if(strhead(s,"vga=") != -1) {
    3.17 @@ -140,6 +135,11 @@
    3.18  		((u16 *)&topmem)[1] = (u16)(strtol(s+4)>>16);
    3.19  		goto addincmdline;
    3.20  	    }
    3.21 +            else if(strhead(s,"image=") != -1) {
    3.22 +	        s+=6;
    3.23 +	    set_kernel_name:
    3.24 +                kernel_name=s;
    3.25 +            }
    3.26  	    else {
    3.27  	addincmdline:
    3.28  		if(cmdline == (const char *) buf_cmdline + 1) {
     4.1 --- a/linld/stuff/src/MEMCPY32.ASM	Tue Jul 30 10:35:07 2019 +0200
     4.2 +++ b/linld/stuff/src/MEMCPY32.ASM	Thu Aug 01 15:16:29 2019 +0200
     4.3 @@ -93,16 +93,18 @@
     4.4  		xor	bx,bx
     4.5  		xor	si,si
     4.6  		mov	ax,[srcseg]
     4.7 -		xor	dx,dx
     4.8  		extrn	N_LXLSH@4:near
     4.9  		call	near ptr N_LXLSH@4
    4.10  		add	[word srcofs],ax
    4.11  		adc	[word srcofs+2],dx
    4.12  @@2flat:
    4.13 -		mov	ax,[word si+srcofs]	; srcofs, dstofs lo
    4.14 -		mov	dx,[word si+srcofs+2]	; srcofs, dstofs hi
    4.15 -		extrn	N_LXURSH@4:near
    4.16 -		call	near N_LXURSH@4
    4.17 +		les	ax,[dword si+srcofs]	; srcofs, dstofs
    4.18 +		mov	dx,es
    4.19 +		mov	cl,4
    4.20 +@@loop:
    4.21 +		shr	dx,1
    4.22 +		rcr	ax,1
    4.23 +		loop	@@loop
    4.24  		or	bx,dx			; >=1mb flag
    4.25  		push	ax			; srcseg, dstseg
    4.26  		xor	si,-6
     5.1 --- a/linld/stuff/src/MEMTOP.ASM	Tue Jul 30 10:35:07 2019 +0200
     5.2 +++ b/linld/stuff/src/MEMTOP.ASM	Thu Aug 01 15:16:29 2019 +0200
     5.3 @@ -88,14 +88,15 @@
     5.4                  setc    dl              ;  (optimized to death)
     5.5  		shld    dx,ax,cl
     5.6  		shl     ax,cl		;  (kbytes -> bytes)
     5.7 +		ret
     5.8  		else
     5.9                  xor     dx,dx
    5.10                  add     ah,4h           ;account for 1024 low kb
    5.11                  adc     dx,dx           ;  (optimized to death)
    5.12 -		db	0A9h		; test ax,04B1h
    5.13 -        global  N_LXLSH@4:near
    5.14 -N_LXLSH@4:
    5.15 -		mov	cl,4
    5.16 +		db	0A9h		; test ax,0C28Ch
    5.17 +        global  N_LXLSH@ES:near
    5.18 +N_LXLSH@ES:
    5.19 +		mov	dx,es
    5.20          global  N_LXLSH@:near
    5.21  N_LXLSH@:
    5.22  		mov	ch,0
    5.23 @@ -103,30 +104,16 @@
    5.24  		shl	ax,1
    5.25  		rcl	dx,1
    5.26  		loop	@@lp
    5.27 +		ret
    5.28 +        global  N_LXLSH@4:near
    5.29 +N_LXLSH@4:
    5.30 +		xor	dx,dx
    5.31 +		mov	cl,4
    5.32 +		jmp	N_LXLSH@
    5.33  		endif
    5.34 -		ret
    5.35  
    5.36  ;        endp    _memtop_88
    5.37  
    5.38 -		ifdef	NO386
    5.39 -        global  N_LXURSH@:near
    5.40 -        global  N_LXURSH@4:near
    5.41 -;        proc    N_LXURSH@4 near
    5.42 -N_LXURSH@4:
    5.43 -		mov	cl,4
    5.44 -N_LXURSH@:
    5.45 -		mov	ch,0
    5.46 -@@loop:
    5.47 -		shr	dx,1
    5.48 -		rcr	ax,1
    5.49 -		loop	@@loop
    5.50 -		ret
    5.51 -
    5.52 -;        endp    N_LXURSH@4
    5.53 -
    5.54 -		endif
    5.55 -
    5.56 -
    5.57  ;        proc    _memtopz near
    5.58  
    5.59  ;                call	_memtop_e801
     6.1 --- a/linld/stuff/src/TAZBOOT.CPP	Tue Jul 30 10:35:07 2019 +0200
     6.2 +++ b/linld/stuff/src/TAZBOOT.CPP	Thu Aug 01 15:16:29 2019 +0200
     6.3 @@ -163,8 +163,6 @@
     6.4  int main(int argc, char *argv[])
     6.5  {
     6.6  	((u16*) &base_himem)[1] |= (_1m+_64k)>>16;	// base_himem = _1m+_64k
     6.7 -	argv[0] = progname();
     6.8 -	bootiso(argv);	// iso ? parsing is /init.exe stuff !
     6.9  
    6.10  	if (argc < 2) {
    6.11  		try_default_args();
    6.12 @@ -180,14 +178,38 @@
    6.13    kernel=\\slitaz\\elks\n\
    6.14    root=/dev/bda1 ro\n");
    6.15  	}
    6.16 -	bootiso(argv + 1);
    6.17 -	chdirname(*argv);
    6.18 +	bootiso(argv + 1);	// iso ? parsing is /init.exe stuff !
    6.19  	for (int i=0;;) {
    6.20  		char *s;
    6.21  	next:	argv++;
    6.22  		s=*argv;
    6.23  		i++;
    6.24 -		if (!s) break;
    6.25 +		if (!s) {
    6.26 +			if (isoreset(iso) != -1) {
    6.27 +				s = (char *) initrd_name;
    6.28 +				if (isoopen((char *) kernel_name) != -1) {
    6.29 +					isokernel();
    6.30 +				}
    6.31 +				if (s) {
    6.32 +					do {
    6.33 +						char *p, c;
    6.34 +						for (p = s; *s && *s != ','; s++);
    6.35 +						c = *s; *s = 0;
    6.36 +						if (isoopen(p) != -1) {
    6.37 +							addinitrd();
    6.38 +						}
    6.39 +						*s = c;
    6.40 +						if (c) s++;
    6.41 +					} while (*s);
    6.42 +					load_initrds();
    6.43 +				}
    6.44 +			}
    6.45 +			else {
    6.46 +				load_kernel();
    6.47 +				load_initrd();
    6.48 +			}
    6.49 +			boot_kernel();
    6.50 +		}
    6.51  #ifdef USE_ARGSTR
    6.52  	        if ((*(u16 *)s|0x2002) == 0x662F) {	// -F /f
    6.53  			skip_alloc++;
    6.54 @@ -201,32 +223,32 @@
    6.55  		else strcatb(buf_cmdline,*argv);	// FIXME mem ?
    6.56  	}
    6.57  #else
    6.58 -		if (strhead(s,"kernel=") != -1) {
    6.59 +		if (strhead(s,"initrd=") != -1) {
    6.60 +			s += 7;
    6.61 +			initrd_name = s;
    6.62 +		}
    6.63 +		else if (strhead(s,"bootfrom=") != -1) {
    6.64 +			s += 9;
    6.65 +			goto set_iso;
    6.66 +		}
    6.67 +		else if (strhead(s,"iso=") != -1) {
    6.68 +			s += 4;
    6.69 +	set_iso:
    6.70 +			iso = s;
    6.71 +		}
    6.72 +		else if (strhead(s,"image=") != -1) {
    6.73 +			goto set_kernel;
    6.74 +		}
    6.75 +		else if(strhead(s,"vga=") != -1) {
    6.76 +			*(u16*)&vid_mode = (u16)strtol(s+4);	// support normal, extended & ask
    6.77 +		}
    6.78 +		else if (strhead(s,"kernel=") != -1) {
    6.79  			s++;
    6.80  	set_kernel:
    6.81  			s += 6;
    6.82  	set_kernelz:
    6.83  			kernel_name = s;
    6.84  		}
    6.85 -		else if (strhead(s,"image=") != -1) {
    6.86 -			goto set_kernel;
    6.87 -		}
    6.88 -		else if (strhead(s,"initrd=") != -1) {
    6.89 -			s += 7;
    6.90 -			initrd_name = s;
    6.91 -		}
    6.92 -		else if (strhead(s,"bootfrom=") != -1) {
    6.93 -			s += 9;
    6.94 -	set_iso:
    6.95 -			iso = s;
    6.96 -		}
    6.97 -		else if (strhead(s,"iso=") != -1) {
    6.98 -			s += 4;
    6.99 -			goto set_iso;
   6.100 -		}
   6.101 -		else if(strhead(s,"vga=") != -1) {
   6.102 -			*(u16*)&vid_mode = (u16)strtol(s+4);	// support normal, extended & ask
   6.103 -		}
   6.104  	        else switch (*(u16 *)s|0x2002) {
   6.105  		case 0x662F:	// -F /f
   6.106  			skip_alloc++;
   6.107 @@ -255,29 +277,4 @@
   6.108  		}}
   6.109  	}
   6.110  #endif
   6.111 -	if (isoreset(iso) != -1) {
   6.112 -		char *s = (char *) initrd_name;
   6.113 -		if (isoopen((char *) kernel_name) != -1) {
   6.114 -			isokernel();
   6.115 -		}
   6.116 -		if (s) {
   6.117 -			while (*s) {
   6.118 -				char *p, c;
   6.119 -				for (p = s; *s && *s != ','; s++);
   6.120 -				c = *s; *s = 0;
   6.121 -				if (isoopen(p) != -1) {
   6.122 -					addinitrd();
   6.123 -				}
   6.124 -				*s = c;
   6.125 -				if (c) s++;
   6.126 -			}
   6.127 -			load_initrds();
   6.128 -		}
   6.129 -	}
   6.130 -	else {
   6.131 -		load_kernel();
   6.132 -		load_initrd();
   6.133 -	}
   6.134 -	boot_kernel();
   6.135 -	return _AX;
   6.136  }
     7.1 --- a/linld/stuff/src/XMM.ASM	Tue Jul 30 10:35:07 2019 +0200
     7.2 +++ b/linld/stuff/src/XMM.ASM	Thu Aug 01 15:16:29 2019 +0200
     7.3 @@ -109,11 +109,10 @@
     7.4  		;cwd
     7.5  		;add	ax,[word (image_himem bx).size]		; lo m->size
     7.6  		;adc	dx,[word (image_himem bx+2).size]	; hi m->size
     7.7 -		mov	ax,[word (image_himem bx).size]		; lo m->size
     7.8 -		mov	dx,[word (image_himem bx+2).size]	; hi m->size
     7.9 +		les	ax,[dword (image_himem bx).size]	; m->size
    7.10  		mov	cl,16-10
    7.11 -		extrn	N_LXLSH@:near
    7.12 -		call	N_LXLSH@
    7.13 +		extrn	N_LXLSH@ES:near
    7.14 +		call	N_LXLSH@ES
    7.15                  inc     dx
    7.16                  mov     ah,9h          ;allocate blk of DX kilobytes (<64Mb)
    7.17  		endif
     8.1 --- a/linld/stuff/src/pipehole.awk	Tue Jul 30 10:35:07 2019 +0200
     8.2 +++ b/linld/stuff/src/pipehole.awk	Thu Aug 01 15:16:29 2019 +0200
     8.3 @@ -1,11 +1,35 @@
     8.4 -BEGIN { hold=0; is386=0; isload=0; isiso=0; istazboot=0; wascall=0; label="none"; xlabel="" }
     8.5 +BEGIN { hold=0; is386=0; isload=0; isiso=0; istazboot=0; wascall=0; ishimem=0; label="none"; xlabel=""; file="" }
     8.6  function isnum(n) { return match(n,/^[0-9+-]/) }
     8.7  {
     8.8  	sub(/segment word public/,"segment byte public")
     8.9  
    8.10  	if (/^@.*:$/ || /	endp$/) afterjmp=0
    8.11 -	if (/dword ptr/) is386=1
    8.12 +	if (/^	\.386p$/) is386=1
    8.13 +	if (file == "" && /debug	S/) { file=$3; gsub(/\"/,"",file) }
    8.14 +	 if (file == "himem.cpp") {
    8.15 +	if (/remaining = m-/) ishimem=1
    8.16 +	if (ishimem == 1 && is386 == 0) {
    8.17 +		if (/si\+8\]$/ || /si\+4\]$/ || /si\+16\]$/) next
    8.18 +		if (/si\+6\]$/ || /si\+2\]$/ || /si\+14\]$/) sub(/mov	dx,/,"les	dx,d")
    8.19 +		if (/si\+12\],ax/ || /si\+16\],ax/ || /bp-2\],ax/) sub(/,ax/,",es")
    8.20 +		if (/do \{/) ishimem=0
    8.21 +	}
    8.22 +	 } # file == "himem.cpp"
    8.23 +	 if (file == "load.cpp") {
    8.24  	sub(/DGROUP:_imgs\+65534/,"[di-2]")
    8.25 +	if (/short @1@366$/) isload=10
    8.26 +	if (isload == 10) {  # LOAD.LST
    8.27 +		if (/^	je	/) next
    8.28 +		if (/ptr @die\$qpxzc/) {
    8.29 +			$0="	jne	@die@"
    8.30 +			isload=0
    8.31 +		}
    8.32 +	}
    8.33 +	if (/setup_sects == 0/) isload=9
    8.34 +	if (isload == 9) {  # LOAD.LST
    8.35 +		sub(/,0/,",al")
    8.36 +		if (/jne/) isload=0
    8.37 +	}
    8.38  	if (/fallback\)\[1\] == 0/) isload=8
    8.39  	if (isload == 8) {  # LOAD.LST
    8.40  		if (/load_image/) isload=0
    8.41 @@ -14,10 +38,13 @@
    8.42  	if (/cmd_line_ptr =/ && is386 == 0) isload=7
    8.43  	if (isload == 7) {  # LOAD.LST
    8.44  		if (/add/ || /xor/ || /extrn/ || /N_LXLSH@/ || /cl,4/) next
    8.45 -		if (/,ax/) {
    8.46 -			sub(/ax/,"8000h")
    8.47 +		if (/enable A20 if needed/) {
    8.48 +			print "	mov	word ptr [bx+si],8000h"
    8.49  			isload=0
    8.50  		}
    8.51 +		if (/,ax/) $0="	mov	bx,55"
    8.52 +		if (/si-463/) $0="	mov	bx,-463"
    8.53 +		if (/si-465/) $0="	mov	word ptr [bx+si-2],-23745"
    8.54  		if (/,dx/) {
    8.55  			print "	mov	cl,12"
    8.56  			print "	shr	ax,cl"
    8.57 @@ -55,7 +82,6 @@
    8.58  	if (isload == 4 && is386 == 0) {  # LOAD.LST
    8.59  		if (/push/ || /pop/) next
    8.60  		if (/ax,cs/) {
    8.61 -			print "	cwd"
    8.62  			sub(/ax,cs/,"bx,cs")
    8.63  		}
    8.64  		if (/dx,dx/) next
    8.65 @@ -68,9 +94,21 @@
    8.66  			isload=400
    8.67  		}
    8.68  	}
    8.69 -	if (isload == 400 && /,0/) {
    8.70 +	if (isload == 400) {
    8.71 +		if (/call/) {
    8.72 +			print	"	extrn	N_LXLSH@4:near"
    8.73 +			sub(/N_LXLSH@/,"N_LXLSH@4")
    8.74 +		}
    8.75  		sub(/,0/,",dh")
    8.76 -		isload=0
    8.77 +		if (/_base_himem\+2/ || /pop/ || /push/) next
    8.78 +		if (/_base_himem$/) {
    8.79 +			sub(/mov	dx,/,"les	dx,d")
    8.80 +			isload++
    8.81 +		}
    8.82 +	}
    8.83 +	if (isload == 401) {
    8.84 +		sub(/,ax/,",es")
    8.85 +		if (/load_image/) isload=0
    8.86  	}
    8.87  	if (isload == 4 && is386) {  # LOAD.LST
    8.88  		sub(/dx,cs/,"edx,cs")
    8.89 @@ -101,15 +139,39 @@
    8.90  		sub(/,ax/,",cx")
    8.91  		if (/version_string/ || /starting linux 1\.3\.73/) isload=0
    8.92  	}
    8.93 -	if (/_rm_size=0x200/ || /heap_top = _rm_buf/) isload=1
    8.94 +	if (/Not a kernel/ || /_rm_size=0x200/ || /heap_top = _rm_buf/) isload=1
    8.95  	if (isload == 1) {  # LOAD.LST
    8.96 +		if (/ptr .die\$qpxzc/) $0="@die@:\n" $0
    8.97  		if (/mov	al,byte ptr/ && is386) {
    8.98  			print "	movzx	eax,byte ptr [si]"
    8.99  			next
   8.100  		}
   8.101 +		if (is386 == 0) {
   8.102 +			if (/di-5\],ax/) print "	cwd"
   8.103 +			sub(/,0$/,",dx")
   8.104 +		}
   8.105  		if (/ax,word ptr/) next
   8.106  		if (/^	call/) isload=0
   8.107  	}
   8.108 +	 } # file == "load.cpp"
   8.109 +	 if (file == "iso9660.cpp") {
   8.110 +	if (/<< SECTORBITS/) isiso=9
   8.111 +	if (isiso == 9) { # ISO9660.LST
   8.112 +		if (/dx,/) next
   8.113 +		sub(/mov	ax,/,"les	ax,d")
   8.114 +		if (/^	call/) {
   8.115 +			print "	extrn	N_LXLSH@ES:near"
   8.116 +			sub(/N_LXLSH@/,"N_LXLSH@ES")
   8.117 +			isiso=0
   8.118 +		}
   8.119 +	}
   8.120 +	if (/filesize =/) isiso=8
   8.121 +	if (isiso == 8) { # ISO9660.LST
   8.122 +		if (/ax,/) next
   8.123 +		sub(/mov	dx,/,"les	dx,d")
   8.124 +		sub(/,ax/,",es")
   8.125 +		if (/filemod/) isiso=0
   8.126 +	}
   8.127  	if (/CD001/) isiso=7
   8.128  	if (isiso == 7) { # ISO9660.LST
   8.129  		sub(/mov	ax,-1/,"dec	ax")
   8.130 @@ -137,6 +199,8 @@
   8.131  		sub(/DGROUP:_isostate\+20/,"[si+20]")
   8.132  		if (/goto restarted/) isiso=0
   8.133  	}
   8.134 +	 } # file == "iso9660.cpp"
   8.135 +	 if (file == "iso9660.cpp" || file == "tazboot.cpp") {
   8.136  	if (/do s\+\+; while/) isiso=3
   8.137  	if (/for \(p = s; \*s && \*s \!=/) isiso=3
   8.138  	if (isiso == 3) { # ISO9660.LST, TAZBOOT.LST
   8.139 @@ -147,10 +211,15 @@
   8.140  		if (/al,0/) print "	mov	al,[" r "]"
   8.141  		if (/al,byte ptr/) sub(/mov/,"xchg")
   8.142  		if (/byte ptr \[.*\],0/) next
   8.143 -		if (/jmp/) print "	mov	bx,si"
   8.144 +		if (/jmp/) {
   8.145 +			print "	mov	bx,si"
   8.146 +			$0="	db	0A8h	; test al,xx instead of " $0
   8.147 +		}
   8.148  		if (/word ptr \[bp-4\]/) next
   8.149  		if (/\) s\+\+;/ || /\],-1/) isiso=0
   8.150  	}
   8.151 +	 } # file == "iso9660.cpp" || file == "tazboot.cpp"
   8.152 +	 if (file == "iso9660.cpp") {
   8.153  	if (/endname = NULL/) isiso=2
   8.154  	if (isiso == 2) { # ISO9660.LST
   8.155  		if (/mov	bx,cx/) next
   8.156 @@ -172,10 +241,13 @@
   8.157  		if (/jmp	@3@58$/) $0="	je	@3@58"
   8.158  		sub(/mov	ax,-1/,"dec	ax")
   8.159  	}
   8.160 +	 } # file == "iso9660.cpp"
   8.161  	if (/endp/) { xlabel = ""; goto2=0 }
   8.162  	if (/isoopen\(s\+7\)/ && xlabel == "") goto2=1
   8.163  	if (/_vid_mode,ax/ && xlabel == "") goto2=1
   8.164 +	if (/_initrd_name,si/ && xlabel == "") goto2=1
   8.165  	if (/_base_himem\+2,/ && xlabel == "@") goto2=1
   8.166 +	if (/DGROUP:_skip_alloc/ && xlabel == "@") goto2=1
   8.167  	if (/puts\(cmdline\)/ && xlabel == "@@") goto2=1
   8.168  	if (goto2 == 1 && /jmp/) { # TAZBOOT.LST && LINLD.LST
   8.169  		print $NF xlabel "@:"
   8.170 @@ -185,6 +257,30 @@
   8.171  		$0=$0 xlabel
   8.172  		if (goto2++ == 1) xlabel=xlabel "@"
   8.173  	}
   8.174 +	if (/if\(\*s>=/) isotazboot=14
   8.175 +	if (isotazboot == 14) { # LINLD.LST
   8.176 +		if (/jmp/) {
   8.177 +			$0="	db	0A9h	; test ax,xxxx instead of " $0
   8.178 +			isotazboot=0
   8.179 +		}
   8.180 +	}
   8.181 +	if (file == "tazboot.cpp" && /;					s \+= 4/) isotazboot=13
   8.182 +	if (isotazboot == 13) { # TAZBOOT.LST
   8.183 +		if (/si,4/) $0="	lea	bx,[si+4]"
   8.184 +		if (/bx,si/) next
   8.185 +		if (/DGROUP:_topmem/ || /set_iso/) isotazboot=0
   8.186 +	}
   8.187 +	if (file == "tazboot.cpp" && /case 0x652F:/) isotazboot=12
   8.188 +	if (isotazboot == 12) { # TAZBOOT.LST
   8.189 +		sub(/si,word/,"bx,word")
   8.190 +		if (/short/) isotazboot=0
   8.191 +	}
   8.192 +	if (/return load_kernel/) isotazboot=11
   8.193 +	if (isotazboot == 11) { # TAZBOOT.LST
   8.194 +		sub(/call/,"jmp")
   8.195 +		if (/ret/ || /pop/) next
   8.196 +		if (/endp/) isotazboot=0
   8.197 +	}
   8.198  	if (/cmdline=s\+=3/ || /magic \!= 0/ || /&root_dev =/) { isotazboot=10; j="" }
   8.199  	if (isotazboot == 10) { # TAZBOOT.LST && LINLD.LST
   8.200  		if (/je/ || /jne/) { j=$1; next }
   8.201 @@ -215,9 +311,8 @@
   8.202  	}
   8.203  	if (/\+\+isknoppix/) isotazboot=7
   8.204  	if (isotazboot == 7) { # TAZBOOT.LST
   8.205 -		if (/al,byte/) sub (/al,byte ptr DGROUP:/,"bx,offset ")
   8.206 -		if (/inc/) sub (/al/,"word ptr [bx]")
   8.207 -		if (/,al/) next
   8.208 +		if (/inc/ || /,al/) next
   8.209 +		if (/al,byte/) sub (/mov	al,/,"inc	")
   8.210  		if (/isokernel/) isotazboot=0
   8.211  	}
   8.212  	if (/if \(c\) s\+\+;/) isotazboot=6
   8.213 @@ -228,6 +323,12 @@
   8.214  		}
   8.215  	}
   8.216  	if (/static void next_chunk/) isotazboot=5
   8.217 +	if (isotazboot == 501) {
   8.218 +		if (/ret/) {
   8.219 +			print "@1@86:"
   8.220 +			isotazboot=0
   8.221 +		}
   8.222 +	}
   8.223  	if (isotazboot == 5 || isotazboot == 500) { # TAZBOOT.LST
   8.224  		if (/cx,ax/) $0="	xchg	ax,bx"
   8.225  		if (/ax,word ptr \[si\+28\]/ && isotazboot == 500) next
   8.226 @@ -235,7 +336,19 @@
   8.227  		if (/push/ || /pop/ || /bp,sp/ || /si,/) next
   8.228  		sub(/\[si/,"[di")
   8.229  		if (/initrd_info/) isotazboot=500
   8.230 -		if (/endp/) isotazboot=0
   8.231 +		if (/bx\+6\]/) next
   8.232 +		if (/bx\+4\]/) sub(/mov	dx,/,"les	dx,d")
   8.233 +		sub(/di\+24\],ax/,"di+24],es")
   8.234 +		sub(/call/,"jmp")
   8.235 +		if (/ret/ || /pop/ || /^@1@86:/) next
   8.236 +		if (/_isostate\+14/) next
   8.237 +		if (/_isostate\+12/) {
   8.238 +			sub(/mov	ax,/,"les	ax,d")
   8.239 +			print
   8.240 +			print "	mov	dx,es"
   8.241 +			next
   8.242 +		}
   8.243 +		if (/ax,-4/) isotazboot++
   8.244  	}
   8.245  	if (/0x7FF0/) isotazboot=4
   8.246  	if (isotazboot == 4) { # TAZBOOT.LST
   8.247 @@ -266,6 +379,12 @@
   8.248  		}
   8.249  		if (/\[bp-4\],ax/) sub(/ax/,"bx")
   8.250  		if (/ax,word ptr \[bx\+2\]/ || /bx,ax/) next
   8.251 +		if (/_base_himem\+2,dx/) {
   8.252 +			print "	mov	bx,offset DGROUP:_base_himem+2"
   8.253 +		}
   8.254 +		sub(/DGROUP:_base_himem,/,"[bx-2],")
   8.255 +		sub(/DGROUP:_base_himem\+2,/,"[bx],")
   8.256 +		sub(/DGROUP:_base_himem\+3,/,"[bx+1],")
   8.257  		if (/@strcmp\$qpxzct1/) isotazboot=0
   8.258  	}
   8.259  	if (/static void addinitrd/) isotazboot=100
     9.1 --- a/syslinux/stuff/iso2exe/bootiso.S	Tue Jul 30 10:35:07 2019 +0200
     9.2 +++ b/syslinux/stuff/iso2exe/bootiso.S	Thu Aug 01 15:16:29 2019 +0200
     9.3 @@ -177,12 +177,10 @@
     9.4  	  movsb
     9.5  	ret
     9.6  	.org	0x7E00
     9.7 -
     9.8 -	.org	0x7F78
     9.9 +	.org	0x7F40
    9.10  ////////////////////////////// DOS EXE code ///////////////////////////////////
    9.11  
    9.12  exestart:
    9.13 -	cld
    9.14  	movw	129, %ax
    9.15  	cmpb	$0x2F, %al
    9.16  	je	ishelp
    9.17 @@ -223,6 +221,51 @@
    9.18  	//movb	$EXESTR(realmodemsg), %al
    9.19  isvm86:
    9.20  	call	goputs
    9.21 +//----------
    9.22 +	pushw	%di
    9.23 +//------------- insert argv[0] in cmdline -----------------------
    9.24 +	xchgw	%ax,%dx			// %ax = 0
    9.25 +	movw	%ax,%di
    9.26 +	movw	0x2C(%di),%es
    9.27 +	movw	%sp,%cx			// big enough
    9.28 +scalp:
    9.29 +	repne
    9.30 +	  scasb
    9.31 +	scasb
    9.32 +	jne	scalp
    9.33 +	incw	%di
    9.34 +	movw	%di,%bx
    9.35 +	incw	%di
    9.36 +	pushw	%di			// %es:%di = programme pathname
    9.37 +	repne
    9.38 +	  scasb
    9.39 +	subw	%di,%bx
    9.40 +	negw	%bx
    9.41 +	movw	$128,%si
    9.42 +	addw	%bx,(%si)
    9.43 +	lodsb	
    9.44 +	xchgw	%ax,%cx
    9.45 +	incw	%cx
    9.46 +	pushw	%si
    9.47 +p2lp:
    9.48 +	lodsb
    9.49 +	movb	%al,-2(%bx,%si)
    9.50 +	loop	p2lp
    9.51 +	popw	%si
    9.52 +	popw	%bx
    9.53 +	movb	$0x20,%al
    9.54 +p1lp:
    9.55 +	movb	%al,(%si)
    9.56 +	incw	%si
    9.57 +	movb	%es:(%bx),%al
    9.58 +	incw	%bx
    9.59 +	cmpw	%bx,%di
    9.60 +	ja	p1lp
    9.61 +//----------
    9.62 +	popw	%di
    9.63 +	pushw	%cs
    9.64 +	popw	%es
    9.65 +//----------
    9.66  	movw	comstart-end_header(%di), %si		// .com address
    9.67  	pushw	%di
    9.68  	movb	$0x7C/2, %ch		// 31K-31.5K, > com length
    9.69 @@ -242,17 +285,13 @@
    9.70  	.ascii	"real"			// real mode
    9.71  // --------------- Must be in 7FC0 7FFF range ------------------------
    9.72  mode:
    9.73 -	.ascii	" m"
    9.74 -ode:
    9.75 -	.ascii	"ode"
    9.76 +	.ascii	" mode"
    9.77  	.byte	EXESTR(eol)
    9.78  noDOS3:
    9.79 -	.ascii	"DOS3"			// DOS3?
    9.80 -need:
    9.81 -	.ascii	"?"
    9.82 +	.ascii	"DOS3?"			// DOS3?
    9.83  	.byte	EXESTR(eol)
    9.84  help:
    9.85 -	.ascii	"SliTaz iso boot."	// SliTaz iso boot.
    9.86 +	.ascii	"SliTaz iso boot"	// SliTaz iso boot
    9.87  eol:
    9.88  	.ascii	"\r\n"
    9.89  	.byte	1			// puts will return
    10.1 --- a/syslinux/stuff/iso2exe/init	Tue Jul 30 10:35:07 2019 +0200
    10.2 +++ b/syslinux/stuff/iso2exe/init	Thu Aug 01 15:16:29 2019 +0200
    10.3 @@ -1077,6 +1077,8 @@
    10.4  		[ -s /tmp/initrd ] && uncpio /tmp/initrd
    10.5  	fi
    10.6  	dosync
    10.7 +	sed -i 's/ || exit//' /init
    10.8 +	[ -s /etc/inittab ] || rm -rf /etc
    10.9  	exec ${init:-/init} $cmdline
   10.10  }
   10.11  
    11.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Tue Jul 30 10:35:07 2019 +0200
    11.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Thu Aug 01 15:16:29 2019 +0200
    11.3 @@ -309,6 +309,9 @@
    11.4  	find $TMP -print0 | xargs -0 touch -t 197001010100.00
    11.5  	( cd $TMP; find dev init.exe | cpio -o -H newc ) | compress > rootfs.gz
    11.6  	rm -rf $TMP
    11.7 +	chmod 644 ${@/init/rootfs.gz}
    11.8 +	chown root.root ${@/init/rootfs.gz}
    11.9 +	touch -t 197001010100.00 ${@/init/rootfs.gz}
   11.10  	ls -l $@ rootfs.gz
   11.11  	cp $0 $0.$$
   11.12  	cat >> $0.$$ <<EOM