rpms/grub/devel grub-0.97-gate-a20.patch,NONE,1.1

Matthew Garrett mjg59 at fedoraproject.org
Thu Nov 12 22:41:50 UTC 2009


Author: mjg59

Update of /cvs/pkgs/rpms/grub/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv32413

Added Files:
	grub-0.97-gate-a20.patch 
Log Message:
grub-0.97-gate-a20.patch: Add A20 patch from OpenSuse package. Gets things
booting on the Kohjinsha SC3.


grub-0.97-gate-a20.patch:
 asm.S |   82 +++++++++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 46 insertions(+), 36 deletions(-)

--- NEW FILE grub-0.97-gate-a20.patch ---
diff -ur grub-0.97.orig/stage2/asm.S grub-0.97/stage2/asm.S
--- grub-0.97.orig/stage2/asm.S	2009-11-12 16:35:33.000000000 -0500
+++ grub-0.97/stage2/asm.S	2009-11-12 17:39:23.000000000 -0500
@@ -1622,36 +1622,57 @@
  */
 
 ENTRY(gateA20)
+	pushl	%ebx
+	pushl	%edx
+	call	testA20
+	jnz	1f
+	call	A20_BIOS
+	call	testA20
+	jnz	1f
+	call	A20_PORT92
+	call	testA20
+	jnz	1f
+	call	A20_KBDCTL
+	call	testA20
+	jnz	1f
+	movl	$0,%eax
+	jmp	2f
+1:
+	movl	$-1,%eax
+2:
+	popl	%edx
+	popl	%ebx
+	ret
+
+testA20:
+	movl	0x500,%eax
+	movl	0x100500,%ebx
+	notl	%eax
+	movl	%eax,0x100500
+	cmpl	%eax,0x500
+	pushfl
+	movl	%ebx,0x100500
+	notl	%eax
+	movl	%eax,0x500
+	popfl
+	ret
+
+A20_BIOS:
 	/* first, try a BIOS call */
-	pushl	%ebp
-	movl	8(%esp), %edx
 	
 	call	EXT_C(prot_to_real)
 	
 	.code16
-	movw	$0x2400, %ax
-	testw	%dx, %dx
-	jz	1f
-	incw	%ax
+	movw	$0x2401, %ax
 1:	stc
 	int	$0x15
-	jnc	2f
-
-	/* set non-zero if failed */
-	movb	$1, %ah
-
-	/* save the status */
-2:	movb	%ah, %dl
 
 	DATA32	call	EXT_C(real_to_prot)
 	.code32
-
-	popl	%ebp
-	testb	%dl, %dl
-	jnz	3f
 	ret
 
-3:	/*
+A20_PORT92:
+	/*
 	* try to switch gateA20 using PORT92, the "Fast A20 and Init"
 	* register
 	*/
@@ -1661,20 +1682,18 @@
 	cmpb	$0xff, %al
 	jz	6f
 
-	/* set or clear bit1, the ALT_A20_GATE bit */
-	movb	4(%esp), %ah
-	testb	%ah, %ah
-	jz	4f
+	/* set bit1, the ALT_A20_GATE bit */
 	orb	$2, %al
-	jmp	5f
-4:	and	$0xfd, %al
+	/*     	and     $0xfd, %al */
 
 	/* clear the INIT_NOW bit; don't accidently reset the machine */
-5:	and	$0xfe, %al
+	and	$0xfe, %al
 	outb	%al, %dx
+6:
+	ret
 
-
-6:	/* use keyboard controller */
+A20_KBDCTL:
+	/* use keyboard controller */
 	pushl	%eax
 
 	call    gloop1
@@ -1684,18 +1703,11 @@
 
 gloopint1:
 	inb	$K_STATUS
-	cmpb	$0xff, %al
-	jz	gloopint1_done
 	andb	$K_IBUF_FUL, %al
 	jnz	gloopint1
 
-gloopint1_done:
 	movb	$KB_OUTPUT_MASK, %al
-	cmpb	$0, 0x8(%esp)
-	jz	gdoit
-
 	orb	$KB_A20_ENABLE, %al
-gdoit:
 	outb	$K_RDWR
 
 	call	gloop1
@@ -1710,8 +1722,6 @@
 
 gloop1:
 	inb	$K_STATUS
-	cmpb	$0xff, %al
-	jz	gloop2ret
 	andb	$K_IBUF_FUL, %al
 	jnz	gloop1
 




More information about the fedora-extras-commits mailing list