wok rev 21984

linld: x86 support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Oct 14 11:20:06 2019 +0200 (7 months ago)
parents 7f4bf91f0eb9
children d741df010f45
files linld/stuff/src/A20.ASM linld/stuff/src/CRTL.ASM linld/stuff/src/CRTL.H linld/stuff/src/CRTLX.H linld/stuff/src/JUMP.ASM linld/stuff/src/LINLD.CPP linld/stuff/src/LOAD.CPP linld/stuff/src/MEMCPY32.ASM linld/stuff/src/MEMTOP.ASM linld/stuff/src/VCPI.ASM linld/stuff/src/XMM.ASM linld/stuff/src/_BEG.ASM linld/stuff/src/pipehole.awk memtest/stuff/bootloader.S
line diff
     1.1 --- a/linld/stuff/src/A20.ASM	Sat Oct 12 12:08:52 2019 +0200
     1.2 +++ b/linld/stuff/src/A20.ASM	Mon Oct 14 11:20:06 2019 +0200
     1.3 @@ -2,6 +2,7 @@
     1.4  ;****** This file is distributed under GPL
     1.5  ;***************************************************************
     1.6                  ideal
     1.7 +		%PAGESIZE 1000
     1.8                  %crefref
     1.9                  %noincl
    1.10                  %nomacs
     2.1 --- a/linld/stuff/src/CRTL.ASM	Sat Oct 12 12:08:52 2019 +0200
     2.2 +++ b/linld/stuff/src/CRTL.ASM	Mon Oct 14 11:20:06 2019 +0200
     2.3 @@ -2,6 +2,7 @@
     2.4  ;****** This file is distributed under GPL
     2.5  ;***************************************************************
     2.6                  ideal
     2.7 +		%PAGESIZE 1000
     2.8                  %crefref
     2.9                  %noincl
    2.10                  %nomacs
    2.11 @@ -220,7 +221,7 @@
    2.12  open:
    2.13  	ifdef	LONG_FILENAME
    2.14  		mov	ax,716Ch
    2.15 -		push	bx di si
    2.16 +		push	bx si di
    2.17  		mov	si,bx
    2.18  		xor	bx,bx			; R/O
    2.19  		xor	cx,cx			; attributes
    2.20 @@ -228,7 +229,7 @@
    2.21  		cwd				; action = open
    2.22  		stc
    2.23                  int	21h
    2.24 -		pop	si di bx
    2.25 +		pop	di si bx
    2.26                  jnc	doret
    2.27  	endif
    2.28                  mov	ax,3d00h		; read-only+compatibility
    2.29 @@ -355,8 +356,8 @@
    2.30  		mov	ax,[_isostate.fd]
    2.31  	global	@lseekset2$qipul:near
    2.32  @lseekset2$qipul:
    2.33 -		mov	dx,[bx]
    2.34 -		mov	cx,[bx+2]
    2.35 +		les	dx,[dword bx]
    2.36 +		mov	cx,es
    2.37  		mov	bl,0
    2.38  		jmp	lseekset
    2.39  
    2.40 @@ -456,9 +457,8 @@
    2.41  		endif
    2.42  		cmp	[byte bx],'|'
    2.43  		je	@@test
    2.44 -		mov	al,0
    2.45  		inc	bx
    2.46 -		cmp	[bx-1],al
    2.47 +		cmp	[byte bx-1],0
    2.48  		jne	@@notopt
    2.49  		stc
    2.50  		jmp	@@nokeyword
    2.51 @@ -543,7 +543,8 @@
    2.52          global  die:near			; die(bx)
    2.53  die:
    2.54  		call	puts
    2.55 -;        global  _exit:near
    2.56 +        global  @exit$qv:near
    2.57 +@exit$qv:
    2.58  _exit:
    2.59  		mov	al,[_no_exit]
    2.60  		or	al,al
    2.61 @@ -794,8 +795,8 @@
    2.62  call_memcpy32:
    2.63  		push	edx
    2.64  		else
    2.65 -		mov	ax,[word ((image_himem bx).fallback)]
    2.66 -		mov	dx,[word ((image_himem bx).fallback)+2]
    2.67 +		les	ax,[dword ((image_himem bx).fallback)]
    2.68 +		mov	dx,es
    2.69  		mov	cx,[word ((image_himem bx).buf)]
    2.70  		cmp	ax,cx			; if (m->fallback != m->buf)
    2.71  		jnz	@@do
    2.72 @@ -841,8 +842,8 @@
    2.73  		ifndef	NO386
    2.74  		mov	edx,[bx]
    2.75  		else
    2.76 -		mov	ax,[bx]
    2.77 -		mov	dx,[bx+2]
    2.78 +		les	ax,[dword bx]
    2.79 +		mov	dx,es
    2.80  		endif
    2.81  		mov	cx,offset _xfer_buf
    2.82  storepage:					; storepage(edx,cx)
    2.83 @@ -1097,16 +1098,14 @@
    2.84  		or	si,si
    2.85  		jz	@@end
    2.86  		lodsb
    2.87 -		mov	dx,ax
    2.88  		or	al,20h
    2.89 -		cmp	al,'n'			; vga=normal
    2.90 -		je	@@vga
    2.91 +		cmp	al,'a'
    2.92 +		jb	@@notvga
    2.93 +		sub	al,'n'
    2.94 +@@vgaloop:
    2.95  		dec	cx
    2.96 -		cmp	al,'e'			; vga=extended
    2.97 -		je	@@vga
    2.98 -		dec	cx
    2.99 -		cmp	al,'a'			; vga=ask
   2.100 -		jne	@@notvga
   2.101 +		add	al,6
   2.102 +		jb	@@vgaloop		; vga=normal,extended,ask
   2.103  @@vga:
   2.104  		dec	cx
   2.105  		xchg	ax,cx
   2.106 @@ -1114,14 +1113,9 @@
   2.107  		jmp	@@popsiret
   2.108  @@notvga:
   2.109  		mov	cx,10			; radix
   2.110 -		xchg	ax,dx
   2.111 -		cmp	al,'+'
   2.112 -		je	@@radixskip
   2.113  		cmp	al,'-'
   2.114 -		clc
   2.115 -		jne	@@radixkeep
   2.116 -		stc
   2.117 -@@radixskip:
   2.118 +		ja	@@radixkeep
   2.119 +		cmc				; '+'=2B:C=0 '-'=2D:C=1
   2.120  		lodsb
   2.121  @@radixkeep:
   2.122  		pushf
   2.123 @@ -1175,8 +1169,7 @@
   2.124  @@popsiret:
   2.125  		pop	si
   2.126  		else
   2.127 -		push	si
   2.128 -		push	di
   2.129 +		push	si di
   2.130  		xor	ax,ax
   2.131  		cwd
   2.132  		or	bx,bx
   2.133 @@ -1184,31 +1177,24 @@
   2.134  		xchg	ax,di
   2.135  		mov	si,bx
   2.136  		lodsb
   2.137 -		mov	bx,ax
   2.138  		or	al,20h
   2.139 -		mov	cx,-1
   2.140 -		cmp	al,'n'			; vga=normal
   2.141 -		je	@@vga
   2.142 +		cmp	al,'a'
   2.143 +		jb	@@notvga
   2.144 +		xor	cx,cx
   2.145 +		sub	al,'n'
   2.146 +@@vgaloop:
   2.147  		dec	cx
   2.148 -		cmp	al,'e'			; vga=extended
   2.149 -		je	@@vga
   2.150 -		dec	cx
   2.151 -		cmp	al,'a'			; vga=ask
   2.152 -		jne	@@notvga
   2.153 +		add	al,6
   2.154 +		jb	@@vgaloop		; vga=normal,extended,ask
   2.155  @@vga:
   2.156  		xchg	ax,cx
   2.157  @@goend:
   2.158  		jmp	@@popdisiret
   2.159  @@notvga:
   2.160  		mov	cx,10			; radix
   2.161 -		xchg	ax,bx
   2.162 -		cmp	al,'+'
   2.163 -		je	@@radixskip
   2.164  		cmp	al,'-'
   2.165 -		clc
   2.166 -		jne	@@radixkeep
   2.167 -		stc
   2.168 -@@radixskip:
   2.169 +		ja	@@radixkeep
   2.170 +		cmc				; '+'=2B:C=0 '-'=2D:C=1
   2.171  		lodsb
   2.172  @@radixkeep:
   2.173  		pushf
   2.174 @@ -1236,21 +1222,19 @@
   2.175  		jae	@@endstrtol
   2.176  
   2.177  		push	ax
   2.178 -		push	si
   2.179  		push	dx
   2.180 +		xchg	ax,bx
   2.181 +		mul	cx
   2.182 +		xchg	ax,bx
   2.183 +		xchg	ax,dx
   2.184  		xchg	ax,di
   2.185 -		mul	cx
   2.186 -		xchg	ax,di
   2.187 -		xchg	ax,dx
   2.188 -		xchg	ax,si
   2.189  		pop	ax
   2.190  		mul	cx
   2.191 -		add	ax,si
   2.192 -		pop	si
   2.193 +		add	ax,di
   2.194  		xchg	ax,dx
   2.195  		pop	ax
   2.196  		mov	ah,0
   2.197 -		add	di,ax
   2.198 +		add	bx,ax
   2.199  		adc	dx,0
   2.200  
   2.201  		jmp	@@strtollp
   2.202 @@ -1272,14 +1256,13 @@
   2.203  		popf
   2.204  		jnc	@@end
   2.205  		not	dx
   2.206 -		neg	di
   2.207 +		neg	bx
   2.208  		jne	@@end
   2.209  		inc	dx
   2.210  @@end:
   2.211 -		xchg	ax,di
   2.212 +		xchg	ax,bx
   2.213  @@popdisiret:
   2.214 -		pop	di
   2.215 -		pop	si
   2.216 +		pop	di si
   2.217  		endif
   2.218  strtol_ret:
   2.219  		ret
     3.1 --- a/linld/stuff/src/CRTL.H	Sat Oct 12 12:08:52 2019 +0200
     3.2 +++ b/linld/stuff/src/CRTL.H	Mon Oct 14 11:20:06 2019 +0200
     3.3 @@ -48,8 +48,12 @@
     3.4  #define int3() do { asm { db 0cch } } while(0)
     3.5  #define nop() do { asm { db 90h } } while(0)
     3.6  extern char no_exit;
     3.7 +extern void exit();
     3.8  extern _fastcall int die(const char* msg);
     3.9  //extern "C" char* malloc_or_die(unsigned size);
    3.10  //extern "C" unsigned long* malloc_bufv_or_die(struct image_himem *m);
    3.11  extern _fastcall int malloc_or_die(unsigned size);
    3.12  extern _fastcall int malloc_bufv_or_die(struct image_himem *m);
    3.13 +extern char cpu_features[];
    3.14 +#define CPUMASKLM  (0x20)
    3.15 +#define cpuhaslm() (cpu_features[3]&CPUMASKLM)
     4.1 --- a/linld/stuff/src/CRTLX.H	Sat Oct 12 12:08:52 2019 +0200
     4.2 +++ b/linld/stuff/src/CRTLX.H	Mon Oct 14 11:20:06 2019 +0200
     4.3 @@ -9,6 +9,3 @@
     4.4  //extern "C" char *ultoa(unsigned long n);
     4.5  extern _fastcall int ultoa(unsigned long n);
     4.6  extern "C" void try_default_args();
     4.7 -extern char cpu_features[];
     4.8 -#define CPUMASKLM  (0x20)
     4.9 -#define cpuhaslm() (cpu_features[3]&CPUMASKLM)
     5.1 --- a/linld/stuff/src/JUMP.ASM	Sat Oct 12 12:08:52 2019 +0200
     5.2 +++ b/linld/stuff/src/JUMP.ASM	Mon Oct 14 11:20:06 2019 +0200
     5.3 @@ -2,6 +2,7 @@
     5.4  ;****** This file is distributed under GPL
     5.5  ;***************************************************************
     5.6                  ideal
     5.7 +		%PAGESIZE 1000
     5.8                  %crefref
     5.9                  %noincl
    5.10                  %nomacs
    5.11 @@ -114,6 +115,7 @@
    5.12  		rep
    5.13  		  movsb
    5.14  		ifdef	NO386
    5.15 +		mov	bx,ss
    5.16  		add	bh,9
    5.17  		push	bx			; topseg()+0x0900
    5.18  		else
     6.1 --- a/linld/stuff/src/LINLD.CPP	Sat Oct 12 12:08:52 2019 +0200
     6.2 +++ b/linld/stuff/src/LINLD.CPP	Mon Oct 14 11:20:06 2019 +0200
     6.3 @@ -5,9 +5,13 @@
     6.4  #include "crtl.h"
     6.5  #include "common.h"
     6.6  
     6.7 +const char* cmdline = "auto";
     6.8  const char* kernel_name = "bzImage";
     6.9 +#ifdef	USE_ARGSTR
    6.10 +const char* initrd_name = NULL;
    6.11 +#else
    6.12  const char* initrd_name;
    6.13 -const char* cmdline = "auto";
    6.14 +#endif
    6.15  u32 root_dev;
    6.16  u32 vid_mode;		// -3 = ask
    6.17  			// -2 = Extended VGA
    6.18 @@ -21,6 +25,7 @@
    6.19          "LINLD [image=file] [initrd=files] [vga=mode] [root=num] [mem=max] [cl=cmdline]" NL
    6.20          "vga mode: ask,extended,normal or dec/oct/hex number" NL
    6.21          "-f force" NL
    6.22 +        "-64 for cpu64 only" NL
    6.23          "Defaults:" NL
    6.24          "\timage=bzImage" NL
    6.25          "\tinitrd,vga,root=(void)" NL
    6.26 @@ -50,31 +55,29 @@
    6.27      // Parse command line
    6.28  #ifdef	USE_ARGSTR
    6.29      if (!argv[1]) syntax();
    6.30 -    {for (;;) {
    6.31 +    for (;;) {
    6.32  	const char **clp = &cmdline;
    6.33 -    next:
    6.34  	argv++;
    6.35 -	if (!*argv) {
    6.36 +	if (!*argv) goto boot;
    6.37 +        if ((*(u16 *)*argv|2) == 0x362F) {	// -64 /64
    6.38 +	    if (cpuhaslm() == 0) exit();
    6.39 +	}
    6.40 +        if ((*(u16 *)*argv|0x2002) == 0x662F) {	// -F /f
    6.41 +	    skip_alloc++;
    6.42 +	}
    6.43 +	else if (argstr(*argv,"cl|image|initrd",clp) != -1);
    6.44 +	else if (fileexist(*argv) != -1)
    6.45 +            kernel_name=*argv;
    6.46 +	else if (argnum(*argv,"root|vga|mem|-b",&root_dev) != -1);
    6.47 +	else {
    6.48 +	    *clp = (const char *) buf_cmdline + 1;
    6.49 +	    strcatb((const char *) buf_cmdline,*argv);
    6.50 +	boot:
    6.51              puts(*clp);
    6.52  	    set_cmdline(*clp);
    6.53  	    puts(load_kernel());
    6.54  	    load_initrd();
    6.55  	    boot_kernel();
    6.56 -	}
    6.57 -        if ((*(u16 *)*argv|0x2002) == 0x662F) {	// -F /f
    6.58 -	    skip_alloc++;
    6.59 -	    goto next;
    6.60 -	}
    6.61 -	if (argstr(*argv,"cl|image|initrd",clp) != -1);
    6.62 -	else if (fileexist(*argv) != -1)
    6.63 -            kernel_name=*argv;
    6.64 -	else if (*argv) {
    6.65 -	    argnum(*argv,"root|vga|mem|-b",&root_dev);
    6.66 -	    *clp = (const char *) buf_cmdline + 1;
    6.67 -	    strcatb((const char *) buf_cmdline,*argv);
    6.68 -	}
    6.69 -	else
    6.70 -	    break;
    6.71          }
    6.72      }
    6.73  #else
    6.74 @@ -96,6 +99,9 @@
    6.75              *(u16*)&vid_mode = (u16)strtol(s+7);	// support normal, extended & ask
    6.76          }
    6.77          else switch (*(u16 *)s|0x2002) {
    6.78 +        case 0x362F:	// -64 /64
    6.79 +	    if (cpuhaslm() == 0) exit();
    6.80 +	    goto next;
    6.81  	case 0x662F:	// -F /f
    6.82  	    skip_alloc++;
    6.83  	    goto next;
     7.1 --- a/linld/stuff/src/LOAD.CPP	Sat Oct 12 12:08:52 2019 +0200
     7.2 +++ b/linld/stuff/src/LOAD.CPP	Mon Oct 14 11:20:06 2019 +0200
     7.3 @@ -191,13 +191,13 @@
     7.4              //   heap_end_ptr appears to be relative to the start of setup (ofs 0x0200)
     7.5              kernelparams->heap_end_ptr = _32k-0x0200;
     7.6              kernelparams->loadflags |= 0x80; // says to rm loader it's ok to use heap
     7.7 -        }
     7.8 -        // * if we will ever stop moving ourself to 0x90000
     7.9 -        //   we must say setup.S how much to move
    7.10 -        //kernelparams->setup_move_size = _32k;
    7.11 -        if(kernelparams->version >= 0x202) { // starting linux 2.4.0-test3-pre3
    7.12 -            kernelparams->cmd_line_ptr = (((u32)(topseg()+0x0800))<<4);
    7.13 -            goto cmd_line_ok;
    7.14 +            // * if we will ever stop moving ourself to 0x90000
    7.15 +            //   we must say setup.S how much to move
    7.16 +            //kernelparams->setup_move_size = _32k;
    7.17 +            if(kernelparams->version >= 0x202) { // starting linux 2.4.0-test3-pre3
    7.18 +                kernelparams->cmd_line_ptr = (((u32)(topseg()+0x0800))<<4);
    7.19 +                goto cmd_line_ok;
    7.20 +            }
    7.21          }
    7.22      }
    7.23      first1k->cl_magic_ofs = 0x8000A33F;
     8.1 --- a/linld/stuff/src/MEMCPY32.ASM	Sat Oct 12 12:08:52 2019 +0200
     8.2 +++ b/linld/stuff/src/MEMCPY32.ASM	Mon Oct 14 11:20:06 2019 +0200
     8.3 @@ -2,6 +2,7 @@
     8.4  ;****** This file is distributed under GPL
     8.5  ;***************************************************************
     8.6                  ideal
     8.7 +		%PAGESIZE 1000
     8.8                  %crefref
     8.9                  %noincl
    8.10                  %nomacs
     9.1 --- a/linld/stuff/src/MEMTOP.ASM	Sat Oct 12 12:08:52 2019 +0200
     9.2 +++ b/linld/stuff/src/MEMTOP.ASM	Mon Oct 14 11:20:06 2019 +0200
     9.3 @@ -2,6 +2,7 @@
     9.4  ;****** This file is distributed under GPL
     9.5  ;***************************************************************
     9.6                  ideal
     9.7 +		%PAGESIZE 1000
     9.8                  %crefref
     9.9                  %noincl
    9.10                  %nomacs
    10.1 --- a/linld/stuff/src/VCPI.ASM	Sat Oct 12 12:08:52 2019 +0200
    10.2 +++ b/linld/stuff/src/VCPI.ASM	Mon Oct 14 11:20:06 2019 +0200
    10.3 @@ -24,6 +24,7 @@
    10.4  
    10.5  
    10.6                  ideal
    10.7 +		%PAGESIZE 1000
    10.8                  %crefref
    10.9                  %noincl
   10.10                  %nomacs
    11.1 --- a/linld/stuff/src/XMM.ASM	Sat Oct 12 12:08:52 2019 +0200
    11.2 +++ b/linld/stuff/src/XMM.ASM	Mon Oct 14 11:20:06 2019 +0200
    11.3 @@ -2,6 +2,7 @@
    11.4  ;****** This file is distributed under GPL
    11.5  ;***************************************************************
    11.6                  ideal
    11.7 +		%PAGESIZE 1000
    11.8                  %crefref
    11.9                  %noincl
   11.10                  %nomacs
    12.1 --- a/linld/stuff/src/_BEG.ASM	Sat Oct 12 12:08:52 2019 +0200
    12.2 +++ b/linld/stuff/src/_BEG.ASM	Mon Oct 14 11:20:06 2019 +0200
    12.3 @@ -2,6 +2,7 @@
    12.4  ;****** This file is distributed under GPL
    12.5  ;***************************************************************
    12.6                  ideal
    12.7 +		%PAGESIZE 1000
    12.8                  %crefref
    12.9                  %noincl
   12.10                  %nomacs
   12.11 @@ -33,10 +34,8 @@
   12.12          label   _bss_start byte
   12.13  		db	STACK_SIZE-2 dup(?)
   12.14  stktop		dw	?
   12.15 -		ifdef	EXTRA
   12.16          global  _cpu_features:dword
   12.17  _cpu_features	dd	?
   12.18 -		endif
   12.19          ends    _BSS
   12.20  
   12.21          segment _TEXT byte public use16 'CODE'
   12.22 @@ -148,7 +147,6 @@
   12.23  		jnz	no_vcpi
   12.24  		inc	[byte bx+_vcpi-msg_badmapping]
   12.25  endcpu386:
   12.26 -		ifdef	EXTRA
   12.27  		pushfd
   12.28  		pop	dx
   12.29  		pop	ax
   12.30 @@ -166,7 +164,6 @@
   12.31  		cpuid
   12.32  		mov	[_cpu_features],edx
   12.33  @@no_cpuid:
   12.34 -		endif
   12.35  endcpu86:
   12.36                  p8086
   12.37  
    13.1 --- a/linld/stuff/src/pipehole.awk	Sat Oct 12 12:08:52 2019 +0200
    13.2 +++ b/linld/stuff/src/pipehole.awk	Mon Oct 14 11:20:06 2019 +0200
    13.3 @@ -6,16 +6,85 @@
    13.4  	if (/^@.*:$/ || /	endp$/) afterjmp=0
    13.5  	if (/^	\.386p$/) is386=1
    13.6  	if (file == "" && /debug	S/) { file=$3; gsub(/\"/,"",file) }
    13.7 +	if (/debug	S/) print "	%PAGESIZE 1000"
    13.8 +	 if (file == "tazboot.cpp") {
    13.9 +	if (/add	si,2/) $0="	lodsw	; " $0
   13.10 +	if (/add	si,4/) { print "	lodsw"; $0="	lodsw	; " $0 }
   13.11 +	if (/add	di,2/) $0="	scasw	; " $0
   13.12 +	 } # file == "tazboot.cpp"
   13.13 +	 if (file == "linld.cpp") {
   13.14 +	if (/add	si,2/) $0="	lodsw	; " $0
   13.15 +	if (/add	di,2/) $0="	scasw	; " $0
   13.16 +	if (/bx,offset DGROUP:s@\+26/) sub(/mov/,";mov")
   13.17 +	if (islinld==1) {
   13.18 +		print "; " $0
   13.19 +		if (!/word ptr/) next
   13.20 +		islinld=0
   13.21 +		sub(/,word.*/,",di	; argv")
   13.22 +		if (/di,di/) { print "; " $0; next }
   13.23 +	}
   13.24 +	if (/^_main	proc/) islinld=1
   13.25 +	if (/== 0x662F/) islinld=2
   13.26 +	if (islinld==2) {
   13.27 +		if (/cpuhaslm/) islinld=0
   13.28 +		if (/mov/) { print "; " $0; next }
   13.29 +	}
   13.30 +	if (/image\|initrd/) islinld=3
   13.31 +	if (islinld==3) {
   13.32 +		if (/bx,word ptr/) { islinld=0; print "; " $0; next }
   13.33 +	}
   13.34 +	if (/fileexist\$qpxzc/) islinld=4
   13.35 +	if (islinld==4) {
   13.36 +		if (/ax,-1/) print "	mov	bx,word ptr [si]"
   13.37 +		if (/ax,word ptr/) $0="	xchg	ax,bx"
   13.38 +		if (/\[si\]$/) { islinld=0; print "; " $0; next }
   13.39 +	}
   13.40 +	 } # file == "linld.cpp"
   13.41  	 if (file == "himem.cpp") {
   13.42 -	if (/remaining = m-/) ishimem=1
   13.43 +	if (/void load_image/) ishimem=1
   13.44  	if (ishimem == 1 && is386 == 0) {
   13.45  		if (/si\+8\]$/ || /si\+4\]$/ || /si\+16\]$/) next
   13.46  		if (/si\+6\]$/ || /si\+2\]$/ || /si\+14\]$/) sub(/mov	dx,/,"les	dx,d")
   13.47  		if (/si\+12\],ax/ || /si\+16\],ax/ || /bp-2\],ax/) sub(/,ax/,",es")
   13.48 -		if (/do \{/) ishimem=0
   13.49 +	}
   13.50 +	if (ishimem == 1) {
   13.51 +		if (/do \{/) ishimem=2
   13.52 +		if (/byte ptr DGROUP:_vcpi,0/) print "	mov	bx,si"
   13.53 +		if (/bx,si/) next
   13.54 +		if (/sp,6/) {
   13.55 +			print "	push	si"
   13.56 +			print "	push	si"
   13.57 +			next
   13.58 +		}
   13.59 +	}
   13.60 +	if (ishimem == 2) {
   13.61 +		if (/movzx/) print "	cwde"
   13.62 +		if (/bp-6/) next
   13.63 +		if (/storepage.bufv/) {
   13.64 +			print "	inc	ax"
   13.65 +			print "	push	ax"
   13.66 +		}
   13.67 +		if (/buf \+= size;/) {
   13.68 +			print "	pop	ax"
   13.69 +		}
   13.70 +		if (/Read error/) ishimem=0
   13.71  	}
   13.72  	 } # file == "himem.cpp"
   13.73  	 if (file == "load.cpp") {
   13.74 +	if (/word ptr \[si\+21\],513$/) isload=11
   13.75 +	if (isload == 12) {  # LOAD.LST
   13.76 +		if (/cmp/) next
   13.77 +		if (/jb/) isload=0
   13.78 +		sub(/jb/,"jcxz")
   13.79 +	}
   13.80 +	if (isload == 11) {  # LOAD.LST
   13.81 +		if (/cmp/) {
   13.82 +			print "	mov	cx,513"
   13.83 +			$0="	sub	cx,word ptr [si+21]"
   13.84 +		}
   13.85 +		if (/jb/) isload=12
   13.86 +		sub(/jb/,"ja")
   13.87 +	}
   13.88  	sub(/DGROUP:_imgs\+65534/,"[di-2]")
   13.89  	if (/short @1@366$/) isload=10
   13.90  	if (isload == 10) {  # LOAD.LST
   13.91 @@ -53,10 +122,7 @@
   13.92  	}
   13.93  	if (/\[0\] = m-\>fallback/) isload=6
   13.94  	if (isload == 6) {  # LOAD.LST
   13.95 -		if (/si\+2/) {
   13.96 -			print "	inc	si"
   13.97 -			$0="	inc	si"
   13.98 -		}
   13.99 +		if (/si\+2/) $0="	lodsw"
  13.100  		if (/les/) sub(/bx,/,"ax,")
  13.101  		if (/bx\+4/ || /es:/) {
  13.102  			if (/bx\+4/) isload=0
    14.1 --- a/memtest/stuff/bootloader.S	Sat Oct 12 12:08:52 2019 +0200
    14.2 +++ b/memtest/stuff/bootloader.S	Mon Oct 14 11:20:06 2019 +0200
    14.3 @@ -467,7 +467,9 @@
    14.4  # Assume no error on first track.
    14.5  
    14.6  #ifdef FLOPPY_1440K_ONLY
    14.7 +#ifndef FLOPPY_HAS_2_SIDES
    14.8  #define FLOPPY_HAS_2_SIDES	hardcore heads count to 2
    14.9 +#endif
   14.10  #define FLOPPY_SECTORS		18	/* 18 sectors */
   14.11  #else
   14.12  #define FLOPPY_HEADS		2	/* 2 heads minimum */