wok diff linld/stuff/src/pipehole.awk @ rev 21735

vlgothic-fonts: use archive.org as web_site
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Jun 13 15:52:10 2019 +0200 (2019-06-13)
parents 861efbf7a5de
children f9e283da869a
line diff
     1.1 --- a/linld/stuff/src/pipehole.awk	Wed Jun 12 18:55:55 2019 +0200
     1.2 +++ b/linld/stuff/src/pipehole.awk	Thu Jun 13 15:52:10 2019 +0200
     1.3 @@ -1,4 +1,4 @@
     1.4 -BEGIN { hold=0; is386=0; isload=0; wascall=0 }
     1.5 +BEGIN { hold=0; is386=0; isload=0; isiso=0; wascall=0 }
     1.6  function isnum(n) { return match(n,/^[0-9+-]/) }
     1.7  {
     1.8  	sub(/segment word public/,"segment byte public")
     1.9 @@ -14,16 +14,42 @@
    1.10  		if (/ax,word ptr/) next
    1.11  		if (/^	call/) isload=0
    1.12  	}
    1.13 -	if (/const char \*n = name, \*i = x->filename;/) isiso=1
    1.14 -	if (isiso) { # ISO9660.LST
    1.15 -		if ((/mov	word ptr \[bp-6\],ax/ ) ||
    1.16 -		    (/mov	ax,word ptr \[bp-2\]/) ||
    1.17 -		    (/bx,word ptr \[bp-6\]/) || (/ax,dx/)) next
    1.18 +	if (/x->curdirsize == 0xFFFF/) isiso=4
    1.19 +	if (isiso == 4) { # ISO9660.LST
    1.20 +		if (/DGROUP:_isostate\+14,-1/) {
    1.21 +			sub(/DGROUP:_isostate\+14/,"[si+14]")
    1.22 +			isiso=0
    1.23 +		}
    1.24 +	}
    1.25 +	if (/c = \*s;/) isiso=3
    1.26 +	if (isiso == 3) { # ISO9660.LST
    1.27 +		if (/al,byte ptr/) {
    1.28 +			print "	mov	al,0"
    1.29 +			sub(/mov/,"xchg")
    1.30 +		}
    1.31 +		if (/byte ptr \[di\],0/) {
    1.32 +			isiso=0
    1.33 +			next
    1.34 +		}
    1.35 +	}
    1.36 +	if (/endname = NULL/) isiso=2
    1.37 +	if (isiso == 2) { # ISO9660.LST
    1.38 +		if (/mov	bx,cx/) next
    1.39 +		gsub(/cx/,"bx")
    1.40 +	}
    1.41 +	if (/const char \*n = name/) isiso=1
    1.42 +	if (isiso == 1) { # ISO9660.LST
    1.43 +		if ((/mov	word ptr \[si\+32\],ax/ ) ||
    1.44 +		    (/mov	ax,word ptr \[si\+28\]/) ||
    1.45 +		    (/bx,word ptr \[si\+32\]/) || (/ax,dx/)) next
    1.46  		if (/dx,/) sub(/dx/,"ax")
    1.47 -		if ((/sub	ax,word ptr \[bp-2\]/) ||
    1.48 -		    (/\[di\+12\]/) || (/ax,si/)) sub(/ax/,"bx")
    1.49 -		if (/add	word ptr \[bp-6\],ax/) $0="	add	bx,word ptr [di+12]"
    1.50 -		if (/@strcmp\$qpxzct1/) isiso=0
    1.51 +		if ((/sub	ax,word ptr \[si\+28\]/) ||
    1.52 +		    (/\[si\+12\]/) || (/ax,di/)) sub(/ax/,"bx")
    1.53 +		if (/add	word ptr \[si\+32\],ax/) $0="	add	bx,word ptr [si+12]"
    1.54 +		if (/al,/ || /,al/) sub(/al/,"cl")
    1.55 +		if (/cmp	byte ptr \[si\+30\],0/) $0="	or	cl,cl"
    1.56 +		if (/jne	@@0$/) next
    1.57 +		if (/jmp	@3@58$/) $0="	je	@3@58"
    1.58  	}
    1.59  	if (wascall) {
    1.60  		if (rcall != "") {