]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/boot/pc/sub.c
9boot: increase timeout, do less printing
[plan9front.git] / sys / src / boot / pc / sub.c
index 428bc8cf5d90e9646bb69bb20267d104d4129e7f..ddeeba9cf09acc1deabed96fda5f6f2cb110e38a 100644 (file)
@@ -85,13 +85,19 @@ readn(void *f, void *data, int len)
 {
        uchar *p, *e;
 
+       putc(' ');
        p = data;
        e = p + len;
        while(p < e){
+               if(((ulong)p & 0xF000) == 0){
+                       putc('\b');
+                       putc(hex[((ulong)p>>16)&0xF]);
+               }
                if((len = read(f, p, e - p)) <= 0)
                        break;
                p += len;
        }
+       putc('\b');
        return p - (uchar*)data;
 }
 
@@ -110,7 +116,7 @@ readline(void *f, char buf[64])
                                putc(*p = getc());
                                if(*p == '\r')
                                        putc('\n');
-                               else if(*p == 0x08 && p > buf){
+                               else if(*p == '\b' && p > buf){
                                        p--;
                                        continue;
                                }
@@ -149,6 +155,7 @@ timeout(int ms)
 char *confend;
 
 static void apmconf(int);
+static void e820conf(void);
 
 char*
 configure(void *f, char *path)
@@ -159,8 +166,12 @@ Clear:
        kern = 0;
        inblock = 0;
 
-       confend = (char*)BOOTARGS;
+       memset(BOOTLINE, 0, BOOTLINELEN);
+
+       confend = BOOTARGS;
        memset(confend, 0, BOOTARGSLEN);
+
+       e820conf();
 Loop:
        while((n = readline(f, line)) > 0){
                if(*line == 0 || strchr("#;=", *line))
@@ -193,7 +204,7 @@ Loop:
                close(f);
                f = 0;
 
-               if(kern && timeout(500))
+               if(kern && timeout(1000))
                        goto Loop;
        }
 
@@ -208,24 +219,6 @@ Loop:
 }
 
 
-static ushort
-beswab(ushort s)
-{
-       uchar *p;
-
-       p = (uchar*)&s;
-       return (p[0]<<8) | p[1];
-}
-
-static ulong
-beswal(ulong l)
-{
-       uchar *p;
-
-       p = (uchar*)&l;
-       return (p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3];
-}
-
 static void
 hexfmt(char *s, int i, ulong a)
 {
@@ -322,6 +315,24 @@ e820conf(void)
        *confend++ = '\n';
 }
 
+static ushort
+beswab(ushort s)
+{
+       uchar *p;
+
+       p = (uchar*)&s;
+       return (p[0]<<8) | p[1];
+}
+
+static ulong
+beswal(ulong l)
+{
+       uchar *p;
+
+       p = (uchar*)&l;
+       return (p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3];
+}
+
 void a20(void);
 
 char*
@@ -331,9 +342,8 @@ bootkern(void *f)
        ulong n;
        Exec ex;
 
-       e820conf();
-
        a20();
+
        if(readn(f, &ex, sizeof(ex)) != sizeof(ex))
                return "bad header";
        if(beswal(ex.magic) != I_MAGIC)
@@ -342,16 +352,22 @@ bootkern(void *f)
        e = (uchar*)(beswal(ex.entry) & ~0xF0000000UL);
        t = e;
        n = beswal(ex.text);
+
        if(readn(f, t, n) != n)
                goto Error;
        d = (uchar*)PGROUND((ulong)t + n);
        n = beswal(ex.data);
+
        if(readn(f, d, n) != n)
                goto Error;
        close(f);
        unload();
-       memset(BOOTLINE, 0, BOOTLINELEN);
+
+       print("boot");
+       print(crnl);
+
        jump(e);
+
 Error:         
        return "i/o error";
 }