wok diff syslinux/stuff/iso2exe/a20.c @ rev 19838

syslinux/iso2exe: fix hybrid mbr read
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Mar 12 09:47:07 2017 +0100 (2017-03-12)
parents c15bb3c9e12d
children
line diff
     1.1 --- a/syslinux/stuff/iso2exe/a20.c	Wed Sep 17 15:21:35 2014 +0200
     1.2 +++ b/syslinux/stuff/iso2exe/a20.c	Sun Mar 12 09:47:07 2017 +0100
     1.3 @@ -1,65 +1,39 @@
     1.4  #ifndef __A20
     1.5  #define __A20
     1.6  
     1.7 -#define A20HOLDBUFFER	0x80000
     1.8 -static int a20buffer = 0;
     1.9 -static void movehia20(void)
    1.10 -{
    1.11 -	if ((mem.base >> 16) != 0x10) {
    1.12 -		movehi();
    1.13 -		return;
    1.14 -	}
    1.15 -	a20buffer = 1;
    1.16 -#asm
    1.17 -		pusha			// more than 1Mb => 286+
    1.18 -		push	#A20HOLDBUFFER/16
    1.19 -		pop	es
    1.20 -		mov	di, _mem	// mem.base & 0xFFFF
    1.21 -		mov	si, #_buffer
    1.22 -		mov	cx, #BUFFERSZ/2
    1.23 -		cld
    1.24 -		rep
    1.25 -		  movsw
    1.26 -		popa
    1.27 -#endasm
    1.28 -}
    1.29 -#define movehi movehia20
    1.30 -
    1.31  static void dosshutdowna20(void)
    1.32  {
    1.33 -	if (a20buffer) {
    1.34  #asm
    1.35 +	call	_dosshutdown
    1.36 +	xor	ax, ax			// 30
    1.37 +	cmp	ax, _a20buffer
    1.38 +	je	no_a20buffer
    1.39  		pusha			// more than 1Mb => 286+
    1.40 -		xor	di, di		// 30
    1.41  		mov	cx, #9		// 2E..1E
    1.42  a20z1:
    1.43 -		push	di
    1.44 +		push	ax
    1.45  		loop	a20z1
    1.46 -		push	#0x10
    1.47 -		push	di		// 1A 0x100000
    1.48 +		push	#0x9310
    1.49 +		push	ax		// 1A 0x100000
    1.50  		push	#-1		// 18
    1.51 -		push	di		// 16
    1.52 -		push	#A20HOLDBUFFER/0x10000
    1.53 -		push	di		// 12 A20HOLDBUFFER
    1.54 +		push	ax		// 16
    1.55 +		push	#0x9300+A20HOLDBUFFER/0x10000
    1.56 +		push	ax		// 12 A20HOLDBUFFER
    1.57  		push	#-1		// 10
    1.58  		mov	cl, #8		// 0E..00
    1.59  a20z2:
    1.60 -		push	di
    1.61 +		push	ax
    1.62  		loop	a20z2
    1.63  		mov	ch, #0x10000/512
    1.64  		push	ss
    1.65  		pop	es
    1.66  		mov	si, sp
    1.67 -		mov	ax, #0x8793
    1.68 -		mov	[si+0x15], al
    1.69 -		xchg	[si+0x1D], al
    1.70 -		xchg	[si+0x1F], al	// bits 24..31
    1.71 +		mov	ah, #0x87
    1.72  		int	0x15
    1.73  		add	sp, #0x30
    1.74  		popa
    1.75 +no_a20buffer:
    1.76  #endasm
    1.77 -	}
    1.78 -	dosshutdown();
    1.79  }
    1.80  
    1.81  #define dosshutdown dosshutdowna20