first attempt at reboot stuff
authorBill Joy <bill@ucbvax.Berkeley.EDU>
Fri, 3 Oct 1980 02:41:30 +0000 (18:41 -0800)
committerBill Joy <bill@ucbvax.Berkeley.EDU>
Fri, 3 Oct 1980 02:41:30 +0000 (18:41 -0800)
SCCS-vsn: sys/kern/kern_proc.c 3.24
SCCS-vsn: sys/vax/vax/machdep.c 3.26
SCCS-vsn: sys/kern/subr_prf.c 3.4
SCCS-vsn: sys/vax/vax/locore.s 3.15

usr/src/sys/kern/kern_proc.c
usr/src/sys/kern/subr_prf.c
usr/src/sys/vax/vax/locore.s
usr/src/sys/vax/vax/machdep.c

index 43ab77b..4f5ffeb 100644 (file)
@@ -1,4 +1,4 @@
-/*     kern_proc.c     3.23    %G%     */
+/*     kern_proc.c     3.24    %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -113,7 +113,7 @@ exece()
                bdwrite(bp);
        bp = 0;
        nc = (nc + NBPW-1) & ~(NBPW-1);
                bdwrite(bp);
        bp = 0;
        nc = (nc + NBPW-1) & ~(NBPW-1);
-       getxfile(ip, nc);
+       getxfile(ip, nc + (na+4)*NBPW);
        if (u.u_error) {
 badarg:
                for (c = 0; c < nc; c += BSIZE)
        if (u.u_error) {
 badarg:
                for (c = 0; c < nc; c += BSIZE)
index 9801ea6..cc23bf5 100644 (file)
@@ -1,4 +1,4 @@
-/*     subr_prf.c      3.3     %G%     */
+/*     subr_prf.c      3.4     %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -6,6 +6,7 @@
 #include "../h/buf.h"
 #include "../h/conf.h"
 #include "../h/mtpr.h"
 #include "../h/buf.h"
 #include "../h/conf.h"
 #include "../h/mtpr.h"
+#include "../h/reboot.h"
 
 #ifdef TRACE
 #define        TRCBUFS 4096
 
 #ifdef TRACE
 #define        TRCBUFS 4096
@@ -119,10 +120,8 @@ long n;
 }
 
 /*
 }
 
 /*
- * Panic is called on unresolvable
- * fatal errors.
- * It syncs, prints "panic: mesg" and
- * then loops.
+ * Panic is called on unresolvable fatal errors.
+ * It syncs, prints "panic: mesg", and then reboots.
  */
 panic(s)
 char *s;
  */
 panic(s)
 char *s;
@@ -132,7 +131,7 @@ char *s;
        printf("panic: %s\n", s);
        spl0();
        for(;;)
        printf("panic: %s\n", s);
        spl0();
        for(;;)
-               ;
+               boot(RB_PANIC, RB_AUTOBOOT);            /* 0 = automatic */
 }
 
 /*
 }
 
 /*
index 3beb542..8473b8e 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Machine Language Assist for UC Berkeley Virtual Vax/Unix
 #
 #
 # Machine Language Assist for UC Berkeley Virtual Vax/Unix
 #
-#      locore.s                3.14    %G%
+#      locore.s                3.15    %G%
 #
 
        .set    HIGH,31         # mask for total disable
 #
 
        .set    HIGH,31         # mask for total disable
@@ -186,7 +186,6 @@ doadump:
        pushr   $0x3fff                 # save regs 0 - 13
        calls   $0,_dumptrc             # print out trace information, if any
        calls   $0,_dump                # produce dump
        pushr   $0x3fff                 # save regs 0 - 13
        calls   $0,_dumptrc             # print out trace information, if any
        calls   $0,_dump                # produce dump
-       halt
 
        .data
        .align  2
 
        .data
        .align  2
@@ -313,8 +312,9 @@ ubasrv:
        beql    UBAflt
        pushr   $0xf                    # save regs 0-3
        pushab  SBImsg
        beql    UBAflt
        pushr   $0xf                    # save regs 0-3
        pushab  SBImsg
-       calls   $1,_printf
-       popr    $0xf
+       calls   $1,_panic
+#      popr    $0xf
+
 #
 # No SBI fault bits set in UBA config reg - must be
 # some error bits set in UBA status reg.
 #
 # No SBI fault bits set in UBA config reg - must be
 # some error bits set in UBA status reg.
@@ -890,6 +890,7 @@ start:
        mfpr    $P1BR,PCB_P1BR(r1)
        mfpr    $P1LR,PCB_P1LR(r1)
        movl    $CLSIZE,PCB_SZPT(r1)            # init u.u_pcb.pcb_szpt
        mfpr    $P1BR,PCB_P1BR(r1)
        mfpr    $P1LR,PCB_P1LR(r1)
        movl    $CLSIZE,PCB_SZPT(r1)            # init u.u_pcb.pcb_szpt
+       movl    r11,PCB_R11(r1)
 
        movab   1f,PCB_PC(r1)                   # initial pc
        clrl    PCB_PSL(r1)                     # mode(k,k), ipl=0
 
        movab   1f,PCB_PC(r1)                   # initial pc
        clrl    PCB_PSL(r1)                     # mode(k,k), ipl=0
@@ -1201,13 +1202,6 @@ _copyseg:        .globl  _copyseg
        bisl3   $PG_V|PG_KW,8(ap),CMAP2
        mtpr    $CADDR2,$TBIS   # invalidate entry for copy 
        movc3   $NBPG,*4(ap),CADDR2
        bisl3   $PG_V|PG_KW,8(ap),CMAP2
        mtpr    $CADDR2,$TBIS   # invalidate entry for copy 
        movc3   $NBPG,*4(ap),CADDR2
-       bicl3   $PG_V|PG_M|PG_KW,CMAP2,r1
-       cmpl    r1,8(ap)
-       beql    okcseg
-badcseg:
-       halt
-       jmp     badcseg
-okcseg:
        mtpr    r0,$IPL         # restore pri level
        ret
 
        mtpr    r0,$IPL         # restore pri level
        ret
 
index 3614f68..80691b6 100644 (file)
@@ -1,4 +1,4 @@
-/*     machdep.c       3.25    %G%     */
+/*     machdep.c       3.26    %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
 #include "../h/proc.h"
 #include "../h/psl.h"
 #include "../h/uba.h"
 #include "../h/proc.h"
 #include "../h/psl.h"
 #include "../h/uba.h"
+#include "../h/cons.h"
+#include "../h/reboot.h"
 
 
-char   version[] = "VM/UNIX (Berkeley Version 3.25) %H% \n";
+char   version[] = "VM/UNIX (Berkeley Version 3.26) %H% \n";
 int    icode[] =
 {
        0x9f19af9f,     /* pushab [&"init.vm",0]; pushab */
 int    icode[] =
 {
        0x9f19af9f,     /* pushab [&"init.vm",0]; pushab */
@@ -22,8 +24,8 @@ int   icode[] =
        0xbc5c5ed0,     /* movl sp,ap; chmk */
        0x2ffe110b,     /* $exec; brb .; "/ */
        0x2f637465,     /* etc/ */
        0xbc5c5ed0,     /* movl sp,ap; chmk */
        0x2ffe110b,     /* $exec; brb .; "/ */
        0x2f637465,     /* etc/ */
-       0x74696e69,     /* init */
-       0x006d762e,     /* .vm";  0 */
+       0x74696e69,     /* init" */
+       0x00000000,     /* \0\0\0";  0 */
        0x00000014,     /* [&"init", */
        0x00000000,     /* 0] */
 };
        0x00000014,     /* [&"init", */
        0x00000000,     /* 0] */
 };
@@ -358,3 +360,34 @@ unhang()
                ubareset();
        }
 }
                ubareset();
        }
 }
+
+int    waittime = -1;
+
+boot(panic, arghowto)
+       int panic, arghowto;
+{
+       register int howto;             /* r11 == how to boot */
+       register int devtype;           /* r10 == major of root dev */
+
+       howto = arghowto;
+       printf("howto %d\n", howto);
+       if ((howto&RB_NOSYNC)==0 && waittime < 0) {
+               waittime = 0;
+               update();
+               printf("updating (wait");
+               while (++waittime <= 10) {
+                       printf(".");
+                       sleep((caddr_t)&lbolt, PZERO);
+               }
+               printf(") done\n");
+       }
+       splx(0x1f);                     /* extreme priority */
+       devtype = major(rootdev);
+       if ((howto&RB_HALT)==0) {
+               while ((mfpr(TXCS)&TXCS_RDY) == 0)
+                       continue;
+               mtpr(TXDB, panic == RB_PANIC ? TXDB_AUTOR : TXDB_BOOT);
+       }
+       for (;;)
+               asm("halt");
+}