wok rev 22203

linld: 8086 may load zImage (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Nov 11 12:01:54 2019 +0100 (2019-11-11)
parents a849a763afb1
children f0896fb1b287
files linld/stuff/src/A20.ASM linld/stuff/src/CRTL.ASM linld/stuff/src/_BEG.ASM
line diff
     1.1 --- a/linld/stuff/src/A20.ASM	Mon Nov 11 11:31:48 2019 +0100
     1.2 +++ b/linld/stuff/src/A20.ASM	Mon Nov 11 12:01:54 2019 +0100
     1.3 @@ -19,7 +19,7 @@
     1.4  msg_a20		db	"Can't use A20",0
     1.5  overflow	db	"Out of memory",0
     1.6  		ifdef	NO386
     1.7 -bzimage86	db	"No bzImage on 8086",0
     1.8 +bzimage86	db	"8086 & bzImage",0
     1.9  		endif
    1.10  	global	sssp:dword
    1.11  	global	_initrd_desc:dword
     2.1 --- a/linld/stuff/src/CRTL.ASM	Mon Nov 11 11:31:48 2019 +0100
     2.2 +++ b/linld/stuff/src/CRTL.ASM	Mon Nov 11 12:01:54 2019 +0100
     2.3 @@ -17,9 +17,6 @@
     2.4  
     2.5          segment _DATA byte public use16 'DATA'
     2.6  
     2.7 -		global	_heap_top
     2.8 -		extrn	_bss_end
     2.9 -_heap_top	dw	_bss_end
    2.10  msg_hang	db      "High mem corrupted - not exiting to DOS",0
    2.11  vcpi_alloc_err	db	"VCPI "
    2.12  msg_malloc      db      "malloc error",0
    2.13 @@ -478,6 +475,7 @@
    2.14  ;_fastcall char* malloc_or_die(ax:unsigned size);
    2.15  ;***************************************************************
    2.16  xchg_heap_top:
    2.17 +		extrn	_heap_top
    2.18  		xchg	ax,[_heap_top]
    2.19  		ret
    2.20  
     3.1 --- a/linld/stuff/src/_BEG.ASM	Mon Nov 11 11:31:48 2019 +0100
     3.2 +++ b/linld/stuff/src/_BEG.ASM	Mon Nov 11 12:01:54 2019 +0100
     3.3 @@ -130,20 +130,18 @@
     3.4  ; Check emm manager status and version
     3.5                  ;mov     ah,40h          ; get status
     3.6                  ;int     67h
     3.7 -                ;test    ah,ah
     3.8 -                ;jnz     no_vcpi
     3.9 +		;inc	ax
    3.10 +                ;js      no_vcpi
    3.11                  mov     ah,46h          ; get version
    3.12                  int     67h
    3.13 -                test    ah,ah
    3.14 -                jnz     no_vcpi
    3.15                  cmp     al,40h          ; version must be >= 4.0
    3.16 -                jb      no_vcpi
    3.17 +                jl      no_vcpi		; btw check ax.15
    3.18  ; Check vcpi manager status
    3.19                ;;mov     ax,5A01h        ; ALLOCATE RAW PAGES
    3.20                ;;mov     bx,4
    3.21                ;;int     67h
    3.22 -              ;;test    ah,ah
    3.23 -              ;;jnz     no_vcpi
    3.24 +              ;;inc    	ax
    3.25 +              ;;js      no_vcpi
    3.26                ;;push    dx              ;$ save handle
    3.27                  mov     ax,0DE00h       ; check for vcpi present
    3.28                  int     67h
    3.29 @@ -163,7 +161,6 @@
    3.30  		jnz	no_vcpi
    3.31  		extrn	_vcpi:byte
    3.32  		dec	[byte _vcpi]
    3.33 -no_vcpi:
    3.34  		endif
    3.35  endcpu386:
    3.36  		pushfd
    3.37 @@ -175,25 +172,33 @@
    3.38  		push	dx
    3.39  		popfd
    3.40  		pushfd
    3.41 -		pop	dx
    3.42 +		pop	dx		; dx.1=flags.1=1
    3.43  		pop	ax
    3.44  		xor	al,bl		; clear C
    3.45  		je	@@no_cpuid	; CPUID feature bit changed ?
    3.46  		mov	eax,80000001h	; Extended Processor Info and Feature Bits
    3.47  		cpuid
    3.48  		ifdef	NO386
    3.49 -		mov	dl,-1		; set 386 flag
    3.50 -		endif
    3.51 +		mov	dl,-1
    3.52 +		db	66h		; mov [_cpu_features],edx
    3.53 +@@no_cpuid:
    3.54 +		mov	[word _cpu_features],dx	; dl != 0
    3.55 +no_vcpi:
    3.56 +		else
    3.57  		mov	[_cpu_features],edx
    3.58  @@no_cpuid:
    3.59 +		endif
    3.60  endcpu86:
    3.61                  p8086
    3.62  
    3.63  ;***************************************************************
    3.64  ; build argv & argc
    3.65  ;***************************************************************
    3.66 -		extrn	_heap_top:word
    3.67 -		mov	di,[_heap_top]
    3.68 +		extrn	_bss_end:word
    3.69 +		mov	di,offset _bss_end
    3.70 +		global	_heap_top
    3.71 +		org	$-2
    3.72 +_heap_top	dw	?
    3.73  		;xor	ax,ax
    3.74                  ;push	ax			; envp (already cleared)
    3.75                  ;mov	[word di],ax		; argv[0] = 0 (idem)