]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/mtx/main.c
merge
[plan9front.git] / sys / src / 9 / mtx / main.c
old mode 100755 (executable)
new mode 100644 (file)
index eebad44..6eb0fd7
@@ -29,14 +29,12 @@ main(void)
        mmuinit();
        hwintrinit();
        clockinit();
-       kbdinit();
        procinit0();
        initseg();
        timersinit();
        links();
        chandevreset();
        pageinit();
-       swapinit();
        fpsave(&initfp);
        initfp.fpscr = 0;
        userinit();
@@ -60,7 +58,7 @@ machinit(void)
        /* turn on caches */
        puthid0(gethid0() | BIT(16) | BIT(17));
 
-       active.machs = 1;
+       active.machs[0] = 1;
        active.exiting = 0;
 }
 
@@ -199,7 +197,7 @@ userinit(void)
        s->flushme++;
        p->seg[TSEG] = s;
        pg = newpage(1, 0, UTZERO);
-       memset(pg->cachectl, PG_TXTFLUSH, sizeof(pg->cachectl));
+       pg->txtflush = ~0;
        segpage(s, pg);
        k = kmap(s->map[0]->pages[0]);
        memmove((ulong*)VA(k), initcode, sizeof initcode);
@@ -212,42 +210,12 @@ userinit(void)
 void
 reboot(void*, void*, ulong)
 {
-       exit(0);
 }
 
 void
-exit(int ispanic)
+exit(int)
 {
-       int ms, once;
-
-       lock(&active);
-       if(ispanic)
-               active.ispanic = ispanic;
-       else if(m->machno == 0 && (active.machs & (1<<m->machno)) == 0)
-               active.ispanic = 0;
-       once = active.machs & (1<<m->machno);
-       active.machs &= ~(1<<m->machno);
-       active.exiting = 1;
-       unlock(&active);
-
-       if(once)
-               print("cpu%d: exiting\n", m->machno);
-       spllo();
-       for(ms = 5*1000; ms > 0; ms -= TK2MS(2)){
-               delay(TK2MS(2));
-               if(active.machs == 0 && consactive() == 0)
-                       break;
-       }
-
-       if(active.ispanic && m->machno == 0){
-               if(cpuserver)
-                       delay(10000);
-               else if(conf.monitor)
-                       for(;;);
-       }
-       else
-               delay(1000);
-
+       cpushutdown();
        watchreset();
 }
 
@@ -260,6 +228,11 @@ procsetup(Proc *p)
        p->fpstate = FPinit;
 }
 
+void
+procfork(Proc *)
+{
+}
+
 /*
  *  Save the mach dependent part of the process state.
  */
@@ -268,7 +241,7 @@ procsave(Proc *p)
 {
        if(p->fpstate == FPactive){
                if(p->state != Moribund)
-                       fpsave(&up->fpsave);
+                       fpsave(up->fpsave);
                p->fpstate = FPinactive;
        }
 }
@@ -342,15 +315,14 @@ confinit(void)
 
        /*
         * Guess how much is taken by the large permanent
-        * datastructures. Mntcache and Mntrpc are not accounted for
-        * (probably ~300KB).
+        * datastructures. Mntcache and Mntrpc are not accounted for.
         */
        kpages *= BY2PG;
        kpages -= conf.upages*sizeof(Page)
                + conf.nproc*sizeof(Proc)
                + conf.nimage*sizeof(Image)
                + conf.nswap
-               + conf.nswppo*sizeof(Page);
+               + conf.nswppo*sizeof(Page*);
        mainmem->maxsize = kpages;
        if(!cpuserver){
                /*
@@ -388,14 +360,19 @@ getcfields(char* lp, char** fields, int n, char* sep)
 int
 isaconfig(char *class, int ctlrno, ISAConf *isa)
 {
+       char cc[32], *p, *x;
        int i;
-       char cc[KNAMELEN], *p;
-
-       sprint(cc, "%s%d", class, ctlrno);
 
+       snprint(cc, sizeof cc, "%s%d", class, ctlrno);
        p = getconf(cc);
-       if(p == 0)
+       if(p == nil)
                return 0;
+
+       x = nil;
+       kstrdup(&x, p);
+       p = x;
+
+       isa->type = "";
        isa->nopt = tokenize(p, isa->opt, NISAOPT);
        for(i = 0; i < isa->nopt; i++){
                p = isa->opt[i];
@@ -463,3 +440,10 @@ cistrncmp(char *a, char *b, int n)
 
        return 0;
 }
+
+void
+setupwatchpts(Proc *, Watchpt *, int n)
+{
+       if(n > 0)
+               error("no watchpoints");
+}