summaryrefslogtreecommitdiff
path: root/ruth
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2009-02-16 02:07:30 +0100
committerNeal H. Walfield <neal@gnu.org>2009-02-16 02:07:30 +0100
commit47e21c7acbdd593dac1482a5238315355c853e38 (patch)
treef9d95280e89334c1107b25015ba154989cd1007c /ruth
parent39e1f97996d9f5d7a1f11d0bcc53f98b37e7ffa7 (diff)
Rewrite CPU scheduler. Fix a few bugs. Add a lot of debugging support.
Diffstat (limited to 'ruth')
-rw-r--r--ruth/ruth.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/ruth/ruth.c b/ruth/ruth.c
index 0493d7a..e9b3216 100644
--- a/ruth/ruth.c
+++ b/ruth/ruth.c
@@ -328,9 +328,10 @@ main (int argc, char *argv[])
}
printf ("Checking thread creation... ");
+ int d = 0;
vg_addr_t thread = capalloc ();
- debug (0, "thread: " VG_ADDR_FMT, VG_ADDR_PRINTF (thread));
+ debug (d, "thread: " VG_ADDR_FMT, VG_ADDR_PRINTF (thread));
vg_addr_t storage = storage_alloc (activity,
vg_cap_thread, STORAGE_LONG_LIVED,
VG_OBJECT_POLICY_DEFAULT, thread).addr;
@@ -351,10 +352,10 @@ main (int argc, char *argv[])
in, VG_ADDR (0, 0), activity, VG_ADDR_VOID, VG_ADDR_VOID,
&out, NULL, NULL, NULL, NULL);
- debug (0, "Waiting for thread");
+ debug (d, "Waiting for thread");
while (done == 0)
sched_yield ();
- debug (0, "Thread done!");
+ debug (d, "Thread done!");
storage_free (storage, true);
capfree (thread);
@@ -429,9 +430,10 @@ main (int argc, char *argv[])
printf ("ok.\n");
}
+#if 0
{
printf ("Checking signals... ");
- int d = 5;
+ int d = 0;
pthread_t thread;
@@ -468,6 +470,8 @@ main (int argc, char *argv[])
assert (! (stack.ss_flags & SS_ONSTACK));
}
+ debug (d, "Running.");
+
int j;
for (j = 0; j < count; j ++)
{
@@ -607,6 +611,7 @@ main (int argc, char *argv[])
pthread_mutex_lock (&mutex);
+ debug (d, "Starting thread.\n");
error_t err = pthread_create (&thread, NULL, start, 0);
assert (err == 0);
@@ -614,11 +619,13 @@ main (int argc, char *argv[])
for (i = 0; i < count; i ++)
{
/* Wait for the thread to install the signal handler. */
+ debug (d, "Waiting for thread: %d\n", i);
while (!ready_to_go)
pthread_cond_wait (&cond, &mutex);
ready_to_go = false;
pthread_mutex_unlock (&mutex);
+ debug (d, "Signalling thread: %d\n", i);
err = pthread_kill (thread, SIGUSR1);
if (err)
panic ("Failed to signal thread %d: %s", thread, strerror (err));
@@ -626,12 +633,14 @@ main (int argc, char *argv[])
pthread_mutex_lock (&mutex);
}
+ debug (d, "Joining thread.\n");
void *status;
err = pthread_join (thread, &status);
assert (err == 0);
printf ("ok.\n");
}
+#endif
{
printf ("Checking activity creation... ");
@@ -996,8 +1005,8 @@ debug (0, "");
debug (0, "%d frames available", (int) frames);
uint32_t goal = frames * 2;
- /* Limit to at most 1GB of memory. */
- if (goal > ((uint32_t) -1) / PAGESIZE / 4)
+ /* Limit to at most 1GB of memory on 32-bit architectures. */
+ if (sizeof (uintptr_t) == 4 && goal > ((uint32_t) -1) / PAGESIZE / 4)
goal = ((uint32_t) -1) / PAGESIZE / 4;
debug (0, "Allocating %d frames", (int) goal);