wok rev 22179

linld: spare up to 30k more for zImage (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Nov 09 13:26:32 2019 +0100 (10 days ago)
parents bba007560f28
children ee7d4644eb13
files linld/stuff/src/!COMPILEX.BAT linld/stuff/src/A20.ASM linld/stuff/src/COMMON.H linld/stuff/src/JUMP.ASM linld/stuff/src/LOAD.CPP linld/stuff/src/_BEG.ASM linld/stuff/src/pipehole.awk
line diff
     1.1 --- a/linld/stuff/src/!COMPILEX.BAT	Sat Nov 09 11:39:06 2019 +0100
     1.2 +++ b/linld/stuff/src/!COMPILEX.BAT	Sat Nov 09 13:26:32 2019 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4  path ..\BC31;..;%PATH%
     1.5  call !clean.bat
     1.6 -bcc @bccopt.opt -S -mt -DLARGE_IMAGES *.cpp > cpp.log
     1.7 +bcc @bccopt.opt -S -mt -DMOVE_SETUP -DLARGE_IMAGES *.cpp > cpp.log
     1.8  ren TAZBOOT.ASM TAZBOOT.ASO
     1.9  ren LOAD.ASM LOAD.ASO
    1.10  ren HIMEM.ASM HIMEM.ASO
    1.11 @@ -9,5 +9,5 @@
    1.12  mawk -f pipehole.awk LOAD.ASO > LOAD.ASM
    1.13  mawk -f pipehole.awk HIMEM.ASO > HIMEM.ASM
    1.14  mawk -f pipehole.awk ISO9660.ASO > ISO9660.ASM
    1.15 -tasm /la /m /dEXTRA /dNO386 /dLARGE_IMAGES /dLONG_FILENAME *.asm > asm.log
    1.16 +tasm /la /m /dMOVE_SETUP /dEXTRA /dNO386 /dLARGE_IMAGES /dLONG_FILENAME *.asm > asm.log
    1.17  tlink /m /s /t @linkx.cmd > lnk.log
     2.1 --- a/linld/stuff/src/A20.ASM	Sat Nov 09 11:39:06 2019 +0100
     2.2 +++ b/linld/stuff/src/A20.ASM	Sat Nov 09 13:26:32 2019 +0100
     2.3 @@ -122,7 +122,7 @@
     2.4  		mov	bx,offset overflow
     2.5  		call	near die
     2.6  @@nooverflow:
     2.7 -		mov	cx,[bx-5]	; size
     2.8 +		mov	cx,[bx-4]	; size
     2.9  		mov	si,[bx-2]	; data
    2.10  		xor	di,di
    2.11  		ifdef	MOVE_SETUP
     3.1 --- a/linld/stuff/src/COMMON.H	Sat Nov 09 11:39:06 2019 +0100
     3.2 +++ b/linld/stuff/src/COMMON.H	Sat Nov 09 13:26:32 2019 +0100
     3.3 @@ -54,6 +54,7 @@
     3.4  #define initrd (imgs[1])
     3.5  #define pm2initrd(p) (p+1)
     3.6  
     3.7 +extern u8 pm_high;
     3.8  extern int skip_alloc;
     3.9  extern u32 base_himem;
    3.10  extern u32 far *initrd_desc;
     4.1 --- a/linld/stuff/src/JUMP.ASM	Sat Nov 09 11:39:06 2019 +0100
     4.2 +++ b/linld/stuff/src/JUMP.ASM	Sat Nov 09 13:26:32 2019 +0100
     4.3 @@ -96,20 +96,15 @@
     4.4  		push	es
     4.5  		pop	ss
     4.6  		mov	sp,0A000h
     4.7 -		extrn	_rm_size:word
     4.8 +		extrn	_csip:dword
     4.9  		ifdef NO386
    4.10 -		mov	si,offset _rm_size-4	; _rm_size, _pm_high, _rm_buf
    4.11 +		mov	si,offset _csip
    4.12  		lodsw
    4.13 -		xchg	ax,bx
    4.14 -		lodsw
    4.15 -		push	ax			; _csip high
    4.16 -		push	bx			; _csip low
    4.17 -		lodsw				; skip _rm_size
    4.18 +		push	[word si]
    4.19 +		push	ax
    4.20  		else
    4.21 -		mov	si,offset _rm_size+2	; _rm_size, _pm_high, _rm_buf
    4.22 -		push	[dword si-6]		; _csip
    4.23 +		push	[dword _csip]
    4.24  		endif
    4.25 -		lodsb				; _pm_high
    4.26  
    4.27  		ifdef	NO386
    4.28  		mov	cx,ss
    4.29 @@ -126,7 +121,10 @@
    4.30  		rep
    4.31  		  movsb
    4.32  
    4.33 -		or	cl,al			; load high ?
    4.34 +		mov	cl,0			; load high ?
    4.35 +		org	$-1
    4.36 +		global	_pm_high:byte
    4.37 +_pm_high	db	?
    4.38  		inc	cx
    4.39  		push	cx
    4.40  		mov	ax,[word ss:024Ch]
    4.41 @@ -212,7 +210,11 @@
    4.42  		jne	@@notelks
    4.43  		xchg	ax,si
    4.44  		endif
    4.45 +		ifdef	MOVE_SETUP
    4.46 +		mov	ch,1h		; DS=ES=SS=0100
    4.47 +		else
    4.48  		mov	cx,100h		; DS=ES=SS=0100
    4.49 +		endif
    4.50  		mov	ss,cx
    4.51  		mov	es,cx
    4.52  		mov	cl,20h		; CS=0120
     5.1 --- a/linld/stuff/src/LOAD.CPP	Sat Nov 09 11:39:06 2019 +0100
     5.2 +++ b/linld/stuff/src/LOAD.CPP	Sat Nov 09 13:26:32 2019 +0100
     5.3 @@ -112,15 +112,14 @@
     5.4  const u32 HdrS = 'H' + ('d'<<8) + (u32('r')<<16) + (u32('S')<<24);
     5.5  
     5.6  // register value to launch the kernel real mode code
     5.7 -static u32 csip;
     5.8 +u32 csip;
     5.9  #ifdef NO386
    5.10  extern "C" u16 topseg();
    5.11  #else
    5.12  #define topseg() 0x9000
    5.13  #endif
    5.14 -u16 rm_size;
    5.15 -u8 pm_high;		// @ = @rm_size + 2, see JUMP.ASM
    5.16 -static u8* rm_buf;	// @ = @rm_size + 3, see JUMP.ASM
    5.17 +static u16 rm_size;
    5.18 +static u8* rm_buf;	// @ = @rm_size + 2, see A20.ASM
    5.19  struct image_himem imgs[2];
    5.20  
    5.21  static const char kernel_file_error[] = "Can't use kernel file";
    5.22 @@ -128,9 +127,8 @@
    5.23  
    5.24      struct	image_himem *m = &pm;
    5.25  #define _rm_buf(m)	(((u8**)(m))[-1])
    5.26 -#define _pm_high	(((u8*)(m))[-3])
    5.27 -#define _rm_size	(*(u16*)((u8*)(m)-5))
    5.28 -#define _csip		(*(u32*)((u8*)(m)-9))
    5.29 +#define _rm_size	(((u16*)(m))[-2])
    5.30 +#define _csip		(((u32*)(m))[-2])
    5.31    {
    5.32      struct kernelparams_t *kernelparams;
    5.33      kernelparams = &(((first1k_t*) (_rm_buf(m) = (u8 *)heap_top))->params);
    5.34 @@ -218,7 +216,7 @@
    5.35  #else
    5.36      if((u16)(((m->fallback=(u32(u16(_CS)+(u16(heap_top)>>4)+1)<<4))+m->size)>>16) >=
    5.37  #endif
    5.38 -		 (u16)(topseg()>>12) || _pm_high) {
    5.39 +		 (u16)(topseg()>>12) || pm_high) {
    5.40          m->fallback = base_himem;
    5.41      }
    5.42      if (((u16 *)&m->fallback)[1] == 0) {
     6.1 --- a/linld/stuff/src/_BEG.ASM	Sat Nov 09 11:39:06 2019 +0100
     6.2 +++ b/linld/stuff/src/_BEG.ASM	Sat Nov 09 13:26:32 2019 +0100
     6.3 @@ -54,7 +54,7 @@
     6.4  ; clear bss
     6.5  ;***************************************************************
     6.6  		mov	sp,offset stktop
     6.7 -		mov	si,offset _version_string
     6.8 +		mov	si,offset _bss_start
     6.9  		mov	bx, 0F000h	; cld ; cli & empty string
    6.10  clearbss:
    6.11  		mov	[si],bl		; clear bss + heap + sp
     7.1 --- a/linld/stuff/src/pipehole.awk	Sat Nov 09 11:39:06 2019 +0100
     7.2 +++ b/linld/stuff/src/pipehole.awk	Sat Nov 09 13:26:32 2019 +0100
     7.3 @@ -183,15 +183,16 @@
     7.4  			print	"	extrn	N_LXLSH@4:near"
     7.5  			sub(/N_LXLSH@/,"N_LXLSH@4")
     7.6  		}
     7.7 -		sub(/-3\],0/,"-3],dh")
     7.8 +		sub(/pm_high,0/,"pm_high,dh")
     7.9  		if (/_base_himem\+2/ || /pop/ || /push/) next
    7.10  		if (/_base_himem$/) {
    7.11 -			sub(/mov	dx,/,"les	dx,d")
    7.12 +			sub(/mov	dx,/,"les	ax,d")
    7.13  			isload++
    7.14  		}
    7.15  	}
    7.16  	if (isload == 401) {
    7.17  		sub(/,ax/,",es")
    7.18 +		sub(/,dx/,",ax")
    7.19  		if (/load_image/) isload=0
    7.20  	}
    7.21  	if (isload == 4 && is386) {  # LOAD.LST