From eeb0a660244d28067d92660bd4bde598d64805b5 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 20 Apr 2011 13:19:06 +0000 Subject: 9boot: oops, it all was just a20 gate not being enabled --- sys/src/boot/pc/a20.s | 8 ++++++++ sys/src/boot/pc/pxe.c | 10 ++++++++-- sys/src/boot/pc/sub.c | 17 ++--------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/sys/src/boot/pc/a20.s b/sys/src/boot/pc/a20.s index 53b7af5cb..0455a5952 100644 --- a/sys/src/boot/pc/a20.s +++ b/sys/src/boot/pc/a20.s @@ -14,6 +14,14 @@ TEXT a20(SB), $0 _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 diff --git a/sys/src/boot/pc/pxe.c b/sys/src/boot/pc/pxe.c index 5fefd72b0..a950b2579 100644 --- a/sys/src/boot/pc/pxe.c +++ b/sys/src/boot/pc/pxe.c @@ -113,8 +113,14 @@ unload(void) 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 diff --git a/sys/src/boot/pc/sub.c b/sys/src/boot/pc/sub.c index 40a77fd3b..02d75aed5 100644 --- a/sys/src/boot/pc/sub.c +++ b/sys/src/boot/pc/sub.c @@ -212,30 +212,17 @@ bootkern(void *f) 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"; -- cgit v1.2.3