wok-current rev 19941

memtest: remove help command line, useless
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu May 04 12:47:15 2017 +0200 (2017-05-04)
parents 828da114adaa
children 1193fa3c9d1e
files memtest/receipt memtest/stuff/bootloader.S memtest/stuff/pack memtest/stuff/unpack.S
line diff
     1.1 --- a/memtest/receipt	Sun Apr 30 17:53:19 2017 +0200
     1.2 +++ b/memtest/receipt	Thu May 04 12:47:15 2017 +0200
     1.3 @@ -16,7 +16,6 @@
     1.4  # Rules to configure and make the package.
     1.5  compile_rules()
     1.6  {
     1.7 -	cd $src
     1.8  	sed -i '/scp memtest.bin/d' Makefile
     1.9  	for i in array-size io setup ; do
    1.10  		patch -p1 < $stuff/$SOURCE-$VERSION-$i.patch
    1.11 @@ -27,12 +26,6 @@
    1.12  		cc -o $i.o -Wa,-a=$i.lst -c $i.S
    1.13  		objcopy -O binary $i.o $i.bin
    1.14  	done
    1.15 -	for n in pm_code gdt_abs pagebuf ; do
    1.16 -		for f in bootloader unpack ; do
    1.17 -			printf "%-20s" $f
    1.18 -			sed "/:[0-9a-f]* $n\$/!d;s/.*://" $f.lst
    1.19 -		done
    1.20 -	done
    1.21  	sed -i "s/VERSION/$VERSION/" pack
    1.22  	./pack --build bootloader.bin unpack.bin
    1.23  	./pack memtest.bin memtest.packed
     2.1 --- a/memtest/stuff/bootloader.S	Sun Apr 30 17:53:19 2017 +0200
     2.2 +++ b/memtest/stuff/bootloader.S	Thu May 04 12:47:15 2017 +0200
     2.3 @@ -1,6 +1,10 @@
     2.4 +// Image/zImage boot sector
     2.5 +
     2.6  SYSSEG		= 0x1000
     2.7  INITSEG		= 0x9000
     2.8  SETUPSEG	= 0x9020
     2.9 +setup_sects	= 497
    2.10 +syssize		= 500
    2.11  
    2.12  	.text
    2.13  	.code16
    2.14 @@ -12,144 +16,72 @@
    2.15  
    2.16  /* some extra features */
    2.17  #define EXE_SUPPORT		real mode dos .exe file support
    2.18 -#define CMDLINE	0x9E00
    2.19 -#define HELP			store help message for /? argument
    2.20 -#define TINYSYSTEM		the full file in one segment
    2.21 -#define CHECK_CPU		need a 386+
    2.22 -#define VM2RM			(0x3C+0x19B)
    2.23 +#define CMDLINE		0x9E00
    2.24 +#define VCPI			VCPI 4.0 support
    2.25  #define SHUTDOWNDOS		shutdown DOS services
    2.26  
    2.27  /* some contraints to reduce the size */
    2.28 -//#define FLOPPY_1440K_ONLY	1.44M floppies support only
    2.29 -#define NO_CURSOR_DEFINITION
    2.30 +//#define FLOPPY_1440K_ONLY	1.44M floppies support only	-33
    2.31 +//#define FLOPPY_HAS_2_SIDES	hardcoded heads count to 2	-13
    2.32 +//#define MOVE_MAX_SYSSIZE	always memcpy 512Kb		-2
    2.33 +//#define NO_CURSOR_DEFINITION					-8
    2.34 +//#define NO_CMDLINE_SHRINK	remove heading spaces ?		-6
    2.35 +//#define NO_DOTS		show progression dots ?		-8
    2.36  
    2.37  #ifdef EXE_SUPPORT
    2.38  #define EXEADRS(x)	(x+0xE0)
    2.39 -stacktop	= 0x9E00		# in 0x8000 .. 0xA000
    2.40 -	decw	%bp			// Magic number: MZ
    2.41 -	popw	%dx
    2.42 -	jmp	startz			// Bytes on last page of file
    2.43 -	.word	(CODESZ+511)/512	// Pages in file
    2.44 -	.word	0			// Relocations
    2.45 -	.word	(end_header-_start)/16	// Size of header in paragraphs
    2.46 -	.word	4096			// Minimum extra paragraphs needed
    2.47 -	.word	-1			// Maximum extra paragraphs needed
    2.48 -	.word	(CODESZ+15)/16		// Initial (relative) SS value
    2.49 -	.word	stacktop		// Initial SP value
    2.50 -	.word	0			// Checksum
    2.51 -	.word	EXEADRS(comstart)	// Initial IP value
    2.52 -	.word	0xFFF0			// Initial (relative) CS value
    2.53 -//	.word	0x001C			// File address of relocation table
    2.54 -//	.word	0,0,0			// Overlay number
    2.55 -	.ascii  "SliTaz"
    2.56 -startz:
    2.57 -	jmp	start
    2.58 -end_header:
    2.59 -comstart:
    2.60 -	cld				# assume nothing
    2.61 -#ifdef CMDLINE
    2.62 -	movw	$stacktop, %di		# cmdline offset at 0x22
    2.63 -#else
    2.64 -#undef HELP
    2.65 -#endif
    2.66 -	pushw	$INITSEG
    2.67 -	popw	%es
    2.68 -#ifdef CMDLINE
    2.69 -	movw	$0x80, %si
    2.70 -	lodsb
    2.71 -	cbw
    2.72 -	xchgw	%ax, %cx
    2.73 -	jcxz	nocmdline
    2.74 -	movw	$0xA33F, 0x7F(%si)
    2.75 -skipspace:
    2.76 -	lodsb
    2.77 -	cmpb	$0x20, %al
    2.78 -	je	skipspace
    2.79 -	decw	%si
    2.80 -	rep
    2.81 -	  movsb
    2.82 -# ifdef HELP
    2.83 -# define PUTS
    2.84 -	movw	$EXEADRS(helpmsg), %si
    2.85 -	cmpb	$'/'+1, %al
    2.86 -#  ifdef CHECK_CPU
    2.87 -	js	jsputs
    2.88 -#  else
    2.89 -	js	puts
    2.90 -#  endif
    2.91 -# endif
    2.92 -nocmdline:
    2.93 -#endif
    2.94 -	movw	$SYSSEG, %ax
    2.95 -	movb	$(512-(end_header-_start))/2, %cl
    2.96 -	movw	$end_header, %di
    2.97 -#ifdef CHECK_CPU
    2.98 -#define PUTS
    2.99 -	movw	$EXEADRS(realmode_expected), %si
   2.100 -	//movb	setup_sects-realmode_expected(%si), %ch
   2.101 -	.byte	0x8A, 0x6C, setup_sects-realmode_expected
   2.102 -		// bits  15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
   2.103 -		// flags  0 NT  IOPL OF DF IF TF SF ZF  0 AF  0 PF  1 CF
   2.104 -	//movb	$0x10, %ah	// DF = IF = TF = 0
   2.105 -	pushw	%ax
   2.106 -	popfw			// < 286 : flags[12..15] are forced 1
   2.107 -	pushfw			// = 286 : flags[12..15] are forced 0
   2.108 -	popw	%dx		// > 286 : only flags[15] is forced 0
   2.109 -	cmpb	%ah, %dh	// test Fx and 0x cases: S= < 386, C= < 286
   2.110 -jsputs:
   2.111 -	js	puts		// S= not 386+
   2.112 -	smsww	%dx
   2.113 -	shrw	$1, %dx
   2.114 -# ifdef VM2RM
   2.115 -	jnc	isrm
   2.116 -	push	%cs
   2.117 -	call	VM2RM
   2.118 -isrm:
   2.119 -# else
   2.120 -	jc	puts		// protected mode: vm86
   2.121 -# endif
   2.122 -#else
   2.123 -	movb	EXEADRS(setup_sects), %ch
   2.124 -#endif
   2.125 -	movw	$0x100, %si
   2.126 -	rep
   2.127 -	  movsw
   2.128 -	movw	%ds, %bx
   2.129 -	pushw	%es
   2.130 -	popw	%ss
   2.131 -#ifndef SHUTDOWNDOS
   2.132 -	ljmp	$INITSEG, $movesys
   2.133 -#else
   2.134 -	pushaw
   2.135 -	movw	%cx, %ds		# %ds = 0
   2.136 -	movw	$4, %si
   2.137 +#define FLAT20(x)	(x+16*INITSEG)
   2.138 +
   2.139 +.macro	trace_int19
   2.140 +	pushl	$4
   2.141 +	popw	%si
   2.142 +	popw	%ds
   2.143  	pushl	(%si)
   2.144 -	movw	$step19, (%si)
   2.145 -	movw	%es, 2(%si)
   2.146 +	movl	$step19+(INITSEG<<16), (%si)
   2.147  	pushfw
   2.148  	popw	%ax
   2.149  	incb	%ah			# set TF
   2.150  	pushw	%ax
   2.151  	popfw
   2.152  	ljmp	*4*0x19-4(%si)
   2.153 +.endm
   2.154 +
   2.155 +stacktop	= 0x9E00		# in 0x8000 .. 0xA000
   2.156 +	decw	%bp			// Magic number: MZ
   2.157 +	popw	%dx
   2.158 +	jmp	start			// Bytes on last page of file
   2.159 +	.word	(CODESZ+511)/512	// Pages in file			INSTALLER
   2.160 +	.word	0			// Relocations
   2.161 +	.word	(end_header-_start)/16	// Size of header in paragraphs
   2.162 +	.word	(CODESZ+stacktop+15)/16	// Minimum extra paragraphs needed	INSTALLER
   2.163 +	.word	-1			// Maximum extra paragraphs needed
   2.164 +	.word	(CODESZ+15)/16		// Initial (relative) SS value		INSTALLER
   2.165 +	.word	stacktop		// Initial SP value
   2.166 +	.word	0			// Checksum				INSTALLER?
   2.167 +	.word	EXEADRS(comstart)	// Initial IP value
   2.168 +	.word	0xFFF0			// Initial (relative) CS value
   2.169 +//	.word	0x001C			// File address of relocation table
   2.170 +//	.word	0,0,0			// Overlay number
   2.171  #endif
   2.172  start:
   2.173 -	pushw	%dx
   2.174 -#else
   2.175 -#undef HELP
   2.176 -#undef CMDLINE
   2.177 -#undef CHECK_CPU
   2.178 -#endif
   2.179  	cld				# assume nothing
   2.180 -stacktop	= 0x9E00		# in 0x8000 .. 0xA000
   2.181 +	xorw	%ax, %ax		# %ax = 0
   2.182  zeroed		= 12			# zeroed registers
   2.183 -	movw	$stacktop-12-zeroed, %di	# stacktop is an arbitrary value >=
   2.184 +stacktop	= 0x9E00		# in 0x8000 .. 0xA000 (+zeroed+12)
   2.185 +	pushw	$INITSEG
   2.186 +	popw	%ss			# %ss contain INITSEG
   2.187 +	pushw	%ss
   2.188 +end_header:
   2.189 +	popw	%es			# %es = %ss = INITSEG
   2.190 +					# cmdline offset at 0x22
   2.191 +	movw	$stacktop, %di		# stacktop is an arbitrary value >=
   2.192  					# length of bootsect + length of
   2.193  					# setup + room for stack;
   2.194  					# 12 is disk parm size.
   2.195 -	pushw	$INITSEG
   2.196 -	popw	%ss			# %ss contain INITSEG
   2.197  	movw	%di, %sp		# put stack at INITSEG:stacktop-...
   2.198 +#ifdef EXE_SUPPORT
   2.199 +	cwd				# %dx = 0
   2.200 +#endif
   2.201  
   2.202  # Many BIOS's default disk parameter tables will not recognize
   2.203  # multi-sector reads beyond the maximum sector number specified
   2.204 @@ -163,12 +95,6 @@
   2.205  #
   2.206  # High doesn't hurt.  Low does.  Let's use the max: 63
   2.207  
   2.208 -	pushw	%ss
   2.209 -	popw	%es			# %es = %ss = INITSEG
   2.210 -	xorw	%ax, %ax		# %ax = 0
   2.211 -#ifdef EXE_SUPPORT
   2.212 -	cwd				# %dx = 0
   2.213 -#endif
   2.214  	movw	$zeroed/2, %cx		# clear gdt + offset, %ds, limits
   2.215  	rep				# don't worry about cld
   2.216  	stosw				# already done above
   2.217 @@ -200,7 +126,9 @@
   2.218  # no 64kB boundaries are crossed. We try to load it as fast as
   2.219  # possible, loading whole tracks whenever we can.
   2.220  
   2.221 +#ifndef NO_DOTS
   2.222  	popw	%bx			# clear %bx
   2.223 +#endif
   2.224  	movw	syssize, %di
   2.225  	decw	%di
   2.226  	shrw	$9-4, %di
   2.227 @@ -223,16 +151,6 @@
   2.228  jmp_setup:
   2.229  	ljmp	$SETUPSEG, $0
   2.230  
   2.231 -#ifdef PUTS
   2.232 -#define PUTC
   2.233 -putslp:
   2.234 -	call	putc
   2.235 -puts:
   2.236 -	lodsb
   2.237 -	orb	%al, %al
   2.238 -	jne	putslp	
   2.239 -	int	$0x20			// dos exit
   2.240 -#endif
   2.241  #ifdef EXE_SUPPORT
   2.242  #ifdef SHUTDOWNDOS
   2.243  doiret:
   2.244 @@ -254,30 +172,9 @@
   2.245  	popl	4(%si)
   2.246  	popaw
   2.247  #endif
   2.248 -movesys:				// %ax = SYSSEG
   2.249 -#ifdef TINYSYSTEM
   2.250 -	movw	%si, %cx
   2.251 -	negw	%cx
   2.252 -	xorw	%di, %di
   2.253 -	movw	%ax, %es
   2.254 -	movw	%si, %dx
   2.255 -	shrw	$4, %dx
   2.256 -# ifdef SHUTDOWNDOS
   2.257 -	movw	%bx, %ds
   2.258 -# endif
   2.259 -	addw	%dx, %bx
   2.260 -	subw	%ax, %bx
   2.261 -	jnc	forward
   2.262 -	addw	%cx, %di
   2.263 -	addw	%cx, %si
   2.264 -	incw	%cx
   2.265 -	std
   2.266 -forward:
   2.267 -	rep
   2.268 -	  movsb
   2.269 -	cld
   2.270 -#else
   2.271 -	movw	%cs:syssize, %bp
   2.272 +movesys:				// %ax = SYSSEG, %bx = DS, %si
   2.273 +	//movw	%cs:syssize, %bp
   2.274 +	movw	$0x8000, %bp
   2.275  	shrw	$4, %si
   2.276  	addw	%si, %bx
   2.277  	subw	%ax, %bx
   2.278 @@ -298,7 +195,6 @@
   2.279  	  movsw
   2.280  	decw	%bp
   2.281  	jns	forward
   2.282 -#endif
   2.283  #ifndef NO_CURSOR_DEFINITION
   2.284  	movb	$1, %ah
   2.285  	movb	$0, %bh
   2.286 @@ -308,17 +204,87 @@
   2.287  	pushw	%ss
   2.288  	popw	%ds
   2.289  	jmp	jmp_setup
   2.290 +comstart:
   2.291 +	cld				# assume nothing
   2.292 +	pushw	$INITSEG
   2.293 +	popw	%es
   2.294 +#ifdef CMDLINE
   2.295 +	movw	%sp, %di
   2.296 +	movw	$0x80, %si
   2.297 +	lodsb
   2.298 +	cbw
   2.299 +	xchgw	%ax, %cx
   2.300 +	jcxz	nocmdline
   2.301 +	movw	$0xA33F, 0x7F(%si)
   2.302 +# ifndef NO_CMDLINE_SHRINK
   2.303 +skipspace:
   2.304 +	lodsb
   2.305 +	cmpb	$0x20, %al
   2.306 +	je	skipspace
   2.307 +	decw	%si
   2.308 +# endif
   2.309 +	rep
   2.310 +	  movsb
   2.311 +nocmdline:
   2.312  #endif
   2.313 -putcdot:
   2.314 -#ifdef PUTC
   2.315 -	movb	$0x2E, %al
   2.316 -putc:
   2.317 -	movb	$0xE, %ah
   2.318 -	movw	$7, %bx
   2.319 -	int	$0x10
   2.320 +	movb	$(512-(end_header-_start))/2, %cl
   2.321 +	movb	EXEADRS(setup_sects), %ch
   2.322 +	movw	$0x100, %si
   2.323 +	movw	$end_header, %di
   2.324 +	rep
   2.325 +	  movsw
   2.326 +	movw	$SYSSEG, %ax
   2.327 +	movw	%ds, %bx
   2.328 +	pushw	%es
   2.329 +	popw	%ss
   2.330 +#ifndef SHUTDOWNDOS
   2.331 +	pushw	%es
   2.332 +	pushw	$movesys
   2.333  #endif
   2.334 -	ret
   2.335 -
   2.336 +#ifdef VCPI
   2.337 +# ifndef SHUTDOWNDOS
   2.338 +	pushw	%es
   2.339 +	pushw	%ds
   2.340 +# endif
   2.341 +	pushaw
   2.342 +	smsww	%ax
   2.343 +	andb	$1, %al
   2.344 +	je	isrm
   2.345 +	movw	$EXEADRS(gdt_vcpi),%si
   2.346 +	pushw	$pagebuf/16
   2.347 +	popw	%es
   2.348 +	movl	$pagebuf+3,%es:0x1000
   2.349 +	xorw	%di,%di
   2.350 +call_vcpi:
   2.351 +	movb	$0xDE,%ah	// DE01, EBX = getiface(DS:SI, ES:DI)
   2.352 +	int	$0x67
   2.353 +	movl	$FLAT20(sw2pm_params),%esi
   2.354 +	movb	$0x0C,%al	// DE0C switchpm(ESI)
   2.355 +	cli
   2.356 +	jmp	call_vcpi
   2.357 +pm_code:
   2.358 +	movl	%cr0,%eax
   2.359 +	andl	$0x7FFFFFFE,%eax
   2.360 +	movl	%eax,%cr0
   2.361 +	movl	%eax,%cr3
   2.362 +isrm:
   2.363 +# ifdef SHUTDOWNDOS
   2.364 +	trace_int19
   2.365 +# else
   2.366 +	lssw	%cs:EXEADRS(saved_ss_sp),%sp	
   2.367 +	popaw
   2.368 +	popw	%ds
   2.369 +	popw	%es
   2.370 +	retf
   2.371 +# endif
   2.372 +#else
   2.373 +# ifdef SHUTDOWNDOS
   2.374 +	pushaw
   2.375 +	trace_int19
   2.376 +# endif
   2.377 +	retf
   2.378 +#endif
   2.379 +#endif
   2.380  
   2.381  # read_sectors reads %di sectors into %es:0 buffer.
   2.382  # %es:0 is updated to the next memory location.
   2.383 @@ -328,13 +294,21 @@
   2.384  # Assume no error on first track.
   2.385  
   2.386  #ifdef FLOPPY_1440K_ONLY
   2.387 -#define FLOPPY_HEADS		2	/* 2 heads */
   2.388 +#define FLOPPY_HAS_2_SIDES	hardcore heads count to 2
   2.389  #define FLOPPY_SECTORS		18	/* 18 sectors */
   2.390  #else
   2.391  #define FLOPPY_HEADS		2	/* 2 heads minimum */
   2.392  #define FLOPPY_SECTORS		9	/* 9 sectors minimum */
   2.393  #endif
   2.394  
   2.395 +return:
   2.396 +#ifndef NO_DOTS
   2.397 +	movw	$0xE2E,%ax
   2.398 +	movb	$7,%bl
   2.399 +	int	$0x10
   2.400 +#endif
   2.401 +	ret
   2.402 +
   2.403  check_limits:
   2.404  #ifndef FLOPPY_1440K_ONLY
   2.405  	popw	%dx
   2.406 @@ -344,6 +318,7 @@
   2.407  #endif
   2.408          cmpb    %al, %cl		# max sector known ?
   2.409          ja	next_head		#   no -> store it
   2.410 +#ifndef FLOPPY_HAS_2_SIDES
   2.411  check_head:
   2.412  #ifdef FLOPPY_HEADS
   2.413  	cmpb	$FLOPPY_HEADS, %dh	# 2 heads minimum
   2.414 @@ -353,6 +328,7 @@
   2.415          ja	next_cylinder		#   no -> store it
   2.416  check_cylinder:
   2.417  #endif
   2.418 +#endif
   2.419  	pushaw
   2.420  #ifndef FLOPPY_1440K_ONLY
   2.421  	cbw				# %ah = 0
   2.422 @@ -399,9 +375,6 @@
   2.423  	popw	%dx
   2.424  	subw	%dx,%di			# update sector counter
   2.425  	popw	%dx
   2.426 -read_sectorsCX:
   2.427 -	movw	%cx, %es		# next location
   2.428 -	jz	putcdot
   2.429  #else
   2.430  	addw	%ax,%cx			# next sector
   2.431  	movw	%cx, %gs
   2.432 @@ -411,10 +384,10 @@
   2.433  	addw	%ax, %cx
   2.434  	popw	%ax
   2.435  	subw	%ax,%di			# update sector counter
   2.436 +#endif
   2.437  read_sectorsCX:
   2.438  	movw	%cx, %es		# next location
   2.439 -	jz	putcdot
   2.440 -#endif
   2.441 +	jz	return
   2.442  read_sectors:
   2.443  	movw	%gs, %cx
   2.444  #ifndef FLOPPY_1440K_ONLY
   2.445 @@ -431,29 +404,26 @@
   2.446          cmpb    $FLOPPY_SECTORS+1,%cl	# reach sector limit ?
   2.447          jne     bdendlp
   2.448  #endif
   2.449 +        movb    $1,%cl			# first sector
   2.450 +#ifndef FLOPPY_HAS_2_SIDES
   2.451          incb    %dh			# next head
   2.452 -        movb    $1,%cl			# first sector
   2.453 -#ifndef FLOPPY_1440K_ONLY
   2.454          cmpb    %ah, %dh		# reach head limit ?
   2.455          jne     bdendlp
   2.456  next_cylinder:
   2.457          movb    %dh,%ah
   2.458 +        movb    $0,%dh			# first head
   2.459  #else
   2.460 -        cmpb    %cl,%dh			# reach head limit ?
   2.461 -        je	bdendlp
   2.462 +        xorb    %cl,%dh			# next head
   2.463 +        jne	bdendlp			# reach head limit ?
   2.464  #endif
   2.465  # NOTE : support 256 cylinders max
   2.466          incb    %ch			# next cylinder
   2.467 -        movb    $0,%dh			# first head
   2.468  read_first_sectors:
   2.469  bdendlp:
   2.470          jmp	read_sectorslp
   2.471  
   2.472 -#ifdef VM2RM
   2.473 -pagebuf		=	0x96000
   2.474 -saved_ss_sp	=	gdt_abs-44
   2.475 -saved_sp	=	gdt_abs-44
   2.476 -saved_ss	=	gdt_abs-42
   2.477 +#ifdef VCPI
   2.478 +pagebuf		=	0x98000
   2.479  tss		=	gdt_abs-40
   2.480  gdt		=	gdt_abs-32
   2.481  gdt_null	=	gdt_abs-32
   2.482 @@ -461,39 +431,38 @@
   2.483  gdt_vcpi2	=	gdt_abs-16
   2.484  gdt_vcpi3	=	gdt_abs-8
   2.485  gdt_abs:
   2.486 -	.word	0xFFFF,0
   2.487 -	.byte	0,0x92,0xCF,0
   2.488 +	.word	0xFFFF
   2.489 +	.long	0x92000000
   2.490 +	.byte	0xCF,0
   2.491  gdt_code:
   2.492  	.word	0xFFFF
   2.493  gdt_code_base:
   2.494 -	.long	0x9A000000
   2.495 +	.long	0x9A000000+FLAT20(0)
   2.496  	.byte	0x8F,0
   2.497  gdt_tss:
   2.498  	.word	0x00FF
   2.499  gdt_tss_base:
   2.500 -	.long	0x89000000+EXEADRS(tss)
   2.501 +	.long	0x89000000+FLAT20(tss)
   2.502  	.byte	0,0
   2.503  gdtr:
   2.504  gdt_lim:
   2.505  	.word	0xFFFF
   2.506  gdt_base:
   2.507 -	.long	EXEADRS(gdt)
   2.508 +	.long	FLAT20(gdt)
   2.509  sw2pm_params:
   2.510  sw2pm_cr3:
   2.511  	.long	pagebuf+0x1000
   2.512  sw2pm_gdtr_ptr:
   2.513 -	.long	EXEADRS(gdtr)
   2.514 +	.long	FLAT20(gdtr)
   2.515  sw2pm_idtr_ptr:
   2.516 -	.long	EXEADRS(idtr)
   2.517 +	.long	FLAT20(idtr)
   2.518  sw2pm_ldtr:
   2.519  	.word	0
   2.520  sw2pm_tr:
   2.521  SEL_TSS		= gdt_tss-gdt_null
   2.522  	.word	SEL_TSS
   2.523  sw2pm_jumpaddr:
   2.524 -#define SETUPEXEADRS(x)	(x+0x2E0)
   2.525 -pm_code		=	0x0084
   2.526 -	.long	SETUPEXEADRS(pm_code)
   2.527 +	.long	pm_code
   2.528  SEL_CODE	= gdt_code-gdt_null
   2.529  	.word	SEL_CODE
   2.530  idtr:
   2.531 @@ -501,31 +470,13 @@
   2.532  	.word	0x03FF
   2.533  idt_base:
   2.534  	.long	0
   2.535 +# ifndef SHUTDOWNDOS
   2.536 +saved_ss_sp:
   2.537 +	.word	stacktop-4-16-4,INITSEG
   2.538 +# endif
   2.539  #endif
   2.540 -#ifdef HELP
   2.541 +
   2.542  helpmsg:
   2.543 -	.ascii	"No help."
   2.544 -	.byte	13,10
   2.545 -	.byte	0
   2.546 -#endif
   2.547 -#ifdef CHECK_CPU
   2.548 -# if VM2RM
   2.549 -	.org	484
   2.550 -realmode_expected:
   2.551 +	.ascii	"SliTaz zImage boot"
   2.552 +	.org 497
   2.553  helpend:
   2.554 -	.ascii	"386+ only."
   2.555 -# else
   2.556 -	.org	475
   2.557 -realmode_expected:
   2.558 -helpend:
   2.559 -	.ascii	"386 real mode only."
   2.560 -# endif
   2.561 -	.byte	13,10,0
   2.562 -#endif
   2.563 -	.org	497
   2.564 -setup_sects:
   2.565 -	.byte	0
   2.566 -	.org	500
   2.567 -syssize:
   2.568 -	.word	0
   2.569 -
     3.1 --- a/memtest/stuff/pack	Sun Apr 30 17:53:19 2017 +0200
     3.2 +++ b/memtest/stuff/pack	Thu May 04 12:47:15 2017 +0200
     3.3 @@ -17,7 +17,7 @@
     3.4  	helpend=$(grep -s helpend$ ${1/.bin/.lst}|sed '$!d;s/.*t:\([^ ]*\).*/\1/')
     3.5  	if [ -n "$helpmsg" ]; then
     3.6  		sed -i "s/YYY/$((0x$helpmsg))/" $0
     3.7 -		sed -i "s/ZZZ/$((0x$helpend-0x$helpmsg-1))/" $0
     3.8 +		sed -i "s/ZZZ/$((0x$helpend-0x$helpmsg))/" $0
     3.9  	else
    3.10  		sed -i '/YYY/d' $0
    3.11  	fi
    3.12 @@ -49,24 +49,24 @@
    3.13  	dd if=$1 bs=1 skip=497 seek=497 count=15 of=$2 conv=notrunc
    3.14  	setup="$(echo $(od -j 497 -N 1 -dAn $1))"
    3.15  	[ $setup -eq 0 ] && setup=4
    3.16 -	syssize="$(echo $(od -j 500 -N 2 -dAn $1))"
    3.17 -	[ $syssize -eq 0 ] && syssize=$((($(stat -c %s $1) + 15 - 512*($setup + 1))/16))
    3.18  	store $setup $2 XXXSB 1
    3.19  	store $setup $2 XXXSW 1
    3.20  	store $((32 * $setup)) $2 XXXSP
    3.21  	store $((0x1000 - 32*$setup)) $2 XXXSS 
    3.22  	dd if=$1 bs=512 skip=1 | compress >>$2
    3.23  	size=$(stat -c %s $2)
    3.24 -	store $((($size-2560+15)/16 + 0x1000)) $2 XXXP
    3.25 -	store $((($size-2560+15)/16)) $2 500
    3.26 +	syssize=$((($size-512*($setup+1)+15)/16))
    3.27 +	store $(($syssize + 0x1000)) $2 XXXP
    3.28 +	store $syssize $2 500
    3.29  	store 4 $2 497 1
    3.30  	store $((($size+511)/512)) $2 4
    3.31 +	store $((($size+15)/16+0x9E0)) $2 10
    3.32  	store $((($size+15)/16)) $2 14
    3.33  	echo -e "$3" | dd conv=notrunc bs=1 seek=YYY of=$2 count=ZZZ
    3.34  }
    3.35  
    3.36  HELP="$(unix2dos <<EOT
    3.37 -Memtest86+ VERSION GPL endless
    3.38 +Memtest86+ VERSION GPLv2
    3.39  EOT
    3.40  )"
    3.41  main $1 ${2:-$1.packed} "${3:-$HELP}" 2>/dev/null <<EOT
     4.1 --- a/memtest/stuff/unpack.S	Sun Apr 30 17:53:19 2017 +0200
     4.2 +++ b/memtest/stuff/unpack.S	Thu May 04 12:47:15 2017 +0200
     4.3 @@ -206,63 +206,6 @@
     4.4  	lret
     4.5  #endif
     4.6  
     4.7 -#if VM2RM
     4.8 -#define EXEADRS(x)	(x+0x2E0)
     4.9 -#define BOOTEXEADRS(x)	(x+0xE0)
    4.10 -vm2rm:
    4.11 -pagebuf		=	0x96000
    4.12 -gdt_abs		=	0x18e		// see bootloader.lst
    4.13 -sw2pm_params	=	gdt_abs+30
    4.14 -sw2pm_cr3	=	sw2pm_params
    4.15 -sw2pm_idtr_ptr	=	sw2pm_params+8
    4.16 -saved_ss_sp	=	gdt_abs-44
    4.17 -saved_sp	=	gdt_abs-44
    4.18 -saved_ss	=	gdt_abs-42
    4.19 -tss		=	gdt_abs-40
    4.20 -gdt		=	gdt_abs-32
    4.21 -gdt_null	=	gdt_abs-32
    4.22 -gdt_vcpi	=	gdt_abs-24
    4.23 -gdt_vcpi2	=	gdt_abs-16
    4.24 -gdt_vcpi3	=	gdt_abs-8
    4.25 -gdt_code_base	=	gdt_abs+10
    4.26 -fixuprange	=	0x20
    4.27 -	pushaw
    4.28 -	pushw	%es
    4.29 -	pushw	%ds
    4.30 -	movl	%cs,%edx
    4.31 -	shll	$4,%edx
    4.32 -	movw	$BOOTEXEADRS(gdt_vcpi),%si
    4.33 -	movw	$-fixuprange,%bx
    4.34 -	addl	%edx,sw2pm_idtr_ptr-gdt_vcpi(%si)
    4.35 -fixup:
    4.36 -	addl	%edx,fixuprange+gdt_code_base-gdt_vcpi(%bx,%si)
    4.37 -	addw	$8,%bx
    4.38 -	jne	fixup
    4.39 -	pushw	$pagebuf/16
    4.40 -	popw	%es
    4.41 -	movl	$pagebuf+3,%es:0x1000
    4.42 -	xorw	%di,%di
    4.43 -	movw	$0xDE01,%ax	// EBX = getiface(DS:SI, ES:DI)
    4.44 -	int	$0x67
    4.45 -	movw	$BOOTEXEADRS(saved_sp),%bx
    4.46 -	movw	%ss,2(%bx)
    4.47 -	movw	%sp,(%bx)
    4.48 -	leal	BOOTEXEADRS(sw2pm_params)(%edx),%esi
    4.49 -	movw	$0xDE0C, %ax	// switchpm(ESI)
    4.50 -	cli
    4.51 -	int	$0x67
    4.52 -pm_code:
    4.53 -	movl	%cr0,%eax
    4.54 -	andl	$0x7FFFFFFE,%eax
    4.55 -	movl	%eax,%cr0
    4.56 -	movl	%eax,%cr3
    4.57 -	lssw	%cs:(%bx),%sp	
    4.58 -	popw	%ds
    4.59 -	popw	%es
    4.60 -	popaw
    4.61 -	retf
    4.62 -#endif
    4.63 -
    4.64  unpack:
    4.65  #define NO_LZMA_HEADER
    4.66  #include "unlzma.S"