Run the Mini-OS application in its own thread.
A message that is not in the archive (sent off-list or not yet received): E1FmGLS-000627-SM@host-192-168-0-1-bcn-london
RFC PATCH 1/1 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.
extras/mini-os/kernel.c +8 -17
@@ -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 ();
Quoted 4 lines · John D. Ramsdell
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.
I can, when writing a boot-loader there is no need for multiple threads, so I would like the option of not having to start (and clean up after) any.
Perhaps the last part of start_kernel() could be moved to a weak function, that people like me can override?
Regards,
Jacob
Quoted 3 lines · Jacob Gorm Hansen
I can, when writing a boot-loader there is no need for multiple threads, so I would like the option of not having to start (and clean up after) any.
I see.
Quoted 2 lines
Perhaps the last part of
start_kernel()could be moved to a weak function, that people like me can override?
I suggest we simply just leave kernel.c the way it is, and my patch be ignored.
John