# HG changeset patch # User Pascal Bellard # Date 1540275949 -7200 # Node ID f5088c165f51d87fe0bfd6e7a3eb3ef3eda4b4aa # Parent 81a3d87e09650d6d96f4e7bf88242fd8db8ef153 linld: fix memcpy32 (16 low mem case) diff -r 81a3d87e0965 -r f5088c165f51 linld/stuff/src/CRTL.ASM --- a/linld/stuff/src/CRTL.ASM Sun Oct 21 17:30:30 2018 +0200 +++ b/linld/stuff/src/CRTL.ASM Tue Oct 23 08:25:49 2018 +0200 @@ -482,8 +482,8 @@ xor eax,eax else xor ax,ax + cwd endif - cwd mov [(image_himem di).fd],ax mov bx,[(image_himem di).state] cmp al,[bx] ; "" @@ -501,7 +501,7 @@ mov [(image_himem di).state],cx dec si push [word si] - mov [byte si],dl ; set temp eos + mov [byte si],ah ; set temp eos call open pop [word si] ; restore string jc @@die @@ -861,26 +861,19 @@ global _open_image:near proc _open_image near - pop ax ;caller return address + pop cx ;caller return address pop bx ; name - pop cx ; m + pop ax ; m + push ax + push bx push cx - push bx - push ax push di - mov di,cx - ifndef NO386 - xor eax,eax ; 1st loop flag + eos - else - xor ax,ax ; 1st loop flag + eos - endif + xchg ax,di mov [(image_himem di).next_chunk],offset next_chunk mov [(image_himem di).state],bx push bx @@next: - push di call [(image_himem di).next_chunk] ; m->next_chunk() - pop di ifndef NO386 add eax,3 and al,0FCh @@ -984,9 +977,7 @@ sub [word sz],ax pushf jcxz @@same_chunk - push di call [(image_himem di).next_chunk] - pop di @@same_chunk: popf jnz @@loop diff -r 81a3d87e0965 -r f5088c165f51 linld/stuff/src/JUMP.ASM --- a/linld/stuff/src/JUMP.ASM Sun Oct 21 17:30:30 2018 +0200 +++ b/linld/stuff/src/JUMP.ASM Tue Oct 23 08:25:49 2018 +0200 @@ -143,31 +143,30 @@ mov ch,10h ; 4k rep movsb - cmp al,cl ; load high ? - pushf ifdef NO386 add bh,9 push bx ; topseg()+0x0900 else push 9800h+(4096/16) ; 4096 bytes for cmdline endif + cmp al,cl ; load high ? + pushf ; finish loading extrn @last_ditch$qv:near call @last_ditch$qv + dos_shutdown ; clear di; ds=0 + push cs + pop ds + popf ; self move ;cld pop es ; min 2048 bytes for stack + jne @@isbzimage mov cx,offset movedend xor si,si ; A000 -9000 -0800(>movedend) - xor di,di ; set ZF rep movsb - push es - dos_shutdown ; clear di; ds=0 - pop es - popf - jne @@isbzimage - mov ax,[word cs:_imgs+2+2] ; get pm->fallback high word + mov ax,[word _imgs+2+2] ; get pm->fallback high word push es call near @@isbzimage ; pop cs ; ds=es=ss @@ -186,6 +185,7 @@ ;or al,80h ; disable NMI ;out 70h,al + xor di,di push di ; src ofs lo push di ; src seg=0 ifdef NO386 diff -r 81a3d87e0965 -r f5088c165f51 linld/stuff/src/LOAD.CPP --- a/linld/stuff/src/LOAD.CPP Sun Oct 21 17:30:30 2018 +0200 +++ b/linld/stuff/src/LOAD.CPP Tue Oct 23 08:25:49 2018 +0200 @@ -178,7 +178,7 @@ if(vid_mode) kernelparams->vid_mode = vid_mode; if(root_dev) kernelparams->root_dev = root_dev; - version_string = 0; + version_string = ""; #if 1 if(kernelparams->header == HdrS) { // starting linux 1.3.73 diff -r 81a3d87e0965 -r f5088c165f51 linld/stuff/src/MEMCPY32.ASM --- a/linld/stuff/src/MEMCPY32.ASM Sun Oct 21 17:30:30 2018 +0200 +++ b/linld/stuff/src/MEMCPY32.ASM Tue Oct 23 08:25:49 2018 +0200 @@ -123,7 +123,7 @@ inc cx sub [word sz],cx rep movsb - ja @@movlp + jae @@movlp dec [word sz+2] jns @@movlp ; mov 1-16 more bytes... pop di diff -r 81a3d87e0965 -r f5088c165f51 linld/stuff/src/pipehole.awk --- a/linld/stuff/src/pipehole.awk Sun Oct 21 17:30:30 2018 +0200 +++ b/linld/stuff/src/pipehole.awk Tue Oct 23 08:25:49 2018 +0200 @@ -65,7 +65,9 @@ } s=$0 # These optimisation may break ZF or CF - if (/^ add sp,4/) { print " pop cx"; print " pop cx"; next } + if (/^ sub sp,2$/) { print " push ax"; next } + if (/^ sub sp,4$/) { print " push ax"; print " push ax"; next } + if (/^ add sp,4$/) { print " pop cx"; print " pop cx"; next } if (/^ mov d*word ptr .*,0$/ || /^ mov dword ptr .*,large 0$/) { sub(/mov/,"and",s); print s; next # slower }