commit 5e41c6d8e3c51b4e017979c96e554c37f8c7892e
parent 037fe6d6643e0364dc831360649d437e030def44
Author: rminnich@gmail.com <none@none>
Date: Thu, 2 Sep 2010 22:58:07 -0700
fix tos issues. Fix exploding issue with a hack in sched.c
Diffstat:
4 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/src/9vx/a/tos.h b/src/9vx/a/tos.h
@@ -1,6 +1,7 @@
typedef struct Tos Tos;
typedef struct Plink Plink;
+#if 0
struct Tos {
struct /* Per process profiling */
@@ -19,5 +20,25 @@ struct Tos {
ulong clock;
/* top of stack is here */
};
+#else
+
+struct Tos {
+ struct /* Per process profiling */
+ {
+ uint32_t pp; /* known to be 0(ptr) */
+ uint32_t next; /* known to be 4(ptr) */
+ uint32_t last;
+ uint32_t first;
+ uint32_t pid;
+ uint32_t what;
+ } prof;
+ uvlong cyclefreq; /* cycle clock frequency if there is one, 0 otherwise */
+ vlong kcycles; /* cycles spent in kernel */
+ vlong pcycles; /* cycles spent in process (kernel + user) */
+ uint32_t pid; /* might as well put the pid here */
+ uint32_t clock;
+ /* top of stack is here */
+};
+#endif
extern Tos *_tos;
diff --git a/src/9vx/nogui.c b/src/9vx/nogui.c
@@ -77,7 +77,7 @@ unloadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata)
return _unloadmemimage(i, r, data, ndata);
}
-ulong
+uint32
pixelbits(Memimage *m, Point p)
{
return _pixelbits(m, p);
diff --git a/src/9vx/sched.c b/src/9vx/sched.c
@@ -158,6 +158,8 @@ runproc(void)
m->machno, p->pid, p->text, kprocq.n, nrunproc);
unlock(&kprocq.lk);
punlock(&run);
+ while (p->mach)
+ sched_yield();
return p;
}
diff --git a/src/9vx/stub.c b/src/9vx/stub.c
@@ -508,6 +508,21 @@ iprint(char *fmt, ...)
return n;
}
+void
+talktome(void)
+{
+ int i;
+ static char cmd[512];
+ while (fgets(cmd, sizeof(cmd), stdin)) {
+ if (! strcmp(cmd, "mach")) {
+ for(i = 0; i < MAXMACH; i++) {
+ fprintf(stderr, "%d ", MACHP(i)->splpc);
+ }
+
+ }
+ }
+ fprintf(stderr, "We're done talking\n");
+}
/*
* Panics go to standard error.
*/
@@ -536,6 +551,7 @@ panic(char *fmt, ...)
microdelay(1000000);
#else
fprint(2, "aborting, to dump core.\n");
+ talktome();
abort();
#endif
}