From 0dc06be8558092012a0b3136344d6c2960b2818d Mon Sep 17 00:00:00 2001 From: Bill Joy Date: Thu, 2 Oct 1980 18:41:30 -0800 Subject: [PATCH] first attempt at reboot stuff 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 | 4 ++-- usr/src/sys/kern/subr_prf.c | 11 +++++----- usr/src/sys/vax/vax/locore.s | 16 +++++--------- usr/src/sys/vax/vax/machdep.c | 41 +++++++++++++++++++++++++++++++---- 4 files changed, 49 insertions(+), 23 deletions(-) diff --git a/usr/src/sys/kern/kern_proc.c b/usr/src/sys/kern/kern_proc.c index 43ab77b8da..4f5ffeb636 100644 --- a/usr/src/sys/kern/kern_proc.c +++ b/usr/src/sys/kern/kern_proc.c @@ -1,4 +1,4 @@ -/* kern_proc.c 3.23 %G% */ +/* kern_proc.c 3.24 %G% */ #include "../h/param.h" #include "../h/systm.h" @@ -113,7 +113,7 @@ exece() 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) diff --git a/usr/src/sys/kern/subr_prf.c b/usr/src/sys/kern/subr_prf.c index 9801ea6010..cc23bf5aec 100644 --- a/usr/src/sys/kern/subr_prf.c +++ b/usr/src/sys/kern/subr_prf.c @@ -1,4 +1,4 @@ -/* subr_prf.c 3.3 %G% */ +/* subr_prf.c 3.4 %G% */ #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/reboot.h" #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; @@ -132,7 +131,7 @@ char *s; printf("panic: %s\n", s); spl0(); for(;;) - ; + boot(RB_PANIC, RB_AUTOBOOT); /* 0 = automatic */ } /* diff --git a/usr/src/sys/vax/vax/locore.s b/usr/src/sys/vax/vax/locore.s index 3beb542f6f..8473b8ec50 100644 --- a/usr/src/sys/vax/vax/locore.s +++ b/usr/src/sys/vax/vax/locore.s @@ -1,7 +1,7 @@ # # 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 @@ -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 - halt .data .align 2 @@ -313,8 +312,9 @@ ubasrv: 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. @@ -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 + movl r11,PCB_R11(r1) 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 - 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 diff --git a/usr/src/sys/vax/vax/machdep.c b/usr/src/sys/vax/vax/machdep.c index 3614f689e5..80691b6c0a 100644 --- a/usr/src/sys/vax/vax/machdep.c +++ b/usr/src/sys/vax/vax/machdep.c @@ -1,4 +1,4 @@ -/* machdep.c 3.25 %G% */ +/* machdep.c 3.26 %G% */ #include "../h/param.h" #include "../h/systm.h" @@ -13,8 +13,10 @@ #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 */ @@ -22,8 +24,8 @@ int icode[] = 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] */ }; @@ -358,3 +360,34 @@ unhang() 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"); +} -- 2.20.1