9boot: replace dots by printing 64k block number in hex

cinap_lenrek 2011-05-15 14:34:37 +00:00
parent bf03cb3084
commit 38e42ab857
2 changed files with 22 additions and 5 deletions

View File

@ -144,7 +144,6 @@ read(void *f, void *data, int len)
if((fp->clust >> 4) == fat->eofmark) if((fp->clust >> 4) == fat->eofmark)
return -1; return -1;
fp->lbaoff = (fp->clust - 2) * fat->clustsize; fp->lbaoff = (fp->clust - 2) * fat->clustsize;
putc('.');
fp->clust = readnext(fp, fp->clust); fp->clust = readnext(fp, fp->clust);
fp->lba = fp->lbaoff + fat->datalba; fp->lba = fp->lbaoff + fat->datalba;
} }

View File

@ -85,13 +85,19 @@ readn(void *f, void *data, int len)
{ {
uchar *p, *e; uchar *p, *e;
putc(' ');
p = data; p = data;
e = p + len; e = p + len;
while(p < e){ while(p < e){
if(((ulong)p & 0xF000) == 0){
putc('\b');
putc(hex[((ulong)p>>16)&0xF]);
}
if((len = read(f, p, e - p)) <= 0) if((len = read(f, p, e - p)) <= 0)
break; break;
p += len; p += len;
} }
putc('\b');
return p - (uchar*)data; return p - (uchar*)data;
} }
@ -110,7 +116,7 @@ readline(void *f, char buf[64])
putc(*p = getc()); putc(*p = getc());
if(*p == '\r') if(*p == '\r')
putc('\n'); putc('\n');
else if(*p == 0x08 && p > buf){ else if(*p == '\b' && p > buf){
p--; p--;
continue; continue;
} }
@ -149,6 +155,7 @@ timeout(int ms)
char *confend; char *confend;
static void apmconf(int); static void apmconf(int);
static void e820conf(void);
char* char*
configure(void *f, char *path) configure(void *f, char *path)
@ -159,7 +166,9 @@ Clear:
kern = 0; kern = 0;
inblock = 0; inblock = 0;
confend = (char*)BOOTARGS; memset(BOOTLINE, 0, BOOTLINELEN);
confend = BOOTARGS;
memset(confend, 0, BOOTARGSLEN); memset(confend, 0, BOOTARGSLEN);
Loop: Loop:
while((n = readline(f, line)) > 0){ while((n = readline(f, line)) > 0){
@ -187,6 +196,7 @@ Loop:
*confend++ = '\n'; *confend++ = '\n';
print(line); print(crnl); print(line); print(crnl);
} }
e820conf();
*confend = 0; *confend = 0;
if(f){ if(f){
@ -331,9 +341,11 @@ bootkern(void *f)
ulong n; ulong n;
Exec ex; Exec ex;
e820conf(); print("boot");
print(crnl);
a20(); a20();
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) if(beswal(ex.magic) != I_MAGIC)
@ -342,16 +354,22 @@ bootkern(void *f)
e = (uchar*)(beswal(ex.entry) & ~0xF0000000UL); e = (uchar*)(beswal(ex.entry) & ~0xF0000000UL);
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); d = (uchar*)PGROUND((ulong)t + n);
n = beswal(ex.data); n = beswal(ex.data);
if(readn(f, d, n) != n) if(readn(f, d, n) != n)
goto Error; goto Error;
close(f); close(f);
unload(); unload();
memset(BOOTLINE, 0, BOOTLINELEN);
print("go!");
print(crnl);
jump(e); jump(e);
Error: Error:
return "i/o error"; return "i/o error";
} }