wok rev 23991

syslinux: iso2exe/init loram case
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Dec 06 10:04:52 2020 +0000 (2020-12-06)
parents fb34bff6cff6
children 3d19917d3a03
files linld/stuff/src/pipehole.awk syslinux/stuff/iso2exe/init
line diff
     1.1 --- a/linld/stuff/src/pipehole.awk	Sat Dec 05 10:20:07 2020 +0000
     1.2 +++ b/linld/stuff/src/pipehole.awk	Sun Dec 06 10:04:52 2020 +0000
     1.3 @@ -66,17 +66,15 @@
     1.4  	if (ishimem == 1) {
     1.5  		if (/do \{/) ishimem=2
     1.6  		if (/byte ptr DGROUP:_vcpi,0/) print "	mov	bx,si"
     1.7 -		if (/bx,si/ || /push	bp/ || /bp,sp/ || /push	di/) next
     1.8 +		if (/bx,si/ || /push	bp/ || /bp,sp/ || /push	di/ || /push	si/) next
     1.9  		if (/sp,2/) next
    1.10  		if (/bp\+4/) {
    1.11 -			print "	global	load_imagez:near"
    1.12 -			print "load_imagez:"
    1.13  			$0="	xchg	ax,si"
    1.14  		}
    1.15  	}
    1.16  	if (ishimem == 2) {
    1.17  		if (/movzx/) print "	cwde"
    1.18 -		if (/bp-2/ || /pop	di/) next
    1.19 +		if (/bp-2/) next
    1.20  		if (/storepage.bufv/) {
    1.21  			print "	inc	ax"
    1.22  			print "	push	ax"
    1.23 @@ -95,16 +93,14 @@
    1.24  	if (isload == 14) {  # LOAD.LST
    1.25  		if (/call/) {
    1.26  			print	"	xchg	ax,di"
    1.27 -			print	"	pop	di"
    1.28 -			print	"	extrn	load_imagez"
    1.29  			$0="	jmp	short load_imagez"
    1.30  		}
    1.31  		if (/ret/) isload=0
    1.32  		if (/pop/ || /ret/ || /push/) next
    1.33  	}
    1.34  	if (isload == 13) {  # LOAD.LST
    1.35 -		sub(/push	/,"mov	ax,")
    1.36 -		if (/pop/) { isload=3; next }
    1.37 +		if (/pop/) isload=3
    1.38 +		if (/push/ || /call/ || /pop/) next 
    1.39  	}
    1.40  	if (/i\+21\],513$/) isload=11
    1.41  	if (isload == 12) {  # LOAD.LST
    1.42 @@ -156,17 +152,24 @@
    1.43  			sub(/dx/,"ax")
    1.44  		}
    1.45  	}
    1.46 -	if (/\[0\] = m-\>fallback/) isload=6
    1.47 +	if (/_version_string,0/) {
    1.48 +		print "	mov	ax,si"
    1.49 +		print "	push	di"
    1.50 +		isload=6
    1.51 +	}
    1.52  	if (isload == 6) {  # LOAD.LST
    1.53 -		if (/si\+2/) { print "	lodsw"; $0="	push	di" }
    1.54 +		if (/si\+2/) {
    1.55 +			print "	cmpsw"
    1.56 +			next
    1.57 +		}
    1.58  		if (/les/) sub(/bx,/,"di,")
    1.59 -		if (/bx\+4/ || /es:/) next
    1.60 +		if (/bx\+4/ || /es:/ || /call/ || /pop/ || /ret/) next
    1.61  		if (/si\+6/) {
    1.62  			print "	movsw"
    1.63  			print "	movsw"
    1.64  			print "	movsw"
    1.65  			print "	movsw"
    1.66 -			print "	pop	di"
    1.67 +			print "load_imagez:"
    1.68  			next
    1.69  		}
    1.70  	}
    1.71 @@ -193,14 +196,15 @@
    1.72  	}
    1.73  	if (/void load_initrd\(\)/) isload=3
    1.74  	if (isload == 3) {  # LOAD.LST
    1.75 -		if(/jmp/) next
    1.76 +		if (/short @2@198/) sub(/@2@198/,"load_initrd_ret")
    1.77 +		if( /jmp/) {
    1.78 +			print "load_initrd_ret:"
    1.79 +			print "	pop	si"
    1.80 +			print "	ret"
    1.81 +			next
    1.82 +		}
    1.83  		sub(/\[di/,"[bx")
    1.84  		sub(/\di,/,"bx,")
    1.85 -		if (/@puts\$qpxzc/) {
    1.86 -			if (hold == 3) { print s; hold=0 }
    1.87 -			print "	pop	si"
    1.88 -			sub(/call/,"jmp")
    1.89 -		}
    1.90  	}
    1.91  	if (/vid_mode = vid_mode/) isload=2
    1.92  	if (isload == 2) {  # LOAD.LST
     2.1 --- a/syslinux/stuff/iso2exe/init	Sat Dec 05 10:20:07 2020 +0000
     2.2 +++ b/syslinux/stuff/iso2exe/init	Sun Dec 06 10:04:52 2020 +0000
     2.3 @@ -123,6 +123,7 @@
     2.4  xhascustomconf=false
     2.5  text()
     2.6  {
     2.7 +	[ -d /etc/skel ] || $uncpio $(ls -r $media/boot/rootfs?*.* | sed q)
     2.8  	init=
     2.9  	cmdline="$(cat /proc/cmdline)"
    2.10  	if $xhascustomconf 2> /dev/null; then