diff options
author | Neal H. Walfield <neal@gnu.org> | 2009-02-13 04:24:42 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@gnu.org> | 2009-02-13 04:24:57 +0100 |
commit | 39e1f97996d9f5d7a1f11d0bcc53f98b37e7ffa7 (patch) | |
tree | e116cc46e03fb30debe18ea5d2d8c2257ccaa584 /ruth | |
parent | ba024094f5fc4cd55c922990a9b2eb96af52afb1 (diff) |
Almost the status quo.
Diffstat (limited to 'ruth')
-rw-r--r-- | ruth/ruth.c | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/ruth/ruth.c b/ruth/ruth.c index 760757a..0493d7a 100644 --- a/ruth/ruth.c +++ b/ruth/ruth.c @@ -316,27 +316,24 @@ main (int argc, char *argv[]) char stack[0x1000]; /* Fault it in. */ stack[0] = 0; - stack[sizeof (stack)] = 0; + stack[sizeof (stack) - 1] = 0; void start (void) { - do_debug (4) - as_dump ("thread"); - - debug (4, "I'm running ("VG_THREAD_ID_FMT")!", hurd_myself ()); - + /* Note: this thread has no utcb. So, no funny stuff like using + a printf. */ done = 1; - do - sched_yield (); - while (1); + while (1) + ; } printf ("Checking thread creation... "); vg_addr_t thread = capalloc (); - debug (5, "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; + debug (0, "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; struct vg_thread_exregs_in in; @@ -350,15 +347,14 @@ main (int argc, char *argv[]) vg_thread_exregs (activity, thread, VG_EXREGS_SET_ASPACE | VG_EXREGS_SET_ACTIVITY - | VG_EXREGS_SET_SP_IP | VG_EXREGS_START - | VG_EXREGS_ABORT_IPC, + | VG_EXREGS_SET_SP_IP | VG_EXREGS_START, in, VG_ADDR (0, 0), activity, VG_ADDR_VOID, VG_ADDR_VOID, &out, NULL, NULL, NULL, NULL); - debug (5, "Waiting for thread"); + debug (0, "Waiting for thread"); while (done == 0) sched_yield (); - debug (5, "Thread done!"); + debug (0, "Thread done!"); storage_free (storage, true); capfree (thread); @@ -435,6 +431,7 @@ main (int argc, char *argv[]) { printf ("Checking signals... "); + int d = 5; pthread_t thread; @@ -452,7 +449,7 @@ main (int argc, char *argv[]) void handler (int signo, siginfo_t *info, void *context) { - debug (5, "In handler for sig %d", signo); + debug (d, "In handler for sig %d", signo); i = 1; assert (signo == info->si_signo); @@ -482,20 +479,19 @@ main (int argc, char *argv[]) if (sigaction (SIGUSR1, &act, NULL) < 0) panic ("Failed to install signal handler: %s", strerror (errno)); - debug (5, "Installed signal handler, waking main thread (%d)", j); + debug (d, "Installed signal handler, waking main thread (%d)", j); /* Wait until the main thread unlocks MUTEX. */ pthread_mutex_lock (&mutex); pthread_mutex_unlock (&mutex); - debug (5, "Signaling main thread (%d)", j); + debug (d, "Signaling main thread (%d)", j); /* Signal the main thread that we are ready. */ ready_to_go = true; pthread_cond_signal (&cond); - /* Block. */ while (i != 1) sched_yield (); @@ -807,6 +803,7 @@ main (int argc, char *argv[]) { printf ("Checking vg_futex implementation... "); + int d = 5; #undef N #define N 4 @@ -836,7 +833,7 @@ main (int argc, char *argv[]) int i; for (i = 0; i < N; i ++) { - debug (5, "Creating thread %d", i); + debug (d, "Creating thread %d", i); error_t err = pthread_create (&threads[i], NULL, start, (void *) (uintptr_t) i); assert (err == 0); @@ -870,11 +867,11 @@ main (int argc, char *argv[]) for (i = 0; i < N; i ++) { void *status = (void *) 1; - debug (5, "Waiting on thread %d", i); + debug (d, "Waiting on thread %d", i); error_t err = pthread_join (threads[i], &status); assert (err == 0); assert ((uintptr_t) status == (uintptr_t) i); - debug (5, "Joined %d", i); + debug (d, "Joined %d", i); } printf ("ok.\n"); @@ -986,8 +983,10 @@ main (int argc, char *argv[]) do { struct vg_activity_info info; +debug (0, ""); error_t err = vg_activity_info (VG_ADDR_VOID, activity, vg_activity_info_stats, 1, &info); +debug (0, ""); assert_perror (err); assert (info.stats.count >= 1); @@ -1009,10 +1008,15 @@ main (int argc, char *argv[]) fill, &addr); assert (pager); + int count = 0; void *p; int i = 0; for (p = addr; p < addr + goal * PAGESIZE; p += PAGESIZE, i ++) - * (int *) p = i; + { + * (int *) p = i; + if (count ++ % 100 == 0) + debug (0, "allocated %d", count); + } assert (i == goal); debug (0, "Verifying the content of the discardable pages"); |