multiboot: use initrd for config

This commit is contained in:
aiju 2012-07-13 18:52:39 +02:00
parent c03913c62d
commit c612f9c41f
2 changed files with 26 additions and 0 deletions

View file

@ -52,6 +52,10 @@ TEXT _multibootheader(SB), $0
LONG $0 /* height */
LONG $0 /* depth */
/*
* the kernel expects the data segment to be page-aligned
* multiboot bootloaders put the data segment right behind text
*/
TEXT _multibootentry(SB), $0
MOVL $etext-KZERO(SB), SI
MOVL SI, DI
@ -64,10 +68,16 @@ TEXT _multibootentry(SB), $0
STD
REP; MOVSB
CLD
ADDL $KZERO, BX
MOVL BX, multiboot-KZERO(SB)
MOVL $_startPADDR(SB), AX
ANDL $~KZERO, AX
JMP* AX
/* multiboot structure pointer */
TEXT multiboot(SB), $0
LONG $0
/*
* In protected mode with paging turned off and segment registers setup
* to linear map all memory. Entered via a jump to PADDR(entry),

View file

@ -37,6 +37,22 @@ options(void)
{
long i, n;
char *cp, *line[MAXCONF], *p, *q;
ulong *m, l;
extern ulong *multiboot;
if(multiboot != nil){
cp = BOOTARGS;
*cp = 0;
if((*multiboot & 8) != 0 && multiboot[5] > 0){
m = KADDR(multiboot[6]);
l = m[1] - m[0];
m = KADDR(m[0]);
if(l >= BOOTARGSLEN)
l = BOOTARGSLEN - 1;
memmove(cp, m, l);
cp[l] = 0;
}
}
/*
* parse configuration args from dos file plan9.ini