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

This commit is contained in:
cinap_lenrek 2011-04-20 13:19:06 +00:00
parent 999cc5fd21
commit eeb0a66024
3 changed files with 18 additions and 17 deletions

View file

@ -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

View file

@ -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

View file

@ -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";