wok diff linld/stuff/src/_BEG.ASM @ rev 24022

linld: basic iso9660 support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Mar 14 19:55:20 2021 +0000 (2021-03-14)
parents 61df94a0fa43
children 526688f99354
line diff
     1.1 --- a/linld/stuff/src/_BEG.ASM	Sun Feb 28 16:32:57 2021 +0000
     1.2 +++ b/linld/stuff/src/_BEG.ASM	Sun Mar 14 19:55:20 2021 +0000
     1.3 @@ -8,6 +8,38 @@
     1.4                  %nomacs
     1.5  
     1.6  	include	"common.inc"
     1.7 +	include "himem.inc"
     1.8 +	include	"isostate.inc"
     1.9 +
    1.10 +	ifdef	QUICK_BOOT
    1.11 +CMDNUMCNT	=	7
    1.12 +	else
    1.13 +CMDNUMCNT	=	5
    1.14 +	endif
    1.15 +
    1.16 +	macro	alloc_isostate
    1.17 +		public	_isostate
    1.18 +_isostate	isostate	<?>
    1.19 +		org	$-ISOSTATE_OVERLAP
    1.20 +	endm
    1.21 +
    1.22 +	macro	alloc_image
    1.23 +rm_size		dw	?		; _imgs-4
    1.24 +rm_buf		dw	?		; _imgs-2
    1.25 +		global	_imgs:byte
    1.26 +label	_imgs	byte
    1.27 +img_kernel	image_himem	?
    1.28 +img_initrd	image_himem	?
    1.29 +	endm
    1.30 +
    1.31 +	macro	alloc_misc
    1.32 +		global	_cmdnum:word
    1.33 +label   _cmdnum	word
    1.34 +		dd	CMDNUMCNT	dup(?)
    1.35 +
    1.36 +		global	_himem_buf:dword
    1.37 +_himem_buf	dd	?
    1.38 +	endm
    1.39  
    1.40                  p8086
    1.41  
    1.42 @@ -34,6 +66,14 @@
    1.43  
    1.44          segment _BSS byte public use16 'BSS'
    1.45  
    1.46 +	ifdef ISO9660
    1.47 +		ifndef	VCPI
    1.48 +		alloc_isotate
    1.49 +		else
    1.50 +room_for_isostate	=	1
    1.51 +		endif
    1.52 +	endif
    1.53 +
    1.54  		ifdef	ISOHOOK
    1.55  	extrn	_big_cmdline:byte
    1.56  		db	254 dup(?)
    1.57 @@ -45,11 +85,27 @@
    1.58  _cpu386		db	?
    1.59  		ifdef	CPU64
    1.60  		org	$-1
    1.61 -		endif
    1.62 -		ifdef	CPU64
    1.63          global  _cpu_features:dword
    1.64  _cpu_features	dd	?
    1.65 +room_for_image	=	1
    1.66 +		else
    1.67 +		alloc_image
    1.68  		endif
    1.69 +
    1.70 +		ifndef	BSS_OVERLAP_BOOT
    1.71 +
    1.72 +		ifdef	room_for_isostate
    1.73 +		alloc_isostate
    1.74 +		endif
    1.75 +
    1.76 +		ifdef	room_for_image
    1.77 +		alloc_image
    1.78 +		endif
    1.79 +
    1.80 +		alloc_misc
    1.81 +
    1.82 +		endif
    1.83 +
    1.84          ends    _BSS
    1.85  
    1.86          segment _TEXT byte public use16 'CODE'
    1.87 @@ -67,11 +123,6 @@
    1.88  ;***************************************************************
    1.89  		mov	sp,offset stktop
    1.90  		mov	bx, 0F000h	; cld ; cli & empty string
    1.91 -		org	$-4-2
    1.92 -		global	_himem_buf:dword
    1.93 -_himem_buf	dd	?
    1.94 -		global	_buf_cmdline:word
    1.95 -_buf_cmdline	dw	?		; 128 bytes, must start with 00
    1.96  		mov	si,offset _bss_start
    1.97  clearbss:
    1.98  		mov	[si],bl		; clear bss + heap
    1.99 @@ -128,8 +179,10 @@
   1.100  		ifdef	VCPI
   1.101  ; Check whether it is safe to call 67h
   1.102  		xor	eax,eax
   1.103 -                mov     es,ax
   1.104 -                cmp     [dword es:67h*4],eax
   1.105 +		push	ds
   1.106 +                mov     ds,ax
   1.107 +                cmp     [dword 67h*4],eax
   1.108 +		pop	ds
   1.109                  je      no_vcpi
   1.110                  mov     ah,0DEh		; check for vcpi present
   1.111                  int     67h
   1.112 @@ -187,11 +240,6 @@
   1.113  ;***************************************************************
   1.114  ; build argv & argc
   1.115  ;***************************************************************
   1.116 -		extrn	_bss_end:word
   1.117 -		mov	di,offset _bss_end
   1.118 -		global	_heap_top
   1.119 -		org	$-2
   1.120 -_heap_top	dw	?
   1.121                  mov	si,80h
   1.122  		ifdef	ISOHOOK
   1.123                  mov	bx,offset _big_cmdline
   1.124 @@ -212,6 +260,41 @@
   1.125  		endif
   1.126  		xchg	ax,bx
   1.127                  mov	[bx+si],bh		; set eos
   1.128 +
   1.129 +;***************************************************************
   1.130 +
   1.131 +		ifdef	BSS_OVERLAP_BOOT
   1.132 +		mov	al,0
   1.133 +		mov	di,100h
   1.134 +		mov	cx,offset clean-100h
   1.135 +
   1.136 +		org	$-(CMDNUMCNT*4)-4
   1.137 +
   1.138 +		ifdef	room_for_image
   1.139 +		org	$-2-2-(2*size image_himem)
   1.140 +		endif
   1.141 +
   1.142 +		ifdef	room_for_isostate
   1.143 +		org	$+ISOSTATE_OVERLAP-size isostate
   1.144 +		alloc_isostate
   1.145 +		endif
   1.146 +
   1.147 +		ifdef	room_for_image
   1.148 +		alloc_image
   1.149 +		endif
   1.150 +
   1.151 +		alloc_misc
   1.152 +clean:
   1.153 +		rep
   1.154 +		  stosb
   1.155 +		endif
   1.156 +
   1.157 +;***************************************************************
   1.158 +		extrn	_bss_end:word
   1.159 +		mov	di,offset _bss_end
   1.160 +		global	_heap_top
   1.161 +		org	$-2
   1.162 +_heap_top	dw	?
   1.163  		;xor	dx,dx
   1.164                  ;push	dx			; envp (already cleared)
   1.165                  ;mov	[word di],dx		; argv[0] = 0 (idem)