WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: Jacob Gorm Hansen <jacobg@xxxxxxx>
Subject: [Xen-devel] [RFC PATCH] Run the Mini-OS application in its own thread.
From: ramsdell@xxxxxxxxx (John D. Ramsdell)
Date: 08 Jun 2006 07:20:26 -0400
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 08 Jun 2006 08:52:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <E1FmGLS-000627-SM@host-192-168-0-1-bcn-london>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
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

<Prev in Thread] Current Thread [Next in Thread>