wok-current rev 19399

memtest: DOS shutdown
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Sep 03 09:48:39 2016 +0200 (2016-09-03)
parents 80800de950ff
children 03eb90ac5d1f
files memtest/stuff/bootloader.S memtest/stuff/pack memtest/stuff/unpack.S
line diff
     1.1 --- a/memtest/stuff/bootloader.S	Fri Sep 02 16:17:00 2016 +0200
     1.2 +++ b/memtest/stuff/bootloader.S	Sat Sep 03 09:48:39 2016 +0200
     1.3 @@ -8,20 +8,21 @@
     1.4  	.globl	_start
     1.5  _start:
     1.6  
     1.7 -#define CODESZ 512
     1.8 +#define CODESZ 512		/* patched by installer */
     1.9  
    1.10  /* some extra features */
    1.11  #define EXE_SUPPORT		real mode dos .exe file support
    1.12  #define CMDLINE	0x9E00
    1.13  #define HELP			store help message for /? argument
    1.14  #define CHECK_REALMODE		does not support vm86
    1.15 +#define SHUTDOWNDOS		shutdown DOS services
    1.16  
    1.17  /* some contraints to reduce the size */
    1.18  //#define FLOPPY_1440K_ONLY	1.44M floppies support only
    1.19  #define NO_CURSOR_DEFINITION
    1.20  
    1.21  #ifdef EXE_SUPPORT
    1.22 -#define EXEADRS(x)	x+0xE0
    1.23 +#define EXEADRS(x)	(x+0xE0)
    1.24  stacktop	= 0x9E00		# in 0x8000 .. 0xA000
    1.25  	decw	%bp			// Magic number: MZ
    1.26  	popw	%dx
    1.27 @@ -105,7 +106,24 @@
    1.28  	movw	$end_header, %di
    1.29  	rep
    1.30  	  movsw
    1.31 +#ifndef SHUTDOWNDOS
    1.32  	ljmp	$INITSEG, $movesys
    1.33 +#else
    1.34 +	pushaw
    1.35 +	pushw	%es
    1.36 +	xorw	%si, %si
    1.37 +	movw	%si, %ds		# %ds = 0
    1.38 +	pushl	4(%si)
    1.39 +	movw	%sp, %es:loadsp19+1(%si)
    1.40 +	movw	$step19, 4(%si)
    1.41 +	movw	%es, 6(%si)
    1.42 +	pushfw
    1.43 +	popw	%ax
    1.44 +	incb	%ah			# set TF
    1.45 +	pushw	%ax
    1.46 +	popfw
    1.47 +	ljmp	*4*0x19(%si)
    1.48 +#endif
    1.49  start:
    1.50  	pushw	%dx
    1.51  #else
    1.52 @@ -207,6 +225,27 @@
    1.53  	int	$0x20			// dos exit
    1.54  #endif
    1.55  #ifdef EXE_SUPPORT
    1.56 +#ifdef SHUTDOWNDOS
    1.57 +doiret:
    1.58 +	iret
    1.59 +step19:
    1.60 +	pushw	%si
    1.61 +	pushw	%ds
    1.62 +	movw	%sp, %si
    1.63 +	ldsw	%ss:4(%si), %si
    1.64 +	cmpw	$0x19CD, (%si)
    1.65 +	popw    %ds
    1.66 +	popw    %si
    1.67 +	jne	doiret
    1.68 +	xorw	%si, %si
    1.69 +	mov	%si, %ds
    1.70 +	popl	4*0x19(%si)
    1.71 +loadsp19:
    1.72 +	movw	$0, %sp
    1.73 +	popl	4(%si)
    1.74 +	popw	%es
    1.75 +	popaw
    1.76 +#endif
    1.77  movesys:				// %ax = SYSSEG
    1.78  	pushw	%es
    1.79  	popw	%ss
     2.1 --- a/memtest/stuff/pack	Fri Sep 02 16:17:00 2016 +0200
     2.2 +++ b/memtest/stuff/pack	Sat Sep 03 09:48:39 2016 +0200
     2.3 @@ -55,8 +55,7 @@
     2.4  }
     2.5  
     2.6  HELP="$(unix2dos <<EOT
     2.7 -Memtest86+ VERSION is an endless advanced memory diagnostic tool released under
     2.8 -the terms of the free Gnu Public License (GPL).
     2.9 +Memtest86+ VERSION is an endless advanced memory diagnostic tool (GPL).
    2.10  
    2.11  EOT
    2.12  )"
     3.1 --- a/memtest/stuff/unpack.S	Fri Sep 02 16:17:00 2016 +0200
     3.2 +++ b/memtest/stuff/unpack.S	Sat Sep 03 09:48:39 2016 +0200
     3.3 @@ -10,7 +10,6 @@
     3.4  #define HARDCODED_SYSSIZE	1
     3.5  #define HARDCODED_SETUPSIZE	1
     3.6  #define HARDCODED_IP		1
     3.7 -#define SHUTDOWNDOS		0
     3.8  #define FLAT16			1
     3.9  //#define FLAT16OUT		0
    3.10  
    3.11 @@ -45,40 +44,6 @@
    3.12  getip:
    3.13  #endif
    3.14  	pushal
    3.15 -#if SHUTDOWNDOS
    3.16 -	xorw	%si, %si
    3.17 -        movw	%si, %ds		# %ds = 0
    3.18 -	pushl	4(%si)
    3.19 -	movw	%sp, %cs:loadsp19+1(%si)
    3.20 -	cmpb	$0xF0, 7(%si)
    3.21 -	jnb	notdos
    3.22 -        movw	$step19, 4(%si)
    3.23 -        movw	%cs, 6(%si)
    3.24 -        pushfw
    3.25 -        popw	%ax
    3.26 -        incb	%ah			# set TF
    3.27 -        pushw	%ax
    3.28 -        popfw
    3.29 -        ljmp	*4*0x19(%si)
    3.30 -step19:
    3.31 -        pushw	%si
    3.32 -        pushw	%ds
    3.33 -        movw	%sp, %si
    3.34 -        ldsw	%ss:4(%si), %si
    3.35 -        cmpw	$0x19CD, (%si)
    3.36 -        popw    %ds
    3.37 -        popw    %si
    3.38 -	jne	doiret
    3.39 -	xorw	%si, %si
    3.40 -	mov	%si, %ds
    3.41 -	popl	4*0x19(%si)
    3.42 -notdos:
    3.43 -loadsp19:
    3.44 -	movw	$0, %sp
    3.45 -	popl	4(%si)
    3.46 -	pushw	%ss
    3.47 -	popw	%ds
    3.48 -#endif
    3.49  #if !FLAT16
    3.50  #undef FLAT16
    3.51  #if HARDCODED_SYSSIZE