git: 9front

Download patch

ref: 55955eecf0303db93dc802c44b6571418219baa4
parent: 03c500b07375b2c16034647517ae2a6a2d6ae457
author: cinap_lenrek <cinap_lenrek@localhost>
date: Wed Apr 20 09:19:06 EDT 2011

9boot: oops, it all was just a20 gate not being enabled

--- a/sys/src/boot/pc/a20.s
+++ b/sys/src/boot/pc/a20.s
@@ -14,6 +14,14 @@
 _biosfail:
 	CALL16(pmode32(SB))
 
+	/* fast a20 */
+	MOVL $0x92, DX
+	INB
+	ANDB $0xFE, AX
+	ORB $0x02, AX
+	OUTB
+
+	/* slow a20 */
 	CALL a20wait(SB)
 	MOVL $0x64, DX
 	MOVB $0xAD, AL
--- a/sys/src/boot/pc/pxe.c
+++ b/sys/src/boot/pc/pxe.c
@@ -113,8 +113,14 @@
 		uchar status[2];
 		uchar junk[10];
 	} buf;
-	memset(&buf, 0, sizeof(buf));
-	pxecall(0x70, &buf);
+	static uchar shutdown[] = { 0x05, 0x070, 0x02, 0 };
+	uchar *o;
+
+	for(o = shutdown; *o; o++){ 
+		memset(&buf, 0, sizeof(buf));
+		if(pxecall(*o, &buf))
+			break;
+	}
 }
 
 static int
--- a/sys/src/boot/pc/sub.c
+++ b/sys/src/boot/pc/sub.c
@@ -212,30 +212,17 @@
 	if(beswal(ex.magic) != I_MAGIC)
 		return "bad magic";
 
-	/* load address */
 	e = (uchar*)(beswal(ex.entry) & ~0xF0000000UL);
-
-	/*
-	 * the kernels load addess (entry) might overlap
-	 * with some bios memory (pxe) that is needed to load
-	 * it. so we read it to this address and after
-	 * we finished, move it to final location.
-	 */
-	t = (uchar*)0x200000;
-
+	t = e;
 	n = beswal(ex.text);
 	if(readn(f, t, n) != n)
 		goto Error;
-	d = t + ((uchar*)PGROUND((ulong)e + n) - e);
+	d = (uchar*)PGROUND((ulong)t + n);
 	n = beswal(ex.data);
 	if(readn(f, d, n) != n)
 		goto Error;
 	close(f);
-
 	unload();
-
-	n = (d + n) - t;
-	memmove(e, t, n);
 	jump(e);
 Error:		
 	return "i/o error";
--