wok rev 21751

tazboot: shrink (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jun 15 18:53:05 2019 +0200 (2019-06-15)
parents c19368210c2b
children 30270fe0d1b3
files linld/stuff/src/pipehole.awk
line diff
     1.1 --- a/linld/stuff/src/pipehole.awk	Sat Jun 15 16:18:19 2019 +0200
     1.2 +++ b/linld/stuff/src/pipehole.awk	Sat Jun 15 18:53:05 2019 +0200
     1.3 @@ -114,20 +114,35 @@
     1.4  		if (/bx,ax/) next
     1.5  		if (/@strcmp\$qpxzct1/) isotazboot=0
     1.6  	}
     1.7 -	if (/static void addinitrd/) isotazboot=1
     1.8 -	if (isotazboot == 1 || isotazboot == 100) { # TAZBOOT.LST
     1.9 -		if (/m->next_chunk = next_chunk/) isotazboot=100
    1.10 -		if (/load_initrd/) isotazboot=1
    1.11 -		if (/push	si/ && isotazboot == 1) next
    1.12 -		if (/pop	si/) next
    1.13 +	if (/static void addinitrd/) isotazboot=100
    1.14 +	if (isotazboot == 100) { # TAZBOOT.LST
    1.15 +		if (/cx,ax/) {
    1.16 +			print "	xchg	ax,si"
    1.17 +			print "	push	di"
    1.18 +			print "	mov	di,offset _isostate+4"
    1.19 +			print "	movsw"
    1.20 +			print "	movsw"
    1.21 +			print "	movsw"
    1.22 +			print "	movsw"
    1.23 +			$0="	pop	di"
    1.24 +		}
    1.25 +		if (/mov/ && !/si/ && !/cl/) next
    1.26 +		if (/initrd.size \+=/) isotazboot=101
    1.27 +	}
    1.28 +	if (isotazboot > 100) { # TAZBOOT.LST
    1.29 +		if (/m->next_chunk = next_chunk/) isotazboot=101
    1.30 +		if (/load_initrd/) isotazboot=102
    1.31 +		if (/push	si/ && isotazboot == 102) next
    1.32 +		if (/pop	si/ && isotazboot == 102) next
    1.33  		sub(/\[si\]/,"[bx]")
    1.34 +		sub(/push	si$/,"push	bx")
    1.35  		sub(/si,/,"bx,")
    1.36  		sub(/si\+/,"bx+")
    1.37  		if (/mov	cx,ax/) $0="	xchg	ax,bx"
    1.38  		if (/bx,cx/) next
    1.39  		sub(/cx/,"bx")
    1.40 -		sub(/DGROUP:_imgs\+38/,"[bx+38]")
    1.41 -		sub(/DGROUP:_imgs\+40/,"[bx+40]")
    1.42 +		sub(/DGROUP:_imgs\+38$/,"[bx+38-32]")
    1.43 +		sub(/DGROUP:_imgs\+40$/,"[bx+40-32]")
    1.44  		if (/static void bootiso/) isotazboot=0
    1.45  	}
    1.46  	if (wascall) {