wok diff linld/stuff/src/pipehole.awk @ rev 21784
Update powermanga (thanks Rene Rivero)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Jul 21 10:32:10 2019 +0200 (2019-07-21) |
parents | d8f824013cf6 |
children | 04ffefac5707 |
line diff
1.1 --- a/linld/stuff/src/pipehole.awk Wed Jun 26 17:24:54 2019 +0200 1.2 +++ b/linld/stuff/src/pipehole.awk Sun Jul 21 10:32:10 2019 +0200 1.3 @@ -6,6 +6,11 @@ 1.4 if (/^@.*:$/ || / endp$/) afterjmp=0 1.5 if (/dword ptr/) is386=1 1.6 sub(/DGROUP:_imgs\+65534/,"[di-2]") 1.7 + if (/fallback\)\[1\] == 0/) isload=8 1.8 + if (isload == 8) { # LOAD.LST 1.9 + if (/load_image/) isload=0 1.10 + else next 1.11 + } 1.12 if (/cmd_line_ptr =/ && is386 == 0) isload=7 1.13 if (isload == 7) { # LOAD.LST 1.14 if (/add/ || /xor/ || /extrn/ || /N_LXLSH@/ || /cl,4/) next 1.15 @@ -55,7 +60,13 @@ 1.16 } 1.17 if (/dx,dx/) next 1.18 sub(/ax,dx/,"ax,bx") 1.19 - if (/call/) isload=400 1.20 + if (/call/) { 1.21 + print " cmp ax,0fffh" 1.22 + print " jae @sys@ok" 1.23 + print " mov ax,0fffh" 1.24 + print "@sys@ok:" 1.25 + isload=400 1.26 + } 1.27 } 1.28 if (isload == 400 && /,0/) { 1.29 sub(/,0/,",dh") 1.30 @@ -64,6 +75,13 @@ 1.31 if (isload == 4 && is386) { # LOAD.LST 1.32 sub(/dx,cs/,"edx,cs") 1.33 sub(/eax/,"edx") 1.34 + if (/shl/) { 1.35 + print " mov ax,0fffh" 1.36 + print " cmp dx,ax" 1.37 + print " jae @sys@ok" 1.38 + print " xchg ax,dx" 1.39 + print "@sys@ok:" 1.40 + } 1.41 sub(/ax,9/,"dx,9") 1.42 if (/,0$/) sub(/,0/,",dh") 1.43 if (/movzx/) next