wok-6.x rev 22181
linld: check memory size for vcpi
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Nov 10 11:45:54 2019 +0100 (2019-11-10) |
parents | ee7d4644eb13 |
children | 8e65b867668e |
files | linld/stuff/src/A20.ASM linld/stuff/src/pipehole.awk |
line diff
1.1 --- a/linld/stuff/src/A20.ASM Sat Nov 09 17:39:43 2019 +0100 1.2 +++ b/linld/stuff/src/A20.ASM Sun Nov 10 11:45:54 2019 +0100 1.3 @@ -99,14 +99,7 @@ 1.4 global @moverm$qp11image_himem:near 1.5 @moverm$qp11image_himem: 1.6 push si di 1.7 - extrn _pm_high:byte 1.8 - mov si,offset _pm_high 1.9 - ifdef MOVE_SETUP 1.10 - mov di,8000h 1.11 - sub di,[bx-4] ; rm size 1.12 - extrn _rm_offset:word 1.13 - mov [_rm_offset],di 1.14 - endif 1.15 + xor di,di 1.16 extrn _heap_top:word 1.17 ifdef NO386 1.18 mov ax,[_heap_top] 1.19 @@ -115,7 +108,8 @@ 1.20 mov dx,cs 1.21 add dx,ax 1.22 mov cx,0fffh 1.23 - test [byte si],cl 1.24 + extrn _pm_high:byte 1.25 + test [_pm_high],cl 1.26 jne @bzimage 1.27 xchg ax,dx 1.28 cmp ax,cx 1.29 @@ -130,7 +124,11 @@ 1.30 add ax,[word ((image_himem bx).size)] 1.31 adc dx,[word ((image_himem bx).size)+2] 1.32 ifdef MOVE_SETUP 1.33 - sub ax,di ; -rm_offset 1.34 + mov di,8000h 1.35 + sub di,[bx-4] ; rm size 1.36 + extrn _rm_offset:word 1.37 + mov [_rm_offset],di 1.38 + sub ax,di ; -rm_offset 1.39 sbb dx,cx 1.40 endif 1.41 mov cl,12 1.42 @@ -147,7 +145,8 @@ 1.43 mov dx,cs 1.44 add ax,dx 1.45 mov cx,0fffh 1.46 - test [byte si],cl 1.47 + extrn _pm_high:byte 1.48 + test [_pm_high],cl 1.49 jne @bzimage 1.50 cmp ax,cx 1.51 jae @sys@ok 1.52 @@ -158,16 +157,20 @@ 1.53 mov [(image_himem bx).fallback],eax 1.54 add eax,[(image_himem bx).size] 1.55 ifdef MOVE_SETUP 1.56 + mov di,8000h 1.57 + sub di,[bx-4] ; rm size 1.58 extrn _rm_offset:word 1.59 - movzx ecx,di ; -rm_offset 1.60 + mov [_rm_offset],di 1.61 + movzx ecx,di ; -rm_offset 1.62 sub eax,ecx 1.63 endif 1.64 shl eax,4 1.65 + mov ch,0 1.66 @bzimage: 1.67 xchg ax,dx 1.68 mov ax,9000h 1.69 endif 1.70 - mov es,ax 1.71 + add dh,ch ; room for malloc_bufv_or_die 1.72 cmp dx,ax 1.73 jb @nooverflow 1.74 @overflow: 1.75 @@ -175,14 +178,9 @@ 1.76 mov bx,offset overflow 1.77 call near die 1.78 @nooverflow: 1.79 - ifdef MOVE_SETUP 1.80 - cmp [si],al 1.81 - je @@do_move 1.82 - endif 1.83 - xor di,di 1.84 -@@do_move: 1.85 - mov si,[bx-2] ; rm data 1.86 - mov cx,[bx-4] ; rm size 1.87 + les cx,[bx-4] ; rm size 1.88 + mov si,es ; rm data 1.89 + mov es,ax 1.90 @@move_clear: 1.91 movsb 1.92 mov [byte si-1],al
2.1 --- a/linld/stuff/src/pipehole.awk Sat Nov 09 17:39:43 2019 +0100 2.2 +++ b/linld/stuff/src/pipehole.awk Sun Nov 10 11:45:54 2019 +0100 2.3 @@ -124,9 +124,8 @@ 2.4 } 2.5 if (/cmd_line_ptr =/ && is386 == 0) isload=7 2.6 if (isload == 7) { # LOAD.LST 2.7 - if (/add/ || /xor/ || /extrn/ || /N_LXLSH@/ || /cl,4/) next 2.8 + if (/add/ || /xor/ || /extrn/ || /N_LXLSH@/ || /cl,4/ || /,ax/) next 2.9 if (/enable A20 if needed/) { print nextinst; isload=0 } 2.10 - if (/,ax/) $0=" mov bx,55" 2.11 if (/i-463/) $0=" mov bx,-463" 2.12 if (/i-465/) { 2.13 sub(/465/,"2"); sub(/\[/,"[bx+") 2.14 @@ -135,6 +134,7 @@ 2.15 if (/,dx/) { 2.16 print " mov cl,12" 2.17 print " shr ax,cl" 2.18 + print " mov bx,55" 2.19 sub(/dx/,"ax") 2.20 } 2.21 } 2.22 @@ -170,6 +170,13 @@ 2.23 } 2.24 sub(/,ax/,",es") 2.25 if (/,dx/) isload=0 2.26 + if (/add ax,word ptr/) $0=" add ax,cx" 2.27 + if (/i\+29\],0/) { 2.28 + sub(/,0$/,"") 2.29 + sub(/cmp /,"mov cx,") 2.30 + } 2.31 + sub(/je/,"jcxz") 2.32 + if (/@strcpy/) isload=0 2.33 } 2.34 if (/void load_initrd\(\)/) isload=3 2.35 if (isload == 3) { # LOAD.LST