changelog shortlog tags branches changeset file revisions annotate raw help

Mercurial > hg > plan9front / sys/src/9/bcm/main.c

revision 6851: 817828d0da99
parent 6832: f80792d28e0e
child 6855: 01468da33a6e
     1.1--- a/sys/src/9/bcm/main.c
     1.2+++ b/sys/src/9/bcm/main.c
     1.3@@ -19,7 +19,7 @@
     1.4  * Where configuration info is left for the loaded programme.
     1.5  */
     1.6 #define BOOTARGS	((char*)CONFADDR)
     1.7-#define	BOOTARGSLEN	(MACHADDR-CONFADDR)
     1.8+#define	BOOTARGSLEN	(REBOOTADDR-PADDR(CONFADDR))
     1.9 #define	MAXCONF		64
    1.10 #define MAXCONFLINE	160
    1.11 
    1.12@@ -301,7 +301,7 @@ main(void)
    1.13 	pageinit();
    1.14 	userinit();
    1.15 	launchinit();
    1.16-	mmuinit1();
    1.17+	mmuinit1(0);
    1.18 	schedinit();
    1.19 	assert(0);			/* shouldn't have returned */
    1.20 }
    1.21@@ -550,6 +550,35 @@ confinit(void)
    1.22 
    1.23 }
    1.24 
    1.25+static void
    1.26+rebootjump(ulong entry, ulong code, ulong size)
    1.27+{
    1.28+	static void (*f)(ulong, ulong, ulong);
    1.29+	static Lock lk;
    1.30+
    1.31+	intrsoff();
    1.32+	intrcpushutdown();
    1.33+
    1.34+	/* redo identity map */
    1.35+	mmuinit1(1);
    1.36+
    1.37+	lock(&lk);
    1.38+	if(f == nil){
    1.39+		/* setup reboot trampoline function */
    1.40+		f = (void*)REBOOTADDR;
    1.41+		memmove(f, rebootcode, sizeof(rebootcode));
    1.42+		cachedwbse(f, sizeof(rebootcode));
    1.43+	}
    1.44+	unlock(&lk);
    1.45+
    1.46+	cacheuwbinv();
    1.47+	l2cacheuwbinv();
    1.48+
    1.49+	(*f)(entry, code, size);
    1.50+
    1.51+	for(;;);
    1.52+}
    1.53+
    1.54 /*
    1.55  *  exit kernel either on a panic or user request
    1.56  */
    1.57@@ -558,14 +587,8 @@ exit(int)
    1.58 {
    1.59 	cpushutdown();
    1.60 	splfhi();
    1.61-	if(m->machno != 0){
    1.62-		void (*f)(ulong, ulong, ulong) = (void*)REBOOTADDR;
    1.63-		intrsoff();
    1.64-		intrcpushutdown();
    1.65-		cacheuwbinv();
    1.66-		(*f)(0, 0, 0);
    1.67-		for(;;);
    1.68-	}
    1.69+	if(m->machno != 0)
    1.70+		rebootjump(0, 0, 0);
    1.71 	archreboot();
    1.72 }
    1.73 
    1.74@@ -585,21 +608,14 @@ isaconfig(char *, int, ISAConf *)
    1.75 void
    1.76 reboot(void *entry, void *code, ulong size)
    1.77 {
    1.78-	void (*f)(ulong, ulong, ulong);
    1.79-
    1.80 	writeconf();
    1.81 	if (m->machno != 0) {
    1.82 		procwired(up, 0);
    1.83 		sched();
    1.84 	}
    1.85 
    1.86-	/* setup reboot trampoline function */
    1.87-	f = (void*)REBOOTADDR;
    1.88-	memmove(f, rebootcode, sizeof(rebootcode));
    1.89-	cachedwbse(f, sizeof(rebootcode));
    1.90-
    1.91 	cpushutdown();
    1.92-	delay(500);
    1.93+	delay(1000);
    1.94 
    1.95 	splfhi();
    1.96 
    1.97@@ -611,14 +627,10 @@ reboot(void *entry, void *code, ulong si
    1.98 
    1.99 	/* stop the clock (and watchdog if any) */
   1.100 	clockshutdown();
   1.101-	intrsoff();
   1.102-	intrcpushutdown();
   1.103-
   1.104-	cacheuwbinv();
   1.105-	l2cacheuwbinv();
   1.106+	wdogoff();
   1.107 
   1.108 	/* off we go - never to return */
   1.109-	(*f)(PADDR(entry), PADDR(code), size);
   1.110+	rebootjump(PADDR(entry), PADDR(code), size);
   1.111 }
   1.112 
   1.113 void