[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH] Run the Mini-OS application in its own thread.



Some Xen developers have questioned why one would ever need to run a
Mini-OS application before thread scheduling is enabled.  I can see no
reason to do it.  If no one else can, I suggest each an application be
a thread function that is started in kernel.c.

The following patch to kernel.c sets up and runs the application in
its own thread.

Signed-of-by: John D. Ramsdell <ramsdell@xxxxxxxxx>

diff -ur oxen-unstable/extras/mini-os/kernel.c 
xen-unstable/extras/mini-os/kernel.c
--- oxen-unstable/extras/mini-os/kernel.c       2006-06-02 01:03:40.000000000 
-0400
+++ xen-unstable/extras/mini-os/kernel.c        2006-06-07 17:39:52.000000000 
-0400
@@ -82,17 +82,6 @@
 }
 
 
-void test_xenbus(void);
-
-/* Do initialisation from a thread once the scheduler's available */
-static void init_xs(void *ign)
-{
-    init_xenbus();
-
-    test_xenbus();
-}
-
-
 u8 xen_features[XENFEAT_NR_SUBMAPS * 32];
 
 void setup_xen_features(void)
@@ -111,11 +100,13 @@
     }
 }
 
+void test_xenbus(void);
+
 /* This should be overridden by the application we are linked against. */
-__attribute__((weak)) int app_main(start_info_t *si)
+__attribute__((weak)) void app_main(void *si)
 {
     printk("Dummy main: start_info=%p\n", si);
-    return 0;
+    test_xenbus();
 }
 
 /*
@@ -183,11 +174,11 @@
     /* Init scheduler. */
     init_sched();
  
-    /* Init XenBus from a separate thread */
-    create_thread("init_xs", init_xs, NULL);
+    /* Init XenBus */
+    init_xenbus();
 
-    /* Call (possibly overridden) app_main() */
-    app_main(&start_info);
+    /* Schedule the possibly overridden app_main() function */
+    create_thread("app_main", app_main, &start_info);
 
     /* Everything initialised, start idle thread */
     run_idle_thread();

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.