9boot: change to new *e820= format, support for 64bit kernels
This commit is contained in:
parent
bfb84cc46a
commit
0209e21f45
1 changed files with 26 additions and 23 deletions
|
@ -330,19 +330,20 @@ e820conf(void)
|
||||||
|
|
||||||
do{
|
do{
|
||||||
bx = e820(bx, &e);
|
bx = e820(bx, &e);
|
||||||
if(e.typ == 1 && e.len != 0 && (e.ext & 3) == 1){
|
if(e.len != 0 && (e.ext & 3) == 1){
|
||||||
if(confend == s){
|
if(confend == s){
|
||||||
/* single entry <= 1MB is useless */
|
/* single entry <= 1MB is useless */
|
||||||
if(bx == 0 && e.len <= 0x100000)
|
if(bx == 0 && e.typ == 1 && e.len <= 0x100000)
|
||||||
break;
|
break;
|
||||||
memmove(confend, "e820=", 5);
|
memmove(confend, "*e820=", 6);
|
||||||
confend += 5;
|
confend += 6;
|
||||||
}
|
}
|
||||||
|
addconfx("", 1, e.typ);
|
||||||
v = e.base;
|
v = e.base;
|
||||||
addconfx("", 8, v>>32);
|
addconfx(" 0x", 8, v>>32);
|
||||||
addconfx("", 8, v&0xffffffff);
|
addconfx("", 8, v&0xffffffff);
|
||||||
v += e.len;
|
v += e.len;
|
||||||
addconfx(" ", 8, v>>32);
|
addconfx(" 0x", 8, v>>32);
|
||||||
addconfx("", 8, v&0xffffffff);
|
addconfx("", 8, v&0xffffffff);
|
||||||
*confend++ = ' ';
|
*confend++ = ' ';
|
||||||
}
|
}
|
||||||
|
@ -358,21 +359,10 @@ e820conf(void)
|
||||||
*confend = 0;
|
*confend = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ushort
|
|
||||||
beswab(ushort s)
|
|
||||||
{
|
|
||||||
uchar *p;
|
|
||||||
|
|
||||||
p = (uchar*)&s;
|
|
||||||
return (p[0]<<8) | p[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
static ulong
|
static ulong
|
||||||
beswal(ulong l)
|
beswal(ulong l)
|
||||||
{
|
{
|
||||||
uchar *p;
|
uchar *p = (uchar*)&l;
|
||||||
|
|
||||||
p = (uchar*)&l;
|
|
||||||
return (p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3];
|
return (p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,20 +378,33 @@ bootkern(void *f)
|
||||||
|
|
||||||
if(readn(f, &ex, sizeof(ex)) != sizeof(ex))
|
if(readn(f, &ex, sizeof(ex)) != sizeof(ex))
|
||||||
return "bad header";
|
return "bad header";
|
||||||
if(beswal(ex.magic) != I_MAGIC)
|
|
||||||
return "bad magic";
|
|
||||||
|
|
||||||
e = (uchar*)(beswal(ex.entry) & ~0xF0000000UL);
|
e = (uchar*)(beswal(ex.entry) & ~0xF0000000UL);
|
||||||
|
switch(beswal(ex.magic)){
|
||||||
|
case S_MAGIC:
|
||||||
|
if(readn(f, e, 8) != 8)
|
||||||
|
goto Error;
|
||||||
|
case I_MAGIC:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return "bad magic";
|
||||||
|
}
|
||||||
|
|
||||||
t = e;
|
t = e;
|
||||||
n = beswal(ex.text);
|
n = beswal(ex.text);
|
||||||
|
|
||||||
if(readn(f, t, n) != n)
|
if(readn(f, t, n) != n)
|
||||||
goto Error;
|
goto Error;
|
||||||
d = (uchar*)PGROUND((ulong)t + n);
|
t += n;
|
||||||
|
d = (uchar*)PGROUND((ulong)t);
|
||||||
|
memset(t, 0, d - t);
|
||||||
n = beswal(ex.data);
|
n = beswal(ex.data);
|
||||||
|
|
||||||
if(readn(f, d, n) != n)
|
if(readn(f, d, n) != n)
|
||||||
goto Error;
|
goto Error;
|
||||||
|
d += n;
|
||||||
|
t = (uchar*)PGROUND((ulong)d);
|
||||||
|
t += PGROUND(beswal(ex.bss));
|
||||||
|
memset(d, 0, t - d);
|
||||||
|
|
||||||
close(f);
|
close(f);
|
||||||
unload();
|
unload();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue