wok-current diff linld/stuff/src/CRTL.ASM @ rev 22152

linld: hack for VCPI
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Nov 06 21:02:18 2019 +0100 (2019-11-06)
parents 5b6c86ca3faa
children a0dccc5d133d
line diff
     1.1 --- a/linld/stuff/src/CRTL.ASM	Sat Oct 19 10:25:12 2019 +0200
     1.2 +++ b/linld/stuff/src/CRTL.ASM	Wed Nov 06 21:02:18 2019 +0100
     1.3 @@ -57,8 +57,6 @@
     1.4  		org	$-7
     1.5  		endif
     1.6  _xfer_buf	db	4096	dup (?)
     1.7 -        global  _no_exit:byte
     1.8 -_no_exit	db	?
     1.9  filecnt		db	?		; in fact 0 minus file count...
    1.10  nextfilename	dw	?
    1.11  	ifdef	LARGE_IMAGES
    1.12 @@ -178,33 +176,6 @@
    1.13  
    1.14  
    1.15  ;***************************************************************
    1.16 -;_fastcall void puts(bx:const char* s):
    1.17 -;***************************************************************
    1.18 -        global  @puts$qpxzc:near
    1.19 -
    1.20 -;        global  puts:near			; puts(bx)
    1.21 -@putsz:
    1.22 -		call	@putc
    1.23 -@puts$qpxzc:
    1.24 -puts:
    1.25 -		mov	dl,[bx]
    1.26 -		inc	bx
    1.27 -		or	dl,dl
    1.28 -		jne	@putsz
    1.29 -		mov	dl,10
    1.30 -@putc:
    1.31 -		cmp	dl,10
    1.32 -		jne	@putcz
    1.33 -		call	@putcz2
    1.34 -@putcz2:
    1.35 -		xor	dl,7		; 10^13  1010^1101
    1.36 -@putcz:
    1.37 -		mov	ah,2
    1.38 -		int	21h
    1.39 -		ret
    1.40 -
    1.41 -
    1.42 -;***************************************************************
    1.43  ;_fastcall int open(bx:const char* name, int flags=O_RDONLY);
    1.44  ;_fastcall int openargs(bx:const char* name, int flags=O_RDONLY);
    1.45  ;***************************************************************
    1.46 @@ -504,13 +475,14 @@
    1.47  
    1.48  		endif
    1.49  
    1.50 +		include	"himem.inc"
    1.51 +
    1.52  ;***************************************************************
    1.53  ;_fastcall char* strdup(bx:const char* a);
    1.54  ;_fastcall char* malloc_or_die(ax:unsigned size);
    1.55  ;***************************************************************
    1.56  	global	@strdup$qpxzc:near
    1.57  @strdup$qpxzc:
    1.58 -strdup:						; ax = strdup(bx)
    1.59  		mov	ax,[_heap_top]
    1.60  		xchg	ax,bx
    1.61  		call	@strcpy$qpxzct1		; bx = strcpy(bx, ax) end +1
    1.62 @@ -533,8 +505,8 @@
    1.63  
    1.64  ;***************************************************************
    1.65  ;_fastcall int die(bx:const char* msg);
    1.66 -;int exit();
    1.67 -;int abort();
    1.68 +;int exit(ax:int status);
    1.69 +;int abort(void);
    1.70  ;***************************************************************
    1.71  	global	@die$qpxzc:near
    1.72  	proc	@die$qpxzc near
    1.73 @@ -545,12 +517,10 @@
    1.74          global  @exit$qv:near
    1.75  @exit$qv:
    1.76  _exit:
    1.77 -		mov	al,[_no_exit]
    1.78 -		or	al,al
    1.79 -		jne	@@hang
    1.80 +		extrn	_imgs:image_himem
    1.81 +		mov	cx,[(word _imgs.buf)+2]	; no_exit ?
    1.82                  mov	ah,4Ch
    1.83 -                int	21h
    1.84 -@@hang:
    1.85 +		jcxz	do_int21h
    1.86  		mov	bx, offset msg_hang
    1.87  		call	puts
    1.88  ;        global  _abort:near
    1.89 @@ -561,7 +531,33 @@
    1.90  
    1.91  	endp	@die$qpxzc
    1.92  
    1.93 -		include	"himem.inc"
    1.94 +;***************************************************************
    1.95 +;_fastcall void puts(bx:const char* s):
    1.96 +;***************************************************************
    1.97 +        global  @puts$qpxzc:near
    1.98 +
    1.99 +;        global  puts:near			; puts(bx)
   1.100 +@putsz:
   1.101 +		call	@putc
   1.102 +@puts$qpxzc:
   1.103 +puts:
   1.104 +		mov	dl,[bx]
   1.105 +		inc	bx
   1.106 +		or	dl,dl
   1.107 +		jne	@putsz
   1.108 +		mov	dl,10
   1.109 +@putc:
   1.110 +		cmp	dl,10
   1.111 +		jne	@putcz
   1.112 +		call	@putcz2
   1.113 +@putcz2:
   1.114 +		xor	dl,7		; 10^13  1010^1101
   1.115 +@putcz:
   1.116 +		mov	ah,2
   1.117 +do_int21h:
   1.118 +		int	21h
   1.119 +		ret
   1.120 +
   1.121  
   1.122  ;***************************************************************
   1.123  ;static long next_chunk(struct image_himem *di);
   1.124 @@ -691,8 +687,7 @@
   1.125  	endif
   1.126  		shl	eax,12		; i*_4k
   1.127  ; if (edx < pm.fallback+i*_4k && edx >= pm.fallback) again
   1.128 -		extrn	_imgs
   1.129 -		mov	bx,offset _imgs+2
   1.130 +		mov	bx,offset _imgs.fallback
   1.131  		push	eax
   1.132  		add	eax,[bx-2+2]
   1.133  		cmp	eax,edx		; pm.fallback+i*_4k <= edx ?
   1.134 @@ -702,8 +697,7 @@
   1.135  		jae	@@vcpi_alloc
   1.136  @@pmok:
   1.137  ; if (edx >= initrd.fallback+i*_4k && edx < initrd.fallback+initrd.size) again
   1.138 -		extrn	_imgs
   1.139 -		mov	bx,offset _imgs+32+2
   1.140 +		mov	bx,offset _imgs.fallback+32
   1.141  		add	eax,[bx-2+2]	; +initrd.fallback
   1.142  		cmp	eax,edx		; initrd.fallback+i*_4k > edx ?
   1.143  		ja	@@initrdok