wok-next diff syslinux/stuff/iso2exe/a20.c @ rev 17160

syslinux/iso2exe: full zImage support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Sep 17 11:38:34 2014 +0200 (2014-09-17)
parents 3865e09ec026
children c15bb3c9e12d
line diff
     1.1 --- a/syslinux/stuff/iso2exe/a20.c	Thu Mar 13 08:22:47 2014 +0000
     1.2 +++ b/syslinux/stuff/iso2exe/a20.c	Wed Sep 17 11:38:34 2014 +0200
     1.3 @@ -1,83 +1,6 @@
     1.4  #ifndef __A20
     1.5  #define __A20
     1.6  
     1.7 -// http://www.win.tue.nl/~aeb/linux/kbd/A20.html
     1.8 -static void a20enable(void)
     1.9 -{
    1.10 -#asm
    1.11 -		call	a20test
    1.12 -
    1.13 -		in	al, 0x92	// fast A20
    1.14 -		test	al, #0x2
    1.15 -		jnz	no92
    1.16 -		or	al, #0x2	// Enable A20
    1.17 -		and	al, #0xFE	// Do not reset machine
    1.18 -		out	0x92, al
    1.19 -		call	a20test
    1.20 -no92:
    1.21 -		call	empty_8042
    1.22 -		mov	al, #0xD1	// command write
    1.23 -		out	0x64, al 
    1.24 -		call	empty_8042
    1.25 -		mov	al, #0xDF	// Enable A20
    1.26 -		out	0x60, al 
    1.27 -		call	empty_8042
    1.28 -
    1.29 -		mov	al, #0xFF	// Null command, but UHCI wants it
    1.30 -		out	0x64, al 
    1.31 -		call	empty_8042
    1.32 -		call	a20test
    1.33 -		
    1.34 -		mov	ax, #0x2401
    1.35 -		int	0x15
    1.36 -		call	a20test
    1.37 -		
    1.38 -		in	al, 0xEE	// fast enable A20
    1.39 -		jmp	a20test
    1.40 -
    1.41 -empty_8042:
    1.42 -		mov	ah, #-32
    1.43 -wait_8042:
    1.44 -		in	al, 0x64
    1.45 -		inc	ax		// FF 32x : no kbd
    1.46 -		jz	enabled
    1.47 -		dec	ax
    1.48 -		shr	ax, #1		// Bit 0: input data
    1.49 -		jc	data
    1.50 -		shr	ax, #1		// Bit 1: buffer empty
    1.51 -		jc	wait_8042
    1.52 -		ret
    1.53 -data:
    1.54 -		in	al, 0x60	// read data
    1.55 -		jmp	wait_8042
    1.56 -a20test:
    1.57 -		push	ds
    1.58 -		xor	cx, cx
    1.59 -		xor	bx, bx
    1.60 -		mov	ds, cx		// ds = 0000
    1.61 -		dec	cx
    1.62 -		mov	gs, cx		// gs = FFFF
    1.63 -		cli
    1.64 -a1:
    1.65 -		mov	ax, [bx]
    1.66 -		not	ax
    1.67 -		mov	dx, ax
    1.68 -		seg	gs
    1.69 -		xchg	dx, [bx+10]
    1.70 -		cmp	ax, [bx]
    1.71 -		seg	gs
    1.72 -		mov	[bx+10], dx
    1.73 -		loopne	a1
    1.74 -		pop	ds
    1.75 -		xchg	ax, cx
    1.76 -		sti
    1.77 -		jne	enabled
    1.78 -		pop	cx		// quit a20enable
    1.79 -enabled:
    1.80 -		ret			// ax != 0 : enabled
    1.81 -#endasm
    1.82 -}
    1.83 -
    1.84  #define A20HOLDBUFFER	0x80000
    1.85  static int a20buffer = 0;
    1.86  static void movehia20(void)
    1.87 @@ -88,7 +11,7 @@
    1.88  	}
    1.89  	a20buffer = 1;
    1.90  #asm
    1.91 -		pusha
    1.92 +		pusha			// more than 1Mb => 286+
    1.93  		push	#A20HOLDBUFFER/16
    1.94  		pop	es
    1.95  		mov	di, _mem	// mem.base & 0xFFFF
    1.96 @@ -106,9 +29,8 @@
    1.97  static void realmode_switch_a20(void)
    1.98  {
    1.99  	if (!a20buffer) return;
   1.100 -	a20enable();
   1.101  #asm
   1.102 -		pusha
   1.103 +		pusha			// more than 1Mb => 286+
   1.104  		xor	di, di		// 30
   1.105  		mov	cx, #9		// 2E..1E
   1.106  a20z1: