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

[Minios-devel] [PATCH v3 43/43] mini-os: refactor the shutdown



The start_info_t is only defined when XEN_HAVE_PV_GUEST_ENTRY is
is true.

But the arm does not support XEN_HAVE_PV_GUEST_ENTRY.
It brings compiler errors when compiling the minios for arm64.

This patch does some refactor to the shutdown code:
  1.) change the parameter to "void *" for init_shutdown()
  2.) Use XEN_HAVE_PV_GUEST_ENTRY macro to guard the
      kernel_suspend()/start_info_ptr.

Signed-off-by: Huang Shijie <shijie.huang@xxxxxxx>
---
 arch/arm/setup.c   |  2 +-
 include/shutdown.h |  2 +-
 kernel.c           |  2 +-
 shutdown.c         | 20 ++++++++++++++++----
 4 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/arch/arm/setup.c b/arch/arm/setup.c
index ab82eda..8e48f73 100644
--- a/arch/arm/setup.c
+++ b/arch/arm/setup.c
@@ -48,7 +48,7 @@ void arch_init(void *dtb_pointer, paddr_t physical_offset)
 
     gic_init();
 
-    start_kernel();
+    start_kernel(NULL);
 }
 
 void
diff --git a/include/shutdown.h b/include/shutdown.h
index 88993cb..816e66d 100644
--- a/include/shutdown.h
+++ b/include/shutdown.h
@@ -3,7 +3,7 @@
 
 #include <mini-os/hypervisor.h>
 
-void init_shutdown(start_info_t *si);
+void init_shutdown(void *si);
 void fini_shutdown(void);
 void kernel_suspend(void);
 
diff --git a/kernel.c b/kernel.c
index 301273d..ab6ca82 100644
--- a/kernel.c
+++ b/kernel.c
@@ -107,7 +107,7 @@ void start_kernel(void* par)
 
 #ifdef CONFIG_XENBUS
     /* Init shutdown thread */
-    init_shutdown((start_info_t *)par);
+    init_shutdown(par);
 #endif
 
     /* Call (possibly overridden) app_main() */
diff --git a/shutdown.c b/shutdown.c
index c7c92cb..81d89fd 100644
--- a/shutdown.c
+++ b/shutdown.c
@@ -46,7 +46,6 @@
 #include <mini-os/xmalloc.h>
 
 
-static start_info_t *start_info_ptr;
 
 #ifdef CONFIG_XENBUS
 static const char *path = "control/shutdown";
@@ -111,9 +110,15 @@ static void shutdown_thread(void *p)
     }
 }
 
-void init_shutdown(start_info_t *si)
+#ifdef XEN_HAVE_PV_GUEST_ENTRY
+static start_info_t *start_info_ptr;
+#endif
+
+void init_shutdown(void *si)
 {
-    start_info_ptr = si;
+#ifdef XEN_HAVE_PV_GUEST_ENTRY
+    start_info_ptr = (start_info_t *)si;
+#endif
 
     end_shutdown_thread = 0;
     create_thread("shutdown", shutdown_thread, NULL);
@@ -131,8 +136,8 @@ void fini_shutdown(void)
         do_exit();
     }
 }
-#endif
 
+#ifdef XEN_HAVE_PV_GUEST_ENTRY
 void kernel_suspend(void)
 {
     int rc;
@@ -157,3 +162,10 @@ void kernel_suspend(void)
         printk("MiniOS resumed from suspend!\n");
     }
 }
+#else
+void kernel_suspend(void)
+{
+}
+#endif
+
+#endif
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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