Remove old tests and mhello
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 19 Apr 2017 21:17:32 +0000 (17:17 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 3 May 2017 16:13:02 +0000 (12:13 -0400)
The venerable mhello (and its lesser buddy mcp_halt) need to be retired.
Given the changes in uthread code, it's harder to fake being a 2LS without
implementing a 2LS, and it's not worth maintaining those programs.

Goodnight sweet prince.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
46 files changed:
tests/mcp_halt.c [deleted file]
tests/mhello.c [deleted file]
tests/old/appender.c [deleted file]
tests/old/arsc_mt.c [deleted file]
tests/old/arsc_test.c [deleted file]
tests/old/badsegment.c [deleted file]
tests/old/breakpoint.c [deleted file]
tests/old/buggyhello.c [deleted file]
tests/old/condvar_test.c [deleted file]
tests/old/divzero.c [deleted file]
tests/old/dtls_test.c [deleted file]
tests/old/eth_audio.c [deleted file]
tests/old/evilhello.c [deleted file]
tests/old/faultread.c [deleted file]
tests/old/faultreadkernel.c [deleted file]
tests/old/faultwrite.c [deleted file]
tests/old/faultwritekernel.c [deleted file]
tests/old/fork.c [deleted file]
tests/old/fp_test.c [deleted file]
tests/old/fpperf.cc [deleted file]
tests/old/hart_test.c [deleted file]
tests/old/idle.c [deleted file]
tests/old/manycore_test.c [deleted file]
tests/old/mproctests.c [deleted file]
tests/old/msr_cycling_vcores.c [deleted file]
tests/old/msr_dumb_while.c [deleted file]
tests/old/msr_get_cores.c [deleted file]
tests/old/msr_get_singlecore.c [deleted file]
tests/old/msr_nice_while.c [deleted file]
tests/old/msr_single_while.c [deleted file]
tests/old/null.c [deleted file]
tests/old/proctests.c [deleted file]
tests/old/raise.c [deleted file]
tests/old/slab.c [deleted file]
tests/old/softint.c [deleted file]
tests/old/spawn.c [deleted file]
tests/old/syscall.c [deleted file]
tests/old/syscall_speed.c [deleted file]
tests/old/tcp_test.c [deleted file]
tests/old/test_mmap_ipc.c [deleted file]
tests/old/test_ucq.c [deleted file]
tests/old/testbss.c [deleted file]
tests/old/tlstest.c [deleted file]
tests/old/tsc_spitter.c [deleted file]
tests/old/udp_test.c [deleted file]
tests/old/vvadd.c [deleted file]

diff --git a/tests/mcp_halt.c b/tests/mcp_halt.c
deleted file mode 100644 (file)
index d7004d9..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#include <parlib/parlib.h>
-#include <ros/mman.h>
-#include <ros/resource.h>
-#include <ros/procdata.h>
-#include <ros/event.h>
-#include <ros/bcq.h>
-#include <parlib/arch/arch.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <parlib/vcore.h>
-#include <parlib/mcs.h>
-#include <parlib/timing.h>
-#include <parlib/assert.h>
-#include <parlib/event.h>
-#include <parlib/uthread.h>
-
-void ghetto_vcore_entry(void);
-
-struct schedule_ops ghetto_sched_ops = {
-       .sched_entry = ghetto_vcore_entry,
-};
-
-/* All MCP syscalls will spin instead of blocking */
-static void __ros_syscall_spinon(struct syscall *sysc)
-{
-       while (!(atomic_read(&sysc->flags) & (SC_DONE | SC_PROGRESS)))
-               cpu_relax();
-}
-
-int main(int argc, char** argv)
-{
-       uint32_t vcoreid;
-       int nr_vcores;
-
-       if (argc < 2)
-               nr_vcores = max_vcores();
-       else
-               nr_vcores = atoi(argv[1]);
-
-       /* Inits a thread for us, though we won't use it.  Just a hack to get into
-        * _M mode.  Note this requests one vcore for us */
-       struct uthread dummy = {0};
-       uthread_2ls_init(&dummy, &ghetto_sched_ops, NULL, NULL);
-       uthread_mcp_init();
-
-       /* Reset the blockon to be the spinner...  This is really shitty.  Any
-        * blocking calls after we become an MCP and before this will fail.  This is
-        * just mhello showing its warts due to trying to work outside uthread.c */
-       ros_syscall_blockon = __ros_syscall_spinon;
-
-       vcore_request_total(nr_vcores);
-
-       while (1)
-               sys_halt_core(0);
-
-       return 0;
-}
-
-void ghetto_vcore_entry(void)
-{
-       if (vcore_id() == 0)
-               run_current_uthread();
-
-       while (1)
-               sys_halt_core(0);
-}
diff --git a/tests/mhello.c b/tests/mhello.c
deleted file mode 100644 (file)
index 2fd53fb..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-#include <parlib/parlib.h>
-#include <ros/mman.h>
-#include <ros/resource.h>
-#include <ros/procdata.h>
-#include <ros/event.h>
-#include <ros/bcq.h>
-#include <parlib/arch/arch.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <parlib/vcore.h>
-#include <parlib/mcs.h>
-#include <parlib/timing.h>
-#include <parlib/assert.h>
-#include <parlib/event.h>
-#include <parlib/uthread.h>
-#include <unistd.h>
-
-__thread int temp;
-void *core0_tls = 0;
-
-struct event_queue *indirect_q;
-static void handle_generic(struct event_msg *ev_msg, unsigned int ev_type,
-                           void *data);
-
-void ghetto_vcore_entry(void);
-
-struct schedule_ops ghetto_sched_ops = {
-       .sched_entry = ghetto_vcore_entry,
-};
-
-/* Extreme ghetto */
-static void __ros_syscall_spinon(struct syscall *sysc)
-{
-       while (!(atomic_read(&sysc->flags) & (SC_DONE | SC_PROGRESS)))
-               cpu_relax();
-}
-
-/* to trick uthread_create() */
-int main(int argc, char** argv)
-{
-       uint32_t vcoreid;
-
-       /* vcore_context test */
-       assert(!in_vcore_context());
-       
-       /* prep indirect ev_q.  Note we grab a big one */
-       indirect_q = get_eventq(EV_MBOX_UCQ);
-       indirect_q->ev_flags = EVENT_IPI;
-       indirect_q->ev_vcore = 1;                       /* IPI core 1 */
-       indirect_q->ev_handler = 0;
-       printf("Registering %08p for event type %d\n", indirect_q,
-              EV_FREE_APPLE_PIE);
-       register_kevent_q(indirect_q, EV_FREE_APPLE_PIE);
-
-       /* handle events: just want to print out what we get.  This is just a
-        * quick set of handlers, not a registration for a kevent. */
-       for (int i = 0; i < MAX_NR_EVENT; i++)
-               register_ev_handler(i, handle_generic, 0);
-       /* Want to use the default ev_ev (which we just overwrote) */
-       register_ev_handler(EV_EVENT, handle_ev_ev, 0);
-       /* vcore_lib_init() done in vcore_request() now. */
-       /* Set up event reception.  For example, this will allow us to receive an
-        * event and IPI for USER_IPIs on vcore 0.  Check event.c for more stuff.
-        * Note you don't have to register for USER_IPIs to receive ones you send
-        * yourself with sys_self_notify(). */
-       enable_kevent(EV_USER_IPI, 0, EVENT_IPI | EVENT_VCORE_PRIVATE);
-       /* Receive pending preemption events.  (though there's no PP handler) */
-       struct event_queue *ev_q = get_eventq_vcpd(0, EVENT_VCORE_PRIVATE);
-       ev_q->ev_flags = EVENT_IPI | EVENT_VCORE_APPRO;
-       register_kevent_q(ev_q, EV_PREEMPT_PENDING);
-       /* We also receive preemption events, it is set up in uthread.c */
-
-       /* Inits a thread for us, though we won't use it.  Just a hack to get into
-        * _M mode.  Note this requests one vcore for us */
-       struct uthread dummy = {0};
-       uthread_2ls_init(&dummy, &ghetto_sched_ops, NULL, NULL);
-       uthread_mcp_init();
-       /* Reset the blockon to be the spinner...  This is really shitty.  Any
-        * blocking calls after we become an MCP and before this will fail.  This is
-        * just mhello showing its warts due to trying to work outside uthread.c */
-       ros_syscall_blockon = __ros_syscall_spinon;
-
-       if ((vcoreid = vcore_id())) {
-               printf("Should never see me! (from vcore %d)\n", vcoreid);
-       } else { // core 0
-               temp = 0xdeadbeef;
-               printf("Hello from vcore %d with temp addr = %p and temp = %p\n",
-                      vcoreid, &temp, temp);
-               printf("Multi-Goodbye, world, from PID: %d!\n", getpid());
-               printf("Requesting %d vcores\n", max_vcores() - 1);
-               vcore_request_total(max_vcores());
-               printf("This is vcore0, right after vcore_request\n");
-               /* vcore_context test */
-               assert(!in_vcore_context());
-       }
-
-       //#if 0
-       /* test notifying my vcore2 */
-       udelay(5000000);
-       printf("Vcore 0 self-notifying vcore 2 with notif 4!\n");
-       struct event_msg msg;
-       msg.ev_type = 4;
-       sys_self_notify(2, 4, &msg, TRUE);
-       udelay(5000000);
-       printf("Vcore 0 notifying itself with notif 6!\n");
-       msg.ev_type = 6;
-       sys_notify(getpid(), 6, &msg);
-       udelay(1000000);
-       //#endif
-
-       /* test loop for restarting a uthread_ctx */
-       if (vcoreid == 0) {
-               int ctr = 0;
-               while(1) {
-                       printf("Vcore %d Spinning (%d), temp = %08x!\n", vcoreid, ctr++, temp);
-                       udelay(5000000);
-                       //exit(0);
-               }
-       }
-
-       printf("Vcore %d Done!\n", vcoreid);
-
-       printf("All Cores Done!\n", vcoreid);
-       while(1); // manually kill from the monitor
-       /* since everyone should cleanup their uthreads, even if they don't plan on
-        * calling their code or want uthreads in the first place. <3 */
-       uthread_cleanup(&dummy);
-       return 0;
-}
-
-static void handle_generic(struct event_msg *ev_msg, unsigned int ev_type,
-                           void *data)
-{
-       printf("Got event type %d on vcore %d\n", ev_type, vcore_id());
-}
-
-void ghetto_vcore_entry(void)
-{
-       uint32_t vcoreid = vcore_id();
-       static bool first_time = TRUE;
-
-       temp = 0xcafebabe;
-       /* vcore_context test (don't need to do this anywhere) */
-       assert(in_vcore_context());
-
-       /* old logic was moved to parlib code */
-       if (current_uthread) {
-               assert(vcoreid == 0);
-               run_current_uthread();
-       }
-       /* unmask notifications once you can let go of the uthread_ctx and it is
-        * okay to clobber the transition stack.
-        * Check Documentation/processes.txt: 4.2.4.  In real code, you should be
-        * popping the tf of whatever user process you want (get off the x-stack) */
-       enable_notifs(vcoreid);
-
-/* end: stuff userspace needs to do to handle notifications */
-
-       printf("Hello from vcore_entry in vcore %d with temp addr %p and temp %p\n",
-              vcoreid, &temp, temp);
-
-       #if 0
-       /* Test sys change vcore.  Need to manually preempt the pcore vcore4 is
-        * mapped to from the monitor */
-       udelay(20000000);
-       if (vcoreid == 1) {
-               disable_notifs(vcoreid);
-               printf("VC1 changing to VC4\n");
-               sys_change_vcore(4, TRUE);              /* try both of these manually */
-               //sys_change_vcore(4, FALSE);           /* try both of these manually */
-               printf("VC1 returned\n");
-       }
-       udelay(10000000);
-       #endif
-
-       vcore_request_more(1);
-       udelay(vcoreid * 10000000);
-       //exit(0);
-       while(1);
-}
diff --git a/tests/old/appender.c b/tests/old/appender.c
deleted file mode 100644 (file)
index a5ad235..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <stdio.h> 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <parlib/arch/arch.h>
-#include <unistd.h>
-#include <errno.h>
-#include <dirent.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define WRITE_AMOUNT 4096
-int main(int argc, char *argv[]) 
-{ 
-       int retval;
-       char wbuf[WRITE_AMOUNT];
-       if (argc < 2) {
-               printf("Appends some shit to the end of a text file\n");
-               printf("Usage: appender FILENAME\n");
-               return -1;
-       }
-
-       int fd = open(argv[1], O_RDWR);
-       if (!fd) {
-               printf("Unable to open %s\n", argv[1]);
-               return -1;
-       }
-
-       for (int i = 0; i < WRITE_AMOUNT; i += 4) {
-               wbuf[i + 0] = 'X';
-               wbuf[i + 1] = 'M';
-               wbuf[i + 2] = 'E';
-               wbuf[i + 3] = ' ';
-       }
-       
-       lseek(fd, 0, SEEK_END);
-       retval = write(fd, wbuf, WRITE_AMOUNT);
-       printf("Tried to write %d bytes, got retval: %d\n", WRITE_AMOUNT, retval);
-       return 0;
-}
diff --git a/tests/old/arsc_mt.c b/tests/old/arsc_mt.c
deleted file mode 100644 (file)
index 20aed08..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifdef CONFIG_ARSC_SERVER
-#include <stdio.h>
-#include <stdlib.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <parlib/vcore.h>
-#include <parlib/parlib.h>
-#include <ros/syscall.h>
-#include <parlib/arc.h>
-#include <stdio.h>
-
-#define NUM_THREADS 4
-
-pthread_t t1;
-
-async_desc_t desc1;
-
-syscall_desc_t* sys_cputs_async(const char *s, size_t len,                                             
-                     void (*cleanup_handler)(void*), void* cleanup_data)
-{                                                                                                                     
-       return arc_call(SYS_cputs, s, len);
-}
-
-void *syscall_thread(void* arg)
-{
-       char testme ='a';
-       char buf[20] = {0};
-       sprintf(buf, "%d", (pthread_self()->id % 10) );
-       char tid = buf[0];
-       syscall_desc_t* sysdesc;
-       sysdesc = sys_cputs_async(&tid, 1, NULL, NULL);
-       assert (-1 != waiton_syscall(sysdesc));
-}
-
-int main(int argc, char** argv){
-       int pid = getpid();
-       pthread_t *my_threads = malloc(sizeof(pthread_t) * NUM_THREADS);
-       char testme = 't';
-       printf ("multi thread - init arsc \n");
-       init_arc(&SYS_CHANNEL);
-       for (int i = 0; i < NUM_THREADS ; i++)
-               pthread_create(&my_threads[i], NULL, &syscall_thread, NULL);
-       
-       for (int i = 0; i < NUM_THREADS; i++){
-               pthread_join(my_threads[i], NULL);
-       }
-
-       printf("multi thread - end\n");
-}
-#else
-int main(){};
-#endif
diff --git a/tests/old/arsc_test.c b/tests/old/arsc_test.c
deleted file mode 100644 (file)
index c46deef..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifdef CONFIG_ARSC_SERVER
-#include <parlib/parlib.h>
-#include <parlib/vcore.h>
-#include <ros/syscall.h>
-#include <parlib/arc.h>
-#include <stdio.h>
-
-syscall_desc_t* sys_cputs_async(const char *s, size_t len,                                             
-                     void (*cleanup_handler)(void*), void* cleanup_data)
-{                                                                                                                     
-    /*// could just hardcode 4 0's, will eventually wrap this marshaller anyway                                         
-       syscall_desc_t* desc;
-    syscall_req_t syscall = {REQ_alloc, cleanup_handler, cleanup_data,
-                                                       SYS_cputs,{(uint32_t)s, len, [2 ... (NUM_SYSCALL_ARGS-1)] 0} };                          
-    syscall.cleanup = cleanup_handler;                                                                                  
-    syscall.data = cleanup_data;
-    async_syscall(&syscall, &desc);
-       */
-       return arc_call(SYS_cputs, s, len);
-}
-
-int main(int argc, char** argv){
-       int pid = getpid();
-       char testme = 't';
-       printf ("single thread - init arsc \n");
-       syscall_desc_t* sysdesc[2];
-       syscall_rsp_t sysrsp;
-       init_arc(&SYS_CHANNEL);
-
-       printf ("single thread - init complete \n");
-       // cprintf_async(&desc1, "Cross-Core call 1, coming from process %08x\n", pid);
-       sysdesc[0] = sys_cputs_async(&testme, 1, NULL, NULL);
-       sysdesc[1] = sys_cputs_async(&testme, 1, NULL, NULL);
-
-       printf ("single thread - call placed \n");
-       //ignore return value
-       assert(-1 != waiton_syscall(sysdesc[0]));
-       assert(-1 != waiton_syscall(sysdesc[1]));
-       printf ("single thread - dummy call \n");       
-}
-
-#else
-int main(){};
-#endif
diff --git a/tests/old/badsegment.c b/tests/old/badsegment.c
deleted file mode 100644 (file)
index 6926bf3..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// program to cause a general protection exception
-
-int main(int argc, char** argv)
-{
-       // Try to load the kernel's TSS selector into the DS register.
-       //asm volatile("movw $28,%ax; movw %ax,%ds");
-  
-       // DP: 0x28 == 40
-       #ifdef __i386__
-       asm volatile("movw $40,%ax; movw %ax,%ds");
-       #endif
-       return 0;
-}
-
diff --git a/tests/old/breakpoint.c b/tests/old/breakpoint.c
deleted file mode 100644 (file)
index 26b550b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// program to cause a breakpoint trap
-
-#include <parlib/arch/arch.h>
-
-int main(int argc, char** argv)
-{
-       breakpoint();
-       return 0;
-}
-
diff --git a/tests/old/buggyhello.c b/tests/old/buggyhello.c
deleted file mode 100644 (file)
index db4e544..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// buggy hello world -- unmapped pointer passed to kernel
-// kernel should destroy user process in response
-
-#include <parlib/parlib.h>
-
-int main(int argc, char** argv)
-{
-       sys_cputs((char*)1, 1);
-       return 0;
-}
-
diff --git a/tests/old/condvar_test.c b/tests/old/condvar_test.c
deleted file mode 100644 (file)
index 927338d..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-#include <stdio.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/time.h>
-
-/* OS dependent #incs */
-#include <parlib/parlib.h>
-#include <parlib/vcore.h>
-#include <parlib/timing.h>
-
-#define MAX_NR_TEST_THREADS 1000
-
-pthread_t my_threads[MAX_NR_TEST_THREADS];
-void *my_retvals[MAX_NR_TEST_THREADS];
-
-
-/* Funcs and global vars for test_cv() */
-pthread_cond_t local_cv;
-pthread_cond_t *cv = &local_cv;
-pthread_mutex_t local_mutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_t *pth_m = &local_mutex;
-
-atomic_t counter;
-volatile bool state = FALSE;           /* for test 3 */
-
-void *__test_pthread_cond_signal(void *arg)
-{
-       if (atomic_read(&counter) % 4)
-               pthread_cond_signal(cv);
-       else
-               pthread_cond_broadcast(cv);
-       atomic_dec(&counter);
-}
-
-void *__test_pthread_cond_waiter(void *arg)
-{
-       pthread_mutex_lock(pth_m);
-       /* check state, etc */
-       pthread_cond_wait(cv, pth_m);
-       pthread_mutex_unlock(pth_m);
-       atomic_dec(&counter);
-}
-
-void *__test_pthread_cond_waiter_t3(void *arg)
-{
-       udelay((long)arg);
-       /* if state == false, we haven't seen the signal yet */
-       pthread_mutex_lock(pth_m);
-       printd("Came in, saw state %d\n", state);
-       while (!state) {
-               cpu_relax();
-               pthread_cond_wait(cv, pth_m);   /* unlocks and relocks */
-       }
-       pthread_mutex_unlock(pth_m);
-       /* Make sure we are done, tell the controller we are done */
-       cmb();
-       assert(state);
-       atomic_dec(&counter);
-}
-
-int main(void)
-{
-       int nr_msgs;
-       pthread_mcp_init();
-       pthread_cond_init(cv, 0);
-       pthread_mutex_init(pth_m, 0);
-
-       /* Test 0: signal without waiting */
-       pthread_cond_broadcast(cv);
-       pthread_cond_signal(cv);
-       printf("test_cv: signal without waiting complete\n");
-
-       /* Test 1: single / minimal shit */
-       nr_msgs = max_vcores() - 1;
-       atomic_init(&counter, nr_msgs);
-       for (int i = 0; i < nr_msgs; i++) {
-               if (pthread_create(&my_threads[i], NULL, &__test_pthread_cond_waiter,
-                   NULL))
-                       perror("pth_create failed");
-       }
-       udelay(1000000);
-       pthread_cond_signal(cv);
-       /* wait for one to make it */
-       while (atomic_read(&counter) != nr_msgs - 1)
-               pthread_yield();
-       printf("test_cv: single signal complete\n");
-       pthread_cond_broadcast(cv);
-       for (int i = 0; i < nr_msgs; i++)
-               pthread_join(my_threads[i], &my_retvals[i]);
-       printf("test_cv: broadcast signal complete\n");
-
-       /* Test 2: shitloads of waiters and signalers */
-       nr_msgs = MAX_NR_TEST_THREADS;
-       atomic_init(&counter, nr_msgs);
-       for (int i = 0; i < nr_msgs; i++) {
-               if (i % 5) {
-                       if (pthread_create(&my_threads[i], NULL,
-                           &__test_pthread_cond_waiter, NULL))
-                               perror("pth_create failed");
-               } else {
-                       if (pthread_create(&my_threads[i], NULL,
-                           &__test_pthread_cond_signal, NULL))
-                               perror("pth_create failed");
-               }
-       }
-       pthread_yield();
-       while (atomic_read(&counter)) {
-               cpu_relax();
-               pthread_cond_broadcast(cv);
-               pthread_yield();
-       }
-       for (int i = 0; i < nr_msgs; i++)
-               pthread_join(my_threads[i], &my_retvals[i]);
-       printf("test_cv: massive message storm complete\n");
-
-       /* Test 3: basic one signaller, one receiver.  we want to vary the amount of
-        * time the sender and receiver delays, starting with (1ms, 0ms) and ending
-        * with (0ms, 1ms).  At each extreme, such as with the sender waiting 1ms,
-        * the receiver/waiter should hit the "check and wait" point well before the
-        * sender/signaller hits the "change state and signal" point.
-        *
-        * Need to make sure we are running in parallel here.  Temp turned off the
-        * 2LSs VC management and got up to 2 VC.  Assuming no preemption. */
-       parlib_never_yield = TRUE;
-       while (num_vcores() < 2)
-               vcore_request_more(1);
-       parlib_never_vc_request = TRUE;
-       for (long i = 0; i < 1000; i++) {
-               for (int j = 0; j < 10; j++) {  /* some extra chances at each point */
-                       state = FALSE;
-                       /* client waits for i usec */
-                       if (pthread_create(&my_threads[0], NULL,
-                           &__test_pthread_cond_waiter_t3, (void*)i))
-                               perror("pth_create failed");
-                       cmb();
-                       udelay(1000 - i);       /* senders wait time: 1000..0 */
-                       /* Need to lock the mutex when touching state and signalling about
-                        * that state (atomically touch and signal).  Thanks pthreads, for
-                        * mandating a cond_signal that doesn't require locking. */
-                       pthread_mutex_lock(pth_m);
-                       state = TRUE;
-                       pthread_cond_signal(cv);
-                       pthread_mutex_unlock(pth_m);
-                       /* they might not have run at all yet (in which case they lost the
-                        * race and don't need the signal).  but we need to wait til they're
-                        * done */
-                       pthread_join(my_threads[0], my_retvals[0]);
-               }
-       }
-       parlib_never_yield = FALSE;
-       parlib_never_vc_request = FALSE;
-       printf("test_cv: single sender/receiver complete\n");
-}
diff --git a/tests/old/divzero.c b/tests/old/divzero.c
deleted file mode 100644 (file)
index 59dbf18..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// buggy program - causes a divide by zero exception
-
-#include <stdio.h>
-
-int zero;
-
-int main(int argc, char** argv)
-{
-       printf("1/0 is %08x!\n", 1/zero);
-       return 0;
-}
-
diff --git a/tests/old/dtls_test.c b/tests/old/dtls_test.c
deleted file mode 100644 (file)
index c039937..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <stdio.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-/* OS dependent #incs */
-#include <parlib/parlib.h>
-
-#define NR_TEST_THREADS 10
-#define NUM_PTHREAD_KEYS 10
-pthread_t my_threads[NR_TEST_THREADS];
-void *my_retvals[NR_TEST_THREADS];
-pthread_key_t pthread_keys[NUM_PTHREAD_KEYS];
-pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-
-void *thread(void* arg)
-{      
-  long *dtls_value[NUM_PTHREAD_KEYS];
-  for(int i=0; i<NUM_PTHREAD_KEYS; i++) {
-    dtls_value[i] = malloc(sizeof(long));
-    *dtls_value[i] = (long)pthread_self() + i;
-    pthread_setspecific(pthread_keys[i], dtls_value[i]);
-  }
-
-  pthread_mutex_lock(&mutex);
-  long self = (long)pthread_self();
-  printf("In pthread %p (%ld)\n", (void*)self, self);
-  for(int i=0; i<NUM_PTHREAD_KEYS; i++) {
-    long *value = pthread_getspecific(pthread_keys[i]);
-    printf("  dtls_value[%d] = %ld\n", i, *value);
-  }
-  pthread_mutex_unlock(&mutex);
-
-  return (void*)(self);
-}
-
-static void dtls_dtor(void *dtls)
-{
-  pthread_mutex_lock(&mutex);
-  printf("Phread %p freeing dtls %p.\n", pthread_self(), dtls);
-  free(dtls);
-  pthread_mutex_unlock(&mutex);
-}
-
-int main(int argc, char** argv) 
-{
-  printf("Starting dtls test.\n");
-  for(int i=0; i<NUM_PTHREAD_KEYS; i++) {
-    pthread_key_create(&pthread_keys[i], dtls_dtor);
-  }
-  for (int i = 0; i < NR_TEST_THREADS; i++) {
-       if (pthread_create(&my_threads[i], NULL, &thread, NULL))
-               perror("pth_create failed");
-  }
-  for (int i = 0; i < NR_TEST_THREADS; i++) {
-       pthread_join(my_threads[i], &my_retvals[i]);
-  }
-  for(int i=0; i<NUM_PTHREAD_KEYS; i++) {
-    pthread_key_delete(pthread_keys[i]);
-  }
-  printf("Test complete!\n");
-} 
diff --git a/tests/old/eth_audio.c b/tests/old/eth_audio.c
deleted file mode 100644 (file)
index cfb5de1..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-#include <ros/resource.h>
-#include <ros/procdata.h>
-#include <ros/event.h>
-#include <ros/bcq.h>
-#include <parlib/parlib.h>
-#include <parlib/vcore.h>
-
-#include <stdio.h> 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <parlib/arch/arch.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <parlib/timing.h>
-#include <assert.h>
-#include <parlib/event.h>
-#include <parlib/uthread.h>
-
-void *core0_tls = 0;
-void *in_buf, *out_buf;
-
-/* Test program for the audio device.  mmap()s the stuff, sets up a notif
- * handler, and switches to multi_mode.
- *
- * Note: this has a lot of mhello-like MCP infrastructure.  When Lithe is
- * working, you won't need any of this.  Just the mmap stuff and the notif
- * handler.  Stuff specific to the ethernet audio device is marked ETH_AUD. */
-int main() 
-{ 
-       int retval;
-       int in_fd, out_fd;
-       /* ETHAUD mmap the input and output buffers */
-       in_fd = open("/dev/eth_audio_in", O_RDONLY);
-       out_fd = open("/dev/eth_audio_out", O_RDWR);
-       assert(in_fd != -1);
-       assert(out_fd != -1);
-       in_buf = mmap(0, PGSIZE, PROT_READ, 0, in_fd, 0);
-       if (in_buf == MAP_FAILED) {
-               int err = errno;
-               perror("Can't mmap the input buf:");
-       }
-       out_buf = mmap(0, PGSIZE, PROT_READ | PROT_WRITE, MAP_POPULATE, out_fd, 0);
-       if (out_buf == MAP_FAILED) {
-               int err = errno;
-               perror("Can't mmap the output buf:");
-       }
-       //strncpy(out_buf, "Nanwan loves you!\n", 19);
-
-/* begin: stuff userspace needs to do before switching to multi-mode */
-       vcore_lib_init();
-
-       /* ETHAUD Turn on Free apple pie (which is the network packet) */
-       enable_kevent(EV_FREE_APPLE_PIE, 0, EVENT_IPI);
-
-       /* Need to save this somewhere that you can find it again when restarting
-        * core0 */
-       core0_tls = get_tls_desc();
-       /* Need to save our floating point state somewhere (like in the
-        * user_thread_tcb so it can be restarted too */
-
-/* end: stuff userspace needs to do before switching to multi-mode */
-       /* ETHAUD */
-       /* Switch into _M mode */
-       vcore_request_total(1);
-
-       /* Stay alive for a minute (will take interrupts) */
-       udelay(60000000);
-
-       printf("Eth aud, finishing up!\n");
-       /* Need to do unmap it, due to some limitations in the kernel */
-       munmap(in_buf, PGSIZE);
-       munmap(out_buf, PGSIZE);
-       close(in_fd);
-       close(out_fd);
-}
-
-/* ETHAUD, with some debugging commands... */
-void process_packet(void)
-{
-       //printf("Received a packet!\n");
-       //memset(out_buf, 0, PGSIZE);
-       memcpy(out_buf, in_buf, 1280);  /* size of the payload. */
-       memset(out_buf + 1280, 0, 4);   /* 4 bytes of control info. */
-       //printf("contents of out_buf %s\n", out_buf);
-}
-
-void vcore_entry(void)
-{
-       uint32_t vcoreid = vcore_id();
-       static bool first_time = TRUE;
-
-       printf("GIANT WARNING: this is ancient shit\n");
-/* begin: stuff userspace needs to do to handle events/notifications */
-
-       struct vcore *vc = &__procinfo.vcoremap[vcoreid];
-       struct preempt_data *vcpd;
-       vcpd = &__procdata.vcore_preempt_data[vcoreid];
-       
-       /* Ghetto way to get just an event number */
-       unsigned int ev_type = get_event_type(&vcpd->ev_mbox_public);
-
-       /* ETHAUD app: process the packet if we got a notif */
-       if (ev_type == EV_FREE_APPLE_PIE)
-               process_packet();
-
-       if (vc->preempt_pending) {
-               printf("Oh crap, vcore %d is being preempted!  Yielding\n", vcoreid);
-               sys_yield(TRUE);
-               printf("After yield on vcore %d. I wasn't being preempted.\n", vcoreid);
-       }
-               
-       /* Lets try to restart vcore0's context.  Note this doesn't do anything to
-        * set the appropriate TLS.  On x86, this will involve changing the LDT
-        * entry for this vcore to point to the TCB of the new user-thread. */
-       if (vcoreid == 0) {
-               handle_events(vcoreid);
-               set_tls_desc(core0_tls);
-               assert(__vcoreid == 0); /* in case anyone uses this */
-               /* Load silly state (Floating point) too */
-               pop_user_ctx(&vcpd->uthread_ctx, vcoreid);
-               printf("should never see me!");
-       }       
-       /* unmask notifications once you can let go of the uthread_ctx and it is
-        * okay to clobber the transition stack.
-        * Check Documentation/processes.txt: 4.2.4.  In real code, you should be
-        * popping the tf of whatever user process you want (get off the x-stack) */
-       vcpd->notif_disabled = FALSE;
-       
-/* end: stuff userspace needs to do to handle notifications */
-       /* The other vcores will hit here. */
-       while (1)
-               cpu_relax();
-}
diff --git a/tests/old/evilhello.c b/tests/old/evilhello.c
deleted file mode 100644 (file)
index 091061e..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// evil hello world -- kernel pointer passed to kernel
-// kernel should destroy user process in response
-
-#include <parlib/parlib.h>
-
-int main(int argc, char** argv)
-{
-       while(1);
-       // try to print the kernel entry point as a string!  mua ha ha!
-       sys_cputs((char*)0xc0100020, 100);
-       return 0;
-}
-
diff --git a/tests/old/faultread.c b/tests/old/faultread.c
deleted file mode 100644 (file)
index 3cf8a3f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// buggy program - faults with a read from location zero
-
-#include <stdio.h>
-
-int main(int argc, char** argv)
-{ 
-       printf("I read %08x from location 0!\n", *(unsigned*)0);
-       return 0;
-}
-
diff --git a/tests/old/faultreadkernel.c b/tests/old/faultreadkernel.c
deleted file mode 100644 (file)
index cef359f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// buggy program - faults with a read from kernel space
-
-#include <stdio.h>
-
-int main(int argc, char** argv)
-{
-       printf("I read %08x from location 0xf0100000!\n", *(unsigned*)0xf0100000);
-       return 0;
-}
-
diff --git a/tests/old/faultwrite.c b/tests/old/faultwrite.c
deleted file mode 100644 (file)
index 05b1861..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// buggy program - faults with a write to location zero
-
-int main(int argc, char** argv)
-{
-       *(unsigned*)0 = 0;
-       return 0;
-}
-
diff --git a/tests/old/faultwritekernel.c b/tests/old/faultwritekernel.c
deleted file mode 100644 (file)
index 8b07449..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// buggy program - faults with a write to a kernel location
-
-
-int main(int argc, char** argv)
-{ 
-       *(unsigned*)0xf0100000 = 0;
-       return 0;
-}
-
diff --git a/tests/old/fork.c b/tests/old/fork.c
deleted file mode 100644 (file)
index b7efa42..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-int main(int argc, char** argv)
-{
-       int status;
-       pid_t pid = 0;
-       pid = fork();
-       if (pid) {
-               printf("Hello world from parent!!\n");
-               waitpid(pid, &status, 0);
-       } else {
-               printf("Hello world from child!!\n");
-               printf("Child trying to exec Hello...\n");
-               execv("/bin/hello", argv);
-       }
-       return 0;
-}
diff --git a/tests/old/fp_test.c b/tests/old/fp_test.c
deleted file mode 100644 (file)
index eaf8fb2..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <stdio.h>
-
-int main(int argc, char** argv) 
-{
-       volatile float x = 2.5;
-       volatile float y = 5.0;
-       volatile float var = x*y;
-       printf("value decimal: %d\n", (int)var);
-//     printf("value floating: %f\n", var);
-
-//     int x = 25;
-//     int y = 50;
-//     int var = x*y;
-//     printf("value: %d\n", var);
-} 
diff --git a/tests/old/fpperf.cc b/tests/old/fpperf.cc
deleted file mode 100644 (file)
index 6363f1f..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Chunk of code from stage 6 of fluidanimate, running on its own in a single
- * process, meant to run on either linux or akaros (check the ifdef below). */
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <float.h>
-#include <math.h>
-#include <cstdlib>
-#include <cstring>
-#include <algorithm>
-#include <sys/time.h>
-#include <pthread.h>
-
-typedef float fptype;
-
-class Vec3
-{
-public:
-  fptype x, y, z;
-
-  Vec3() {}
-  Vec3(fptype _x, fptype _y, fptype _z) : x(_x), y(_y), z(_z) {}
-
-  fptype  GetLengthSq() const         { return x*x + y*y + z*z; }
-  fptype  GetLength() const           { return sqrtf(GetLengthSq()); }
-  Vec3 &  Normalize()                 { return *this /= GetLength(); }
-
-  bool    operator == (Vec3 const &v) { return (x == v.x) && (y == v.y) && (z += v.z); }
-  Vec3 &  operator += (Vec3 const &v) { x += v.x;  y += v.y; z += v.z; return *this; }
-  Vec3 &  operator -= (Vec3 const &v) { x -= v.x;  y -= v.y; z -= v.z; return *this; }
-  Vec3 &  operator *= (fptype s)      { x *= s;  y *= s; z *= s; return *this; }
-  Vec3 &  operator /= (fptype s)      { fptype tmp = 1.f/s; x *= tmp;  y *= tmp; z *= tmp; return *this; }
-
-  Vec3    operator + (Vec3 const &v) const    { return Vec3(x+v.x, y+v.y, z+v.z); }
-  Vec3    operator + (fptype const &f) const  { return Vec3(x+f, y+f, z+f); }
-  Vec3    operator - () const                 { return Vec3(-x, -y, -z); }
-  Vec3    operator - (Vec3 const &v) const    { return Vec3(x-v.x, y-v.y, z-v.z); }
-  Vec3    operator * (fptype s) const         { return Vec3(x*s, y*s, z*s); }
-  Vec3    operator / (fptype s) const         { fptype tmp = 1.f/s; return Vec3(x*tmp, y*tmp, z*tmp); }
-
-  fptype  operator * (Vec3 const &v) const    { return x*v.x + y*v.y + z*v.z; }
-};
-
-float rand_f1 = 3.14;
-float rand_f2 = 6.282222;
-float rand_f3 = 443.38383;
-float rand_f4;
-float rand_f5;
-static const fptype doubleRestDensity = 2000.0;
-static const fptype viscosity = 0.4;
-
-static const Vec3 rand_v3_1(0.1, -9.8, 30.0);
-static const Vec3 rand_v3_2(0.2, -90.8, 0.5);
-static const Vec3 rand_v3_3(7.3, -444.8, 8.0);
-static const Vec3 rand_v3_4(8.4, -99.8, 0.8);
-
-Vec3 output(0, 0, 0);
-
-int main(int argc, char **argv)
-{
-       struct timeval start_tv = {0};
-       struct timeval end_tv = {0};
-       uint64_t usec_diff;
-       if (argc < 3) {
-               printf("Need 2 args\n");
-               exit(-1);
-       }
-
-       /* Disable this if you want to compile for linux with the i686-ros-g++ */
-       #if 1
-       # ifdef __ros__
-       if (argc == 4) {
-               parlib_never_yield = TRUE;
-               parlib_never_vc_request = TRUE;
-               pthread_mcp_init();
-               printf("Vcore %d mapped to pcore %d\n", 0, __procinfo.vcoremap[0].pcoreid);
-       }
-       # endif
-       #endif
-
-       rand_f4 = (float)atoi(argv[1]);
-       rand_f5 = (float)atoi(argv[2]);
-       if (gettimeofday(&start_tv, 0))
-               perror("Start time error...");
-       for (int i = 0; i < 300000000; i++) {
-       
-               Vec3 disp = rand_v3_1 - rand_v3_2 * rand_f5;
-               fptype distSq = disp.GetLengthSq();
-               fptype dist = sqrtf(std::max(distSq, (fptype)1e-12));
-               fptype hmr = rand_f1 - dist;
-               
-               Vec3 acc = disp * rand_f2 * (hmr*hmr/dist)
-                          * (rand_f3 + rand_f4 + rand_f5 - doubleRestDensity);
-               acc += (rand_v3_3 - rand_v3_4 * rand_f5) * viscosity * hmr;
-               acc /= rand_f5 * rand_f1;
-               
-               output += acc;
-       }
-       float ret = output.GetLengthSq();
-       if (gettimeofday(&end_tv, 0))
-               perror("End time error...");
-       usec_diff = (end_tv.tv_sec - start_tv.tv_sec) * 1000000 +
-                   (end_tv.tv_usec - start_tv.tv_usec);
-       printf("%f, took %.3f sec\n", ret, (float)usec_diff / 1000000);
-       return 0;
-}
diff --git a/tests/old/hart_test.c b/tests/old/hart_test.c
deleted file mode 100644 (file)
index 51fb0d4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <stdio.h>
-
-int main(int argc, char** argv) 
-{
-       printf("Goodbye cruel world!!\n");
-} 
diff --git a/tests/old/idle.c b/tests/old/idle.c
deleted file mode 100644 (file)
index df3f374..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <parlib/parlib.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-/* This will keep a core from spinning forever, but will also allow it to still
- * schedule() and run _S processes.  arg1 is the number of loops (0 for
- * forever), and arg2 is how many usec to wait per loop. */
-int main(int argc, char** argv)
-{
-       unsigned long nr_loops = 1;                     /* default, 1 loop */
-       unsigned long timeout = 5000000;        /* default, 5 sec */
-       int i = 0;
-       if (argc > 1)
-               nr_loops = strtol(argv[1], 0, 10);
-       if (argc > 2)
-               timeout = strtol(argv[2], 0, 10);
-       printf("Idling for %d usec for %d loops\n", timeout, nr_loops);
-       while (!nr_loops || i++ < nr_loops) {
-               sys_halt_core(timeout);
-               sys_yield(0);
-       }
-       return 0;
-}
diff --git a/tests/old/manycore_test.c b/tests/old/manycore_test.c
deleted file mode 100644 (file)
index e48bf70..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdio.h>
-#include <assert.h>
-#include <parlib/vcore.h>
-#include <parlib/parlib.h>
-#include <parlib/mcs.h>
-#include <parlib/uthread.h>
-
-mcs_barrier_t b;
-
-void do_work_son(int vcoreid)
-{
-       int pcoreid = sys_getpcoreid();
-       int pid = getpid();
-       printf("Hello! My Process ID: %d My VCoreID: %d My CPU: %d\n", pid, vcoreid,
-              pcoreid);
-       mcs_barrier_wait(&b,vcoreid);
-}
-
-void vcore_entry()
-{
-       assert(vcore_id() > 0);
-       do_work_son(vcore_id());
-}
-
-int main(int argc, char** argv)
-{
-       assert(vcore_id() == 0);
-       mcs_barrier_init(&b,max_vcores());
-       vcore_request_total(max_vcores());
-       do_work_son(0);
-       return 0;
-}
diff --git a/tests/old/mproctests.c b/tests/old/mproctests.c
deleted file mode 100644 (file)
index 3776757..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-#include <parlib/arch/arch.h>
-#include <parlib/parlib.h>
-#include <parlib/assert.h>
-#include <stdlib.h>
-#include <parlib/vcore.h>
-#include <ros/mman.h>
-#include <ros/resource.h>
-#include <stdio.h>
-#include <parlib/timing.h>
-#include <parlib/uthread.h>
-
-#define TEST_MMAP                                       1
-#define TEST_ONE_CORE                           2
-#define TEST_ASK_FOR_TOO_MANY_CORES     3
-#define TEST_INCREMENTAL_CHANGES        4
-#define TEST_YIELD_OUT_OF_ORDER                 5
-#define TEST_YIELD_0_OUT_OF_ORDER       6
-#define TEST_YIELD_ALL               7
-#define TEST_SWITCH_TO_RUNNABLE_S       8
-#define TEST_CRAZY_YIELDS                       9
-#define TEST_CONCURRENT_SYSCALLS       10
-
-int test = TEST_SWITCH_TO_RUNNABLE_S;
-
-static void global_tests(uint32_t vcoreid);
-
-int main(int argc, char** argv)
-{
-       uint32_t vcoreid;
-       vcore_lib_init();
-
-       if ((vcoreid = vcore_id())) {
-               printf("Should never see me! (from vcore %d)\n", vcoreid);
-       } else { // core 0
-               printf("Hello from else vcore 0\n");
-               printf("Multi-Goodbye, world, from PID: %d!\n", getpid());
-               switch (test) {
-                       case TEST_MMAP:
-                               printf("Testing MMAP\n");
-                               void *addr;
-                               addr = sys_mmap((void*)USTACKTOP - 20*PGSIZE, 8*PGSIZE, 3,
-                                               MAP_FIXED | MAP_ANONYMOUS, -1, 0);
-                               printf("got addr = 0x%08x\n", addr);
-                               *(int*)addr = 0xdeadbeef;
-                               *(int*)(addr + 3*PGSIZE) = 0xcafebabe;
-                               // these should work
-                               printf("reading addr: 0x%08x\n", *(int*)addr);
-                               printf("reading addr+3pg: 0x%08x\n", *(int*)(addr + 3*PGSIZE));
-                               // this should fault
-                               printf("Should page fault and die now.\n");
-                               *(int*)(addr - 3*PGSIZE) = 0xdeadbeef;
-                               printf("Should not see me!!!!!!!!!!!!!!!!!!\n");
-                               while(1);
-                       case TEST_ONE_CORE:
-                               vcore_request_more(1);
-                               printf("One core test's core0 is done\n");
-                               printf("Check to see it's on a worker core.\n");
-                               while(1);
-                       case TEST_ASK_FOR_TOO_MANY_CORES:
-                               vcore_request_more(12);
-                               printf("Asked for too many is done\n");
-                               return 0;
-                       case TEST_INCREMENTAL_CHANGES:
-                               vcore_request_more(4);
-                               break;
-                       default:
-                               vcore_request_more(5);
-               }
-               printf("Should see me if you want to relocate core0's context "
-                       "when moving from RUNNING_S\n");
-       }
-
-       // vcore0 only below here
-       switch (test) {
-               case TEST_YIELD_OUT_OF_ORDER:
-                       udelay(10000000);
-                       printf("Core 2 should have yielded, asking for another\n");
-                       vcore_request_more(5);
-                       break;
-               case TEST_YIELD_0_OUT_OF_ORDER:
-                       udelay(5000000);
-                       printf("Core %d yielding\n", vcoreid);
-                       sys_yield(0);
-                       printf("Core 0 came back where it left off in RUNNING_M!!!\n");
-                       break;
-       }
-       global_tests(vcoreid);
-       printf("Vcore %d Done!\n", vcoreid);
-       while (1);
-       return 0;
-}
-
-void vcore_entry(void)
-{
-       uint32_t vcoreid;
-       static int first_time = 1; // used by vcore2
-
-       vcoreid = vcore_id();
-       printf("Hello from vcore_entry in vcore %d\n", vcoreid);
-
-       if ((vcoreid == 2) && first_time) {
-               first_time = 0;
-               switch (test) {
-                       case TEST_INCREMENTAL_CHANGES:
-                               // Testing asking for less than we already have
-                               udelay(1000000);
-                               printf("Asking for too few:\n");
-                               vcore_request_more(2);
-                               // Testing getting more while running
-                               printf("Asking for more while running:\n");
-                               udelay(1000000);
-                               vcore_request_more(5);
-                               break;
-                       case TEST_YIELD_OUT_OF_ORDER:
-                               printf("Core %d yielding\n", vcoreid);
-                               sys_yield(0);
-                               break;
-                       case TEST_YIELD_0_OUT_OF_ORDER:
-                               udelay(7500000);
-                               printf("Core 0 should have yielded, asking for another\n");
-                               vcore_request_more(5);
-               }
-       }
-       global_tests(vcoreid);
-       printf("Vcore %d Done!\n", vcoreid);
-}
-
-static void global_tests(uint32_t vcoreid)
-{
-       switch (test) {
-               case TEST_YIELD_ALL:
-                       printf("Core %d yielding\n", vcoreid);
-                       sys_yield(0);
-                       // should be RUNNABLE_M now, amt_wanted == 1
-                       while(1);
-               case TEST_SWITCH_TO_RUNNABLE_S:
-                       if (vcoreid == 2) {
-                               printf("Core %d trying to request 0/ switch to _S\n", vcoreid);
-                               udelay(3000000);
-                               vcore_request_more(0);
-                               // will only see this if we are scheduled()
-                               printf("Core %d back up!\n");
-                               printf("And exiting\n");
-                               exit(0);
-                       } 
-                       while(1);
-               case TEST_CRAZY_YIELDS:
-                       udelay(300000*vcoreid);
-                       vcore_request_more(5);
-                       sys_yield(0);
-                       printf("should  never see me, unless you slip into *_S\n");
-                       break;
-               case TEST_CONCURRENT_SYSCALLS:
-                       for (int i = 0; i < 10; i++) {
-                               for (int j = 0; j < 100; j++)
-                                       sys_null();
-                               printf("Hello from vcore %d, iteration %d\n", vcoreid, i);
-                       }
-                       break;
-       }
-}
diff --git a/tests/old/msr_cycling_vcores.c b/tests/old/msr_cycling_vcores.c
deleted file mode 100644 (file)
index 391ad07..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* tests/msr_cycling_vcores.c
- *
- * This requests the max_vcores in the system, waits a bit, then gives them
- * back, looping forever.  We can't give up all vcores, based on the current
- * kernel, so we hold on to vcore0 to do the thinking. */
-
-#include <ros/resource.h>
-#include <parlib/parlib.h>
-#include <stdio.h>
-#include <parlib/vcore.h>
-#include <parlib/timing.h>
-#include <parlib/mcs.h>
-#include <parlib/uthread.h>
-
-mcs_barrier_t b;
-uint64_t begin = 0, end = 0;
-
-int main(int argc, char** argv)
-{
-       printf("Good chance this doesn't work anymore!\n");
-       mcs_barrier_init(&b, max_vcores());
-
-       vcore_request_total(max_vcores());
-       printf("We're screwed!\n");
-
-       /* should never make it here */
-       return -1;
-}
-
-void vcore_entry(void)
-{
-       uint32_t vcoreid = vcore_id();
-
-       if (vcoreid) {
-               mcs_barrier_wait(&b, vcoreid);
-               udelay(5000000);
-               if (vcoreid == 1)
-                       printf("Proc %d's vcores are yielding\n", getpid());
-               sys_yield(0);
-       } else {
-               /* trip the barrier here, all future times are in the loop */
-               mcs_barrier_wait(&b, vcoreid);
-               while (1) {
-                       udelay(15000000);
-                       printf("Proc %d requesting its cores again\n", getpid());
-                       begin = read_tsc();
-                       vcore_request_total(max_vcores());
-                       mcs_barrier_wait(&b, vcoreid);
-                       end = read_tsc();
-                       printf("Took %llu usec (%llu nsec) to get my yielded cores back.\n",
-                              udiff(begin, end), ndiff(begin, end));
-                       printf("[T]:010:%llu:%llu\n",
-                              udiff(begin, end), ndiff(begin, end));
-               }
-       }
-       printf("We're screwed!\n");
-       exit(-1);
-}
diff --git a/tests/old/msr_dumb_while.c b/tests/old/msr_dumb_while.c
deleted file mode 100644 (file)
index 6eb3f20..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* tests/msr_dumb_while.c
- *
- * This requests the max_vcores in the system, then just dumbly while loops.
- * If you send it an NE_ALARM, it'll print its TSC. */
-
-#include <stdio.h>
-#include <parlib/vcore.h>
-#include <parlib/arch/arch.h>
-#include <parlib/event.h>
-#include <parlib/uthread.h>
-
-int main(int argc, char** argv)
-{
-       /* Get EV_ALARM on vcore 1, with IPI. */
-       enable_kevent(EV_ALARM, 1, EVENT_IPI | EVENT_VCORE_PRIVATE);
-
-       vcore_request_total(max_vcores());
-
-       /* should never make it here */
-       return -1;
-}
-
-void vcore_entry(void)
-{
-       struct preempt_data *vcpd = &__procdata.vcore_preempt_data[0];
-       vcpd->notif_disabled = FALSE;
-
-       unsigned int ev_type = get_event_type(&vcpd->ev_mbox_private);
-       if (ev_type == EV_ALARM)
-               printf("[T]:009:E:%llu\n", read_tsc());
-       while(1);
-}
-
diff --git a/tests/old/msr_get_cores.c b/tests/old/msr_get_cores.c
deleted file mode 100644 (file)
index 5d39981..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/* tests/msr_get_cores.c
- *
- * This measures the time it takes to request and receive the max_vcores() in
- * the system.  The clock starts before vcore_request(), which includes the time
- * it takes to allocate transition stacks and TLS.  The clock stops after
- * barriering in vcore_entry(), while vcore0 gets restarted and barriers.  You
- * really want to restart vcore0's context so it releases the lock in
- * vcore_request().
- *
- * This will measure both the hot and cold times, with the hot times not needing
- * to have stacks mmaped and other things. */
-
-
-#include <parlib/parlib.h>
-#include <ros/mman.h>
-#include <ros/resource.h>
-#include <ros/procdata.h>
-#include <ros/bcq.h>
-#include <parlib/arch/arch.h>
-#include <stdio.h>
-#include <parlib/vcore.h>
-#include <parlib/mcs.h>
-#include <parlib/timing.h>
-#include <parlib/assert.h>
-#include <parlib/uthread.h>
-#include <parlib/event.h>
-
-mcs_barrier_t b;
-
-void *core0_tls = 0;
-uint64_t begin = 0, end = 0;
-
-int main(int argc, char** argv)
-{
-       uint32_t vcoreid = vcore_id();
-       int retval = 0;
-
-       mcs_barrier_init(&b, max_vcores());
-
-/* begin: stuff userspace needs to do before switching to multi-mode */
-       vcore_lib_init();
-       #if 0
-       /* tell the kernel where and how we want to receive notifications */
-       struct notif_method *nm;
-       for (int i = 0; i < MAX_NR_NOTIF; i++) {
-               nm = &__procdata.notif_methods[i];
-               nm->flags |= NOTIF_WANTED | NOTIF_MSG | NOTIF_IPI;
-               nm->vcoreid = i % 2; // vcore0 or 1, keepin' it fresh.
-       }
-       #endif
-       /* Need to save this somewhere that you can find it again when restarting
-        * core0 */
-       core0_tls = get_tls_desc();
-       /* Need to save our floating point state somewhere (like in the
-        * user_thread_tcb so it can be restarted too */
-/* end: stuff userspace needs to do before switching to multi-mode */
-
-       begin = read_tsc();
-       retval = vcore_request_total(max_vcores());
-       if (retval)
-               printf("Fucked!\n");
-       mcs_barrier_wait(&b, vcoreid);
-       end = read_tsc();
-
-       printf("Took %llu usec (%llu nsec) to receive %d cores (cold).\n",
-              udiff(begin, end), ndiff(begin, end), max_vcores());
-       printf("[T]:001:%llu:%llu:%d:C.\n",
-              udiff(begin, end), ndiff(begin, end), max_vcores());
-       udelay(5000000);
-       begin = read_tsc();
-       vcore_request_total(max_vcores());
-       mcs_barrier_wait(&b, vcoreid);
-       end = read_tsc();
-       printf("Took %llu usec (%llu nsec) to receive %d cores (warm).\n",
-              udiff(begin, end), ndiff(begin, end), max_vcores());
-       printf("[T]:001:%llu:%llu:%d:W.\n",
-              udiff(begin, end), ndiff(begin, end), max_vcores());
-
-       return 0;
-}
-
-void vcore_entry(void)
-{
-       uint32_t vcoreid = vcore_id();
-
-/* begin: stuff userspace needs to do to handle notifications */
-       struct vcore *vc = &__procinfo.vcoremap[vcoreid];
-       struct preempt_data *vcpd;
-       vcpd = &__procdata.vcore_preempt_data[vcoreid];
-       
-       /* Lets try to restart vcore0's context.  Note this doesn't do anything to
-        * set the appropriate TLS.  On x86, this will involve changing the LDT
-        * entry for this vcore to point to the TCB of the new user-thread. */
-       if (vcoreid == 0) {
-               handle_events(vcoreid);
-               set_tls_desc(core0_tls);
-               assert(__vcoreid == 0); /* in case anyone uses this */
-               /* Load silly state (Floating point) too */
-               pop_user_ctx(&vcpd->uthread_ctx, vcoreid);
-               panic("should never see me!");
-       }       
-/* end: stuff userspace needs to do to handle notifications */
-
-       /* all other vcores are down here */
-       mcs_barrier_wait(&b, vcoreid);
-
-       udelay(1000000);
-       if (vcoreid == 1)
-               printf("Proc %d's vcores are yielding\n", getpid());
-       sys_yield(0);
-
-       while(1);
-}
-
diff --git a/tests/old/msr_get_singlecore.c b/tests/old/msr_get_singlecore.c
deleted file mode 100644 (file)
index e4626a6..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/* tests/msr_get_singlecore.c
- *
- * Like msr_get_cores.c, but it only gets one core. */
-
-
-#include <parlib/parlib.h>
-#include <ros/mman.h>
-#include <ros/resource.h>
-#include <ros/procdata.h>
-#include <ros/bcq.h>
-#include <parlib/arch/arch.h>
-#include <stdio.h>
-#include <parlib/vcore.h>
-#include <parlib/mcs.h>
-#include <parlib/timing.h>
-#include <parlib/assert.h>
-#include <parlib/uthread.h>
-#include <parlib/event.h>
-
-mcs_barrier_t b;
-
-void *core0_tls = 0;
-uint64_t begin = 0, end = 0;
-volatile bool core1_up = FALSE;
-
-int main(int argc, char** argv)
-{
-       uint32_t vcoreid = vcore_id();
-
-       mcs_barrier_init(&b, max_vcores());
-
-/* begin: stuff userspace needs to do before switching to multi-mode */
-       vcore_lib_init();
-       #if 0
-       /* tell the kernel where and how we want to receive notifications */
-       struct notif_method *nm;
-       for (int i = 0; i < MAX_NR_NOTIF; i++) {
-               nm = &__procdata.notif_methods[i];
-               nm->flags |= NOTIF_WANTED | NOTIF_MSG | NOTIF_IPI;
-               nm->vcoreid = i % 2; // vcore0 or 1, keepin' it fresh.
-       }
-       #endif
-       /* Need to save this somewhere that you can find it again when restarting
-        * core0 */
-       core0_tls = get_tls_desc();
-       /* Need to save our floating point state somewhere (like in the
-        * user_thread_tcb so it can be restarted too */
-/* end: stuff userspace needs to do before switching to multi-mode */
-
-       /* get into multi mode */
-       vcore_request_total(1);
-
-       printf("Proc %d requesting another vcore\n", getpid());
-       begin = read_tsc();
-       vcore_request_more(1);
-       while (!core1_up)
-               cpu_relax;
-       end = read_tsc();
-       printf("Took %llu usec (%llu nsec) to receive 1 core (cold).\n",
-              udiff(begin, end), ndiff(begin, end));
-       printf("[T]:002:%llu:%llu:1:C.\n",
-              udiff(begin, end), ndiff(begin, end));
-       core1_up = FALSE;
-       udelay(2000000);
-       printf("Proc %d requesting the vcore again\n", getpid());
-       begin = read_tsc();
-       vcore_request_more(1);
-       while (!core1_up)
-               cpu_relax();
-       end = read_tsc();
-       printf("Took %llu usec (%llu nsec) to receive 1 core (warm).\n",
-              udiff(begin, end), ndiff(begin, end));
-       printf("[T]:002:%llu:%llu:1:W.\n",
-              udiff(begin, end), ndiff(begin, end));
-       return 0;
-}
-
-void vcore_entry(void)
-{
-       uint32_t vcoreid = vcore_id();
-
-/* begin: stuff userspace needs to do to handle notifications */
-       struct vcore *vc = &__procinfo.vcoremap[vcoreid];
-       struct preempt_data *vcpd;
-       vcpd = &__procdata.vcore_preempt_data[vcoreid];
-       
-       /* Lets try to restart vcore0's context.  Note this doesn't do anything to
-        * set the appropriate TLS.  On x86, this will involve changing the LDT
-        * entry for this vcore to point to the TCB of the new user-thread. */
-       if (vcoreid == 0) {
-               handle_events(vcoreid);
-               set_tls_desc(core0_tls);
-               assert(__vcoreid == 0); /* in case anyone uses this */
-               /* Load silly state (Floating point) too */
-               pop_user_ctx(&vcpd->uthread_ctx, vcoreid);
-               panic("should never see me!");
-       }       
-/* end: stuff userspace needs to do to handle notifications */
-
-       /* all other vcores are down here */
-       core1_up = TRUE;
-
-       while (core1_up)
-               cpu_relax();
-       printf("Proc %d's vcore %d is yielding\n", getpid(), vcoreid);
-       sys_yield(0);
-
-       while(1);
-}
-
diff --git a/tests/old/msr_nice_while.c b/tests/old/msr_nice_while.c
deleted file mode 100644 (file)
index e110940..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* tests/msr_dumb_while.c
- *
- * This requests the max_vcores in the system, then just while loops in a
- * userthread.  The pthread code will nicely yield if it detects an incoming
- * preemption. */
-
-#include <stdlib.h>
-#include <parlib/vcore.h>
-#include <pthread.h>
-#include <parlib/assert.h>
-#include <parlib/event.h>
-#include <parlib/uthread.h>
-
-void *while_thread(void *arg)
-{
-       while (1);
-}
-
-int main(int argc, char** argv)
-{
-       pthread_t *my_threads = malloc(sizeof(pthread_t) * max_vcores());
-
-       /* set up to receive the PREEMPT_PENDING event.  EVENT_VCORE_APPRO tells the
-        * kernel to send the msg to whichever vcore is appropriate.  Pthread code
-        * will see the preemption and yield. */
-       struct event_queue *ev_q = get_eventq_vcpd(0, EVENT_VCORE_PRIVATE);
-       ev_q->ev_flags = EVENT_IPI | EVENT_VCORE_APPRO;
-       register_kevent_q(ev_q, EV_PREEMPT_PENDING);
-
-       /* actually only need one less, since the _S will be pthread 0 */
-       for (int i = 0; i < max_vcores() - 1; i++)
-               pthread_create(&my_threads[i], NULL, &while_thread, NULL);
-
-       assert(num_vcores() == max_vcores());
-       while (1);
-
-       /* should never make it here */
-       return -1;
-}
diff --git a/tests/old/msr_single_while.c b/tests/old/msr_single_while.c
deleted file mode 100644 (file)
index f0f5234..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/* tests/msr_single_while.c
- *
- * just sits in a while loop in _S mode. */
-
-int main(int argc, char** argv)
-{
-       while(1);
-       return -1;
-}
-
diff --git a/tests/old/null.c b/tests/old/null.c
deleted file mode 100644 (file)
index 64f1885..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <stdlib.h>
-
-int main(int argc, char** argv)
-{
-       return 0;
-}
diff --git a/tests/old/proctests.c b/tests/old/proctests.c
deleted file mode 100644 (file)
index 9bc592a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <parlib/parlib.h>
-#include <stdio.h>
-
-/* This runs a variety of process tests.  For now, it just tests single-core
- * yielding among a bunch of processes (which it creates).  It needs the
- * manager() to call schedule repeatedly (not panic at some weird point) for it
- * to make progress. */
-int main(int argc, char** argv)
-{
-       int pid = getpid();
-       /* first instance.  this is ghetto, since it relies on being the first proc
-        * ever.  fix this when we can pass arguments.  (TODO) */
-       #define NUM_KIDS 5
-       #define FILENAME "/bin/proctests"
-       int child_pid[NUM_KIDS];
-       if (pid == 0x1000) {
-               for (int i = 0; i < NUM_KIDS; i++)
-                       child_pid[i] = sys_proc_create(FILENAME, strlen(FILENAME), NULL, NULL, 0);
-               for (int i = 0; i < NUM_KIDS; i++) {
-                       printf("U: attempting to spawn yielders (pid: %d)\n", child_pid[i]);
-                       sys_proc_run(child_pid[i]);
-               }
-       }
-       printf("Process %x, Started and yielding.\n", pid);
-       sys_yield(0);
-       printf("Process %x, Return from yield1, starting yield2.\n", pid);
-       sys_yield(0);
-       printf("Process %x, Return from yield2, starting yield3.\n", pid);
-       sys_yield(0);
-       printf("Process %x, Return from yield3, exiting.\n", pid);
-       return 0;
-}
diff --git a/tests/old/raise.c b/tests/old/raise.c
deleted file mode 100644 (file)
index 83f58d3..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <error.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-
-volatile int count;
-
-void sighand(int sig)
-{
-       assert(SIGUSR1 == sig);
-       ++count;
-}
-
-void sigact(int sig, siginfo_t *info, void *null)
-{
-       assert(SIGUSR1 == sig);
-       assert(sig == info->si_signo);
-       ++count;
-}
-
-int main(void)
-{
-       struct sigaction sa;
-       sigemptyset(&sa.sa_mask);
-       int nr_tests = 0;
-
-       sa.sa_handler = sighand;
-       sa.sa_flags = 0;
-       nr_tests++;
-       if (sigaction(SIGUSR1, &sa, NULL) < 0) {
-               printf("first sigaction failed: %m\n");
-               exit(1);
-       }
-       if (raise(SIGUSR1) < 0) {
-               printf("first raise failed: %m\n");
-               exit(1);
-       }
-
-       sa.sa_sigaction = sigact;
-       sa.sa_flags = SA_SIGINFO;
-       nr_tests++;
-       if (sigaction(SIGUSR1, &sa, NULL) < 0) {
-               printf("second sigaction failed: %m\n");
-               exit(1);
-       }
-       if (raise(SIGUSR1) < 0) {
-               printf("second raise failed: %m\n");
-               exit(1);
-       }
-       if (count != nr_tests) {
-               printf("signal handler not called %d times\n", nr_tests);
-               exit(1);
-       }
-       printf("Passed, exiting\n");
-       exit(0);
-}
diff --git a/tests/old/slab.c b/tests/old/slab.c
deleted file mode 100644 (file)
index 767dc2d..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <parlib/slab.h>
-#include <stdio.h>
-
-static void test_single_cache(int iters, size_t size, int align, int flags,
-                              void (*ctor)(void *, size_t),
-                              void (*dtor)(void *, size_t))
-{
-       struct kmem_cache *test_cache;
-       void *objects[iters];
-       test_cache = kmem_cache_create("test_cache", size, align, flags, ctor, dtor);
-       printf("Testing Kmem Cache:\n");
-       print_kmem_cache(test_cache);
-       for (int i = 0; i < iters; i++) {
-               objects[i] = kmem_cache_alloc(test_cache, 0);
-               printf("Buffer %d addr = %p\n", i, objects[i]);
-       }
-       for (int i = 0; i < iters; i++) {
-               kmem_cache_free(test_cache, objects[i]);
-       }
-       kmem_cache_destroy(test_cache);
-       printf("\n\n\n\n");
-}
-
-void a_ctor(void *buf, size_t size)
-{
-       printf("constructin tests\n");
-}
-void a_dtor(void *buf, size_t size)
-{
-       printf("destructin tests\n");
-}
-
-int main(void)
-{
-       test_single_cache(10, 128, 512, 0, 0, 0);
-       test_single_cache(10, 128, 4, 0, a_ctor, a_dtor);
-       test_single_cache(10, 1024, 16, 0, 0, 0);
-}
diff --git a/tests/old/softint.c b/tests/old/softint.c
deleted file mode 100644 (file)
index 7916cbd..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// buggy program - causes an illegal software interrupt
-
-int main(int argc, char** argv)
-{
-       // this is a fake page fault.  it can only be used if the DPL is 3
-       // if the DPL = 0, this causes a general prot fault, not a PF
-       #ifdef __i386__
-       asm volatile("int $14");
-       #endif
-
-       // this is a real page fault.  volatile, so the compiler doesn't remove it
-       // this will cause a PF regardless of DPL, since it's a real PF.
-       //volatile int x = *((int*)0xc0000000);
-       return 0;
-}
-
diff --git a/tests/old/spawn.c b/tests/old/spawn.c
deleted file mode 100644 (file)
index 52d63a5..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-
-#include <stdio.h>
-#include <parlib/parlib.h>
-#include <unistd.h>
-
-int main(int argc, char **argv, char **envp)
-{
-       char *p_argv[] = {0, 0, 0};
-       char *p_envp[] = {"LD_LIBRARY_PATH=/lib", 0};
-       #define FILENAME "/bin/hello"
-       //#define FILENAME "/bin/hello-sym"
-       char filename[] = FILENAME;
-       #if 0
-       /* try some bad combos */
-       int pid = sys_proc_create("garbagexxx");
-       printf("Garbage pid result: %d\n", pid);
-
-       error_t err = sys_proc_run(2342);
-       printf("sys_proc_run(2342) error: %e\n", err);
-
-       err = sys_proc_run(-1);
-       cprintf("sys_proc_run(-1) error: %e\n", err);
-       #endif
-
-       #define NUM_KIDS 5
-       int child_pid[NUM_KIDS];
-       #if 0
-       printf("U: attempting to create hello(s)\n");
-       for (int i = 0; i < NUM_KIDS; i++)
-               child_pid[i] = sys_proc_create("roslib_hello");
-
-       for (int i = 0; i < NUM_KIDS; i++) {
-               cprintf("U: attempting to run hello (pid: %d)\n", child_pid[i]);
-               sys_proc_run(child_pid[i]);
-       }
-       #endif
-       printf("U: attempting to create and run hello\n");
-       p_argv[0] = filename;
-       printf("SPAWN, I'm pid %d, filename %s\n", getpid(), filename);
-       child_pid[0] = sys_proc_create(FILENAME, strlen(FILENAME), p_argv, p_envp,
-                                      PROC_DUP_FGRP);
-       if (child_pid[0] <= 0)
-               printf("Failed to create the child\n");
-       else
-               if (sys_proc_run(child_pid[0]) < 0)
-                       printf("Failed to run the child (pid %d)\n", child_pid[0]);
-
-       #if 0
-       printf("U: attempting to create and run another hello\n");
-       child_pid[1] = sys_proc_create(FILENAME, strlen(FILENAME), 0, 0);
-       if (child_pid[1] <= 0)
-               perror("");
-       else
-               if (sys_proc_run(child_pid[1]) < 0)
-                       perror("");
-       #endif
-       return 0;
-}
diff --git a/tests/old/syscall.c b/tests/old/syscall.c
deleted file mode 100644 (file)
index c711fec..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <parlib/parlib.h>
-#include <parlib/event.h>
-#include <parlib/vcore.h>
-#include <parlib/assert.h>
-#include <ros/bcq.h>
-#include <parlib/uthread.h>
-
-/* Deprecated, don't use this in any serious way */
-
-static void handle_syscall(struct event_msg *ev_msg, unsigned int ev_type,
-                           void *data);
-struct syscall sysc = {0};
-struct event_queue *ev_q;
-void ghetto_vcore_entry(void);
-
-struct schedule_ops ghetto_sched_ops = {
-       .sched_entry = ghetto_vcore_entry,
-};
-
-int main(int argc, char** argv)
-{
-       int num_started;
-       unsigned int ev_type;
-
-       /* register our syscall handler (2LS does this) */
-       register_ev_handler(EV_SYSCALL, handle_syscall, 0);
-
-       printf("Trying to block\n");
-       /* Not doing anything else to it: no EVENT_IPI yet, etc. */
-       ev_q = get_eventq();
-       /* issue the diagnostic block syscall */
-       sysc.num = SYS_block;
-       sysc.arg0 = 5000;       /* 5ms */
-       sysc.ev_q = ev_q;
-       /* Trap */
-       num_started = __ros_arch_syscall((long)&sysc, 1);
-       if (!(atomic_read(&sysc.flags) & SC_DONE))
-               printf("Not done, looping!\n");
-       /* You could poll on this.  This is really ghetto, but i got rid of
-        * event_activity, whose sole purpose was to encourage spinning. */
-       while (!(atomic_read(&sysc.flags) & SC_DONE))
-               cpu_relax();
-       handle_event_q(ev_q);
-       /* by now, we should have run our handler */
-       /********************************************************/
-       /* Start MCP / IPI test */
-       printf("Switching to _M mode and testing an IPI-d ev_q\n");
-       printf("Our indirect ev_q is %08p\n", ev_q);
-
-/* begin: stuff userspace needs to do before switching to multi-mode */
-       /* Note we don't need to set up event reception for any particular kevent.
-        * The ev_q in the syscall said to send an IPI to vcore 0 which means an
-        * EV_EVENT will be sent straight to vcore0. */
-       /* Inits a thread for us, though we won't use it.  Just a hack to get into
-        * _M mode.  Note this requests one vcore for us */
-       struct uthread dummy = {0};
-       uthread_2ls_init(&dummy, &ghetto_sched_ops);
-       uthread_mcs_init();
-       /* Need to save our floating point state somewhere (like in the
-        * user_thread_tcb so it can be restarted too */
-       enable_notifs(0);
-/* end: stuff userspace needs to do before switching to multi-mode */
-
-       vcore_request_total(1);
-       /* now we're back in thread 0 on vcore 0 */
-       ev_q->ev_flags = EVENT_IPI;
-       ev_q->ev_vcore = 0;
-       sysc.u_data = (void*)1; /* using this to loop on */
-       /* issue the diagnostic blocking syscall */
-       sysc.num = SYS_block;
-       sysc.arg0 = 5000;       /* 5ms */
-       sysc.ev_q = ev_q;
-       num_started = __ros_arch_syscall((long)&sysc, 1);
-       /* have this thread "wait" */
-       if (!(atomic_read(&sysc.flags) & SC_DONE))
-               printf("Not done, looping on a local variable!\n");
-       while (sysc.u_data)
-               cpu_relax();
-       assert(atomic_read(&sysc.flags) & SC_DONE);
-       printf("Syscall unblocked, IPI broke me out of the loop.\n");
-
-       /* done */
-       put_eventq(ev_q);
-       printf("Syscall test exiting\n");
-       return 0;
-}
-
-static void handle_syscall(struct event_msg *ev_msg, unsigned int ev_type,
-                           void *data)
-{
-       struct syscall *my_sysc;
-       if (!ev_msg)
-               return;
-       my_sysc = ev_msg->ev_arg3;
-       printf("Handling syscall event for sysc %08p (%08p)\n",
-              my_sysc, &sysc);
-       /* our syscall should be done (we ought to check the msg pointer) */
-       if (atomic_read(&sysc.flags) & SC_DONE) 
-               printf("Syscall is done, retval: %d\n", sysc.retval);
-       else
-               printf("BUG! Syscall wasn't done!\n");
-       /* signal to thread 0 that the sysc is done, just to show this
-        * is getting done in vcore context. */
-       my_sysc->u_data = 0;
-}
-
-void ghetto_vcore_entry(void)
-{
-       uint32_t vcoreid = vcore_id();
-       static bool first_time = TRUE;
-
-/* begin: stuff userspace needs to do to handle notifications */
-
-       /* Restart vcore0's context. */
-       if (vcoreid == 0) {
-               run_current_uthread();
-               panic("should never see me!");
-       }       
-       /* unmask notifications once you can let go of the uthread_ctx and it is
-        * okay to clobber the transition stack.
-        * Check Documentation/processes.txt: 4.2.4.  In real code, you should be
-        * popping the tf of whatever user process you want (get off the x-stack) */
-       struct preempt_data *vcpd;
-       vcpd = &__procdata.vcore_preempt_data[vcoreid];
-       vcpd->notif_disabled = FALSE;
-       
-/* end: stuff userspace needs to do to handle notifications */
-       /* if you have other vcores, they'll just chill here */
-       while(1);
-}
diff --git a/tests/old/syscall_speed.c b/tests/old/syscall_speed.c
deleted file mode 100644 (file)
index 8fdef1d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdio.h>
-#include <parlib/parlib.h>
-#include <parlib/arch/arch.h>
-
-int main()
-{
-       int N = 8192;
-
-       long long tsc0 = read_tsc();
-       for(int i = 0; i < N; i++)
-               ros_syscall(SYS_null, 0, 0, 0, 0, 0, 0);
-       long long tsc1 = read_tsc();
-
-       printf("tsc0 = %lld\n",tsc0);
-       printf("syscall time = %lld\n",(tsc1-tsc0)/N);
-
-       return 0;
-}
diff --git a/tests/old/tcp_test.c b/tests/old/tcp_test.c
deleted file mode 100644 (file)
index d545543..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#define BUF_SIZE 16
-#define LARGE_BUFFER_SIZE 2048
-
-/* Test program
- *
- * Pings the server at argv1: argv2
- * gets a response and prints it
- * Running in Qemu 
- * tcp_test server_port
- * tcp_test server_addr server_port
- */
-
-int main(int argc, char* argv[]) {
-       struct sockaddr_in server;
-       char buf[BUF_SIZE] = "hello world";
-       char bulkdata[LARGE_BUFFER_SIZE] = "testme";
-       char recv_buf[BUF_SIZE];
-       int sockfd, n, inqemu;
-       struct hostent* host;
-
-       // ignore the host for now
-       if (argc == 2){
-               printf("in qemu client\n");
-               inqemu = 1;
-       }
-       else if (argc == 3){
-               printf("linux client\n");
-               inqemu = 0;
-       } else 
-       {
-               printf("incorrect number of parameters\n");
-       }
-       if (!inqemu){
-               host = gethostbyname(argv[1]); //hostname
-       }
-       bzero(&server, sizeof(server));
-       server.sin_family = AF_INET;
-       if (inqemu)
-               server.sin_port = htons(atoi(argv[1]));
-       else
-               server.sin_port = htons(atoi(argv[2]));
-
-
-       if (inqemu)
-               server.sin_addr.s_addr = inet_addr("10.0.0.1"); //hardcoded server 
-       else
-               // linux client, use the argument as the server address
-               memcpy(&server.sin_addr.s_addr, host->h_addr, host->h_length);
-       
-       char* printbuf = (char*)&server.sin_addr.s_addr;
-       int size = sizeof(server.sin_addr.s_addr);      
-       int i;
-       for (i=0; i<size;i++) {
-               printf("connecting to %x \n", ((char*)printbuf)[i]); 
-       }
-
-       sockfd = socket(AF_INET, SOCK_STREAM, 0);       
-       if (sockfd==-1) {
-               printf("socket error\n");
-               return -1;
-       }
-
-       printf ("tcp_test: sockfd %d \n", sockfd);
-       int socklen = sizeof(server);
-
-       // Set up a connection with the server
-       int rc;
-
-       if((rc = connect(sockfd, (struct sockaddr *)&server, sizeof(server))) < 0)
-       {
-               // testing closing a socket file
-               close(sockfd);
-               exit(-1);
-       }
-       // sending large chunk of data of 2K, more than one frame
-       // int sendsize =  sendto(sockfd, bulkdata, LARGE_BUFFER_SIZE, 0, (struct sockaddr*) &server, socklen);
-
-       fd_set readset;
-       int sendsize = send(sockfd, buf, strlen(buf), 0);
-       if (sendsize != strlen(buf)) 
-               printf("send operation failed error code %d \n", sendsize);
-       int j=0;
-       int result;
-       for (j=0; j<10; j++){
-               strcpy(recv_buf, "DEADBEEFDEADBEE");
-               // in udp_test, we can recv_from with a size of 5, because it discards the rest of the packet. In the TCP
-               // version, we need to be precise about the size of the recv, because the left over data will be displayed in the next
-               // packet.
-               if ((n = recv(sockfd, recv_buf, 14 , 0))< 0){ 
-                       printf("recv failed\n");
-               }
-               // recv_buf[n-1] = 0; //null terminate
-               printf("[OUTPUT] recv %d with length %d from result %s\n", j,n,  recv_buf);
-       }
-       while(1){;}
-       close(sockfd);
-}
diff --git a/tests/old/test_mmap_ipc.c b/tests/old/test_mmap_ipc.c
deleted file mode 100644 (file)
index 9f50e62..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-#include <sys/mman.h>
-#include <fcntl.h>
-#include <parlib/parlib.h>
-#include <parlib/timing.h>
-       
-int main(void)
-{
-       int pFile, *first;
-       pid_t pid;
-       pFile = open ("hello.txt", O_RDWR | O_CREAT, (mode_t)0600);
-       /* this mmap will give you a Bus Error on linux if you try to map more
-        * pages than the file contains (i think)... */
-       first = (int*)mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, pFile, 0);
-       if (first == MAP_FAILED) {
-               fprintf(stderr, "Unable to mmap the file (%d), aborting!\n", errno);
-               return -1;
-       }
-       first[0] = 3;
-       printf("the first number after initialization is %d at %08p\n", first[0],
-              first);
-       if ((pid = fork()) < 0) {
-               perror("fork error");
-               exit(1);
-       }
-       if (pid == 0) {
-               /* delay here, to avoid the race a bit */
-               udelay(1000000);
-               printf("After fork in the parent, the first number is %d\n", first[0]);
-               first[0] = 99;
-               printf("Pid 0 sees value %d at mmapped address %08p\n", first[0],
-                      first);
-       } else {
-               printf("After fork in the child, the first number is %d\n", first[0]);
-               first[0] = 11;
-               printf("Child pid %d sees value %d at mmapped address %08p\n", pid,
-                      first[0], first);
-       }
-}
diff --git a/tests/old/test_ucq.c b/tests/old/test_ucq.c
deleted file mode 100644 (file)
index 3770154..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <parlib/parlib.h>
-#include <sys/mman.h>
-#include <parlib/ucq.h>
-#include <assert.h>
-#include <parlib/arch/atomic.h>
-
-int main(int argc, char** argv)
-{
-       /* this program should only be started from the kernel for tests */
-       printf("[user] Attempting to read ucq messages from test_ucq().  "
-              "Don't call this manually.\n");
-       /* Map into a known, extremely ghetto location.  The kernel knows to look
-        * here. */
-       struct ucq *ucq = mmap((void*)USTACKTOP, PGSIZE, PROT_WRITE | PROT_READ,
-                              MAP_POPULATE, -1, 0);
-       assert((uintptr_t)ucq == USTACKTOP);
-       /* Now init it */
-       uintptr_t two_pages = (uintptr_t)mmap(0, PGSIZE * 2, PROT_WRITE | PROT_READ,
-                                             MAP_POPULATE | MAP_ANONYMOUS, -1, 0);
-       assert(two_pages);
-       ucq_init_raw(ucq, two_pages, two_pages + PGSIZE);
-       printf("[user] UCQ %08p initialized\n", ucq);
-       /* try to get a simple message */
-       struct event_msg msg;
-       /* 1: Spin til we can get a message (0 on success breaks) */
-       while (!get_ucq_msg(ucq, &msg))
-               cpu_relax();
-       printf("[user] Got simple message type %d(7) with A2 %08p(0xdeadbeef)\n",
-              msg.ev_type, msg.ev_arg2);
-       /* 2: get a bunch */
-       for (int i = 0; i < 5000; i++) {
-               while (!get_ucq_msg(ucq, &msg))
-                       cpu_relax();
-               assert(msg.ev_type == i);
-       }
-       printf("[user] #2 Received a bunch!  Last one was %d(4999), "
-              "extra pages %d(6, if #3 is 1000 and was blasted already)\n",
-              msg.ev_type, atomic_read(&ucq->nr_extra_pgs));
-       /* 3: test chaining */
-       while (atomic_read(&ucq->nr_extra_pgs) < 2)
-               cpu_relax();
-       printf("[user] #3 There's now a couple pages (%d), trying to receive...\n",
-              atomic_read(&ucq->nr_extra_pgs));
-       /* this assumes 1000 is enough for a couple pages */
-       for (int i = 0; i < 1000; i++) {
-               while (!get_ucq_msg(ucq, &msg))
-                       cpu_relax();
-               assert(msg.ev_type == i);
-       }
-       printf("[user] Done, extra pages: %d(0)\n", atomic_read(&ucq->nr_extra_pgs));
-       int extra = 0;
-       while (get_ucq_msg(ucq, &msg)) {
-               printf("[user] got %d extra messages in the ucq, type %d\n", ++extra,
-                      msg.ev_type);
-       }
-       printf("[user] Spinning...\n");
-       while(1);
-
-       return 0;
-}
diff --git a/tests/old/testbss.c b/tests/old/testbss.c
deleted file mode 100644 (file)
index 73935c5..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// test reads and writes to a large bss
-
-#include <stdint.h>
-#include <stdio.h>
-#include <parlib/assert.h>
-
-#define ARRAYSIZE (1024*1024)
-
-uint32_t bigarray[ARRAYSIZE];
-
-int main(int argc, char** argv)
-{
-       int i;
-
-       printf("Making sure bss works right...\n");
-       for (i = 0; i < ARRAYSIZE; i++)
-               if (bigarray[i] != 0)
-                       panic("bigarray[%d] isn't cleared!\n", i);
-       for (i = 0; i < ARRAYSIZE; i++)
-               bigarray[i] = i;
-       for (i = 0; i < ARRAYSIZE; i++)
-               if (bigarray[i] != i)
-                       panic("bigarray[%d] didn't hold its value!\n", i);
-
-       printf("Yes, good.  Now doing a wild write off the end...\n");
-       bigarray[ARRAYSIZE+1024] = 0;
-       panic("SHOULD HAVE TRAPPED!!!");
-       return 0;
-}
diff --git a/tests/old/tlstest.c b/tests/old/tlstest.c
deleted file mode 100644 (file)
index d5eeaf9..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <assert.h>
-#include <stdio.h>
-
-#define BAR0 0xdeadbeef
-volatile __thread int foo;
-volatile __thread int bar = BAR0;
-
-int main()
-{
-       printf("&foo = %p, &bar = %p\n",&foo,&bar);
-       assert(bar == BAR0);
-       bar = 0xcafebabe;
-       printf("bar = %p\n",bar);
-       return 0;
-}
diff --git a/tests/old/tsc_spitter.c b/tests/old/tsc_spitter.c
deleted file mode 100644 (file)
index 90f61d6..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <parlib/arch/arch.h>
-
-int main(int argc, char** argv)
-{
-       printf("[T]:004:M:%llu\n", read_tsc());
-       return 0;
-}
diff --git a/tests/old/udp_test.c b/tests/old/udp_test.c
deleted file mode 100644 (file)
index 3116cfb..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#define BUF_SIZE 16
-#define LARGE_BUFFER_SIZE 2048
-
-/* Test program
- *
- * Pings the server at argv1: argv2
- * gets a response and prints it
- */
-
-int main(int argc, char* argv[]) {
-       struct sockaddr_in server;
-       char buf[BUF_SIZE] = "hello world";
-       char bulkdata[LARGE_BUFFER_SIZE] = "testme";
-       char recv_buf[BUF_SIZE];
-       int sockfd, n, inqemu;
-       struct hostent* host;
-
-       // ignore the host for now
-       if (argc == 2){
-               printf("in qemu client\n");
-               inqemu = 1;
-       }
-       else if (argc == 3){
-               printf("linux client\n");
-               inqemu = 0;
-       } else 
-       {
-               printf("incorrect number of parameters\n");
-       }
-       if (!inqemu){
-               host = gethostbyname(argv[1]); //hostname
-       }
-       bzero(&server, sizeof(server));
-       server.sin_family = AF_INET;
-       if (inqemu)
-               server.sin_port = htons(atoi(argv[1]));
-       else
-               server.sin_port = htons(atoi(argv[2]));
-
-
-       if (inqemu)
-               server.sin_addr.s_addr = inet_addr("10.0.0.1"); //hardcoded server 
-       else
-               memcpy(&server.sin_addr.s_addr, host->h_addr, host->h_length);
-       
-       char* printbuf = (char*)&server.sin_addr.s_addr;
-       int size = sizeof(server.sin_addr.s_addr);      
-       int i;
-       for (i=0; i<size;i++) {
-               printf("%x", ((char*)printbuf)[i]); 
-       }
-
-       //server.sin_addr = *((struct in_addr *)host->h_addr);
-       sockfd = socket(AF_INET, SOCK_DGRAM, 0);        
-       if (sockfd==-1) {
-               printf("socket error\n");
-               return -1;
-       }
-
-       printf ("udp_test: sockfd %d \n", sockfd);
-       int socklen = sizeof(server);
-       // sending large chunk of data of 2K, more than one frame
-       // int sendsize =  sendto(sockfd, bulkdata, LARGE_BUFFER_SIZE, 0, (struct sockaddr*) &server, socklen);
-
-       // sending a large chunk of data but fitting in one packet
-       //int sendsize =  sendto(sockfd, bulkdata, 500, 0, (struct sockaddr*) &server, socklen);
-       fd_set readset;
-       int sendsize = sendto(sockfd, buf, strlen(buf), 0, (struct sockaddr*) &server, socklen);
-       printf("sendto returns %d, errno %d\n", sendsize, errno);
-       //assume BUF_SIZE is larger than the packet.. so we will get to see what actually comes back..
-       int j=0;
-       int result;
-       for (j=0; j<10; j++){
-               strcpy(recv_buf, "DEADBEEFDEADBEE");
-               // select before a blocking receive
-               do {
-                       FD_ZERO(&readset);
-                       FD_SET(sockfd, &readset);
-                       result = select(sockfd + 1, &readset, NULL, NULL, NULL);
-                       printf("select result %d \n", result);
-                       printf("readset %d \n", FD_ISSET(sockfd, &readset));
-               } while (result == -1 && errno == EINTR);
-               // configure recvfrom not to block when there is 
-
-               if (((n = recvfrom(sockfd, recv_buf, 5, 0, (struct sockaddr*) &server, &socklen))< 0)){ // should discard if it is udp..
-                       printf("recv failed\n");
-               }
-               recv_buf[n-1] = 0; //null terminate
-               printf("[OUTPUT] recv %d with length %d from result %s\n", j,n,  recv_buf);
-       }
-       while(1){;}
-       close(sockfd);
-}
diff --git a/tests/old/vvadd.c b/tests/old/vvadd.c
deleted file mode 100644 (file)
index 579c9be..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <assert.h>
-#include <stdio.h>
-
-int main()
-{
-       #define N 12345
-       double x[N];
-       double y[N];
-       double z[N];
-
-       for(int i = 0; i < N; i++)
-       {
-               x[i] = (double)i;
-               y[i] = (double)(2*i);
-       }
-
-       for(int i = 0; i < N; i++)
-               z[i] = x[i]+y[i];
-
-       for(int i = 0; i < N; i++)
-               assert((int)z[i] == 3*i);
-
-       printf("vvadd works!\n");
-
-       return 0;
-}