wok rev 19900

linld/tazboot: memcpy32 bug workaround
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Apr 08 18:04:44 2017 +0200 (2017-04-08)
parents 9e8f9b54bd83
children 294c02abfd9f
files linld/stuff/src/COMMON.H linld/stuff/src/JUMP.ASM linld/stuff/src/LOAD.CPP linld/stuff/src/MEMCPY32.ASM
line diff
     1.1 --- a/linld/stuff/src/COMMON.H	Sat Apr 08 12:48:12 2017 +0200
     1.2 +++ b/linld/stuff/src/COMMON.H	Sat Apr 08 18:04:44 2017 +0200
     1.3 @@ -78,7 +78,7 @@
     1.4  // External asm helpers
     1.5  extern "C" void memcpy32(u32, u16,u32, u32);
     1.6  extern "C" void rmcpy();
     1.7 -extern "C" void set_sregs_jump_seg_ofs(u32 csip);
     1.8 +extern "C" void set_sregs_jump_seg_ofs();
     1.9  extern "C" void xmm_alloc(struct image_himem *m);
    1.10  extern u32 topmem;
    1.11  extern "C" u32 memtopz();
     2.1 --- a/linld/stuff/src/JUMP.ASM	Sat Apr 08 12:48:12 2017 +0200
     2.2 +++ b/linld/stuff/src/JUMP.ASM	Sat Apr 08 18:04:44 2017 +0200
     2.3 @@ -32,7 +32,6 @@
     2.4  
     2.5  		extrn	dos_shutdown:near
     2.6  
     2.7 -		pop	ax			; caller return address
     2.8  		ifdef	NO386
     2.9  		extrn	_topseg:near
    2.10  		call	near _topseg
    2.11 @@ -42,13 +41,12 @@
    2.12  		push	9000h
    2.13  		pop	es
    2.14  		endif
    2.15 -		pop	dx			; ip
    2.16 -		pop	cx			; cs
    2.17  		cli				; we start doing destructive things to DOS
    2.18  		push	es
    2.19  		pop	ss
    2.20  		mov	sp,0A000h
    2.21 -		push	cx dx
    2.22 +		extrn	_csip:dword
    2.23 +		push	[dword _csip]
    2.24  		extrn	_rm_size:word
    2.25  		mov	si,offset _rm_size	; _rm_size, _pm_high, _rm_buf
    2.26  		lodsw
    2.27 @@ -103,7 +101,7 @@
    2.28  		pop	bx
    2.29  		; move zImage pm
    2.30  		mov	ax,8
    2.31 -		cwd
    2.32 +		cwd				; clear dx
    2.33  		cmp	bx,ax
    2.34  		ja	bufhigh
    2.35  		sub	ax,bx
     3.1 --- a/linld/stuff/src/LOAD.CPP	Sat Apr 08 12:48:12 2017 +0200
     3.2 +++ b/linld/stuff/src/LOAD.CPP	Sat Apr 08 18:04:44 2017 +0200
     3.3 @@ -118,10 +118,10 @@
     3.4  
     3.5  // register value to launch the kernel real mode code
     3.6  #ifdef NO386
     3.7 -static u32 csip;
     3.8 +u32 csip;
     3.9  extern "C" u16 topseg();
    3.10  #else
    3.11 -static u32 csip=0x90200000;
    3.12 +u32 csip=0x90200000;
    3.13  #define topseg() 0x9000
    3.14  #endif
    3.15  
    3.16 @@ -277,5 +277,5 @@
    3.17      }
    3.18  
    3.19      // Move rm loader & commandline to 0x90000, Jump to kernel rm code
    3.20 -    set_sregs_jump_seg_ofs(csip);
    3.21 +    set_sregs_jump_seg_ofs();
    3.22  }
     4.1 --- a/linld/stuff/src/MEMCPY32.ASM	Sat Apr 08 12:48:12 2017 +0200
     4.2 +++ b/linld/stuff/src/MEMCPY32.ASM	Sat Apr 08 18:04:44 2017 +0200
     4.3 @@ -39,15 +39,17 @@
     4.4  		push	ss
     4.5  		push	ax
     4.6  		pop	[dword cs:sssp]
     4.7 +		mov	[word bx+4],offset step19
     4.8  		else
     4.9 +		mov	ax,offset step19
    4.10 +		xchg	ax,[word bx+4]
    4.11  		push	[word bx+6]	
    4.12 -		push	[word bx+4]		; save step
    4.13 +		push	ax			; save step
    4.14  		mov	[word cs:sssp],sp
    4.15  		mov	[word cs:sssp+2],ss
    4.16  		endif
    4.17  		;cmp	[byte bx+7],0F0h
    4.18  		;jnc	notdos
    4.19 -		mov	[word bx+4],offset step19
    4.20  		mov	[bx+6],cs
    4.21  		pushf
    4.22  		pop	ax
    4.23 @@ -72,10 +74,10 @@
    4.24  		ifndef	NO386
    4.25  		lss	sp,[dword cs:sssp]
    4.26  		else
    4.27 -		lds	bx,[dword cs:sssp]
    4.28 +		lds	ax,[dword cs:sssp]
    4.29  		push	ds
    4.30  		pop	ss
    4.31 -		mov	sp,bx
    4.32 +		xchg	ax,sp
    4.33  		endif
    4.34  		xor	bx,bx
    4.35  		mov	ds,bx
    4.36 @@ -118,7 +120,8 @@
    4.37  
    4.38  ;****** Init ***************************************************
    4.39  
    4.40 -			ifndef	NO386
    4.41 +			ifndef	FIXME_NO386
    4.42 +                p386
    4.43  
    4.44  		enter	TEMP_SIZE,0
    4.45  		;cld