]> xenbits.xensource.com Git - mini-os.git/commitdiff
mini-os: Use a single start_info_ptr variable
authorCostin Lupu <costin.lupu@cs.pub.ro>
Wed, 19 Aug 2020 15:45:36 +0000 (18:45 +0300)
committerWei Liu <wl@xen.org>
Thu, 27 Aug 2020 13:39:20 +0000 (13:39 +0000)
The second definition of the `start_info_ptr` variable was introduced by commit
e05eb0 which was part of a series trying to add suspend/resume support to
mini-os. This patch removes the second definition by reverting some changes of
the mentioned commit and of commit 892b66.

However the logic in shutdown.c is still left in an inconsistent state because
it still doesn't work for ARM. The solution should be part of a future patch.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
arch/x86/setup.c
include/kernel.h
include/shutdown.h
kernel.c
shutdown.c

index 4fd8e39c6d7334726c24591e79078f402bddcff2..64b22c5e1ae07095759e0aac49405cc61e8bf5b0 100644 (file)
@@ -45,7 +45,7 @@ union start_info_union start_info_union;
 /*
  * This pointer holds a reference to the copy of the start_info struct.
  */
-static start_info_t *start_info_ptr;
+start_info_t *start_info_ptr;
 
 /*
  * Shared page for communicating with the hypervisor.
@@ -221,7 +221,7 @@ arch_init(void *par)
 #endif
        start_info_ptr = (start_info_t *)par;
 
-       start_kernel((start_info_t *)par);
+       start_kernel();
 }
 
 void arch_pre_suspend(void)
index 742abf5fcd45353acef842b822ffb36331f699e5..161d757103e92fb8ec4a90d1713af6cacb2e8f79 100644 (file)
@@ -4,7 +4,7 @@
 #define MAX_CMDLINE_SIZE 1024
 extern char cmdline[MAX_CMDLINE_SIZE];
 
-void start_kernel(void* par);
+void start_kernel(void);
 void pre_suspend(void);
 void post_suspend(int canceled);
 void do_exit(void) __attribute__((noreturn));
index 88993cbf2783e44a170697b0e3897115d51d42be..ba71aeb0c1019e9eb5bdf58913d949a63a6fb338 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <mini-os/hypervisor.h>
 
-void init_shutdown(start_info_t *si);
+void init_shutdown(void);
 void fini_shutdown(void);
 void kernel_suspend(void);
 
index 301273dc9b5deb77e626aab0bcb182434e4b9d1b..1f97d8dd85b7a3640ef2122a3e60052c4709517a 100644 (file)
--- a/kernel.c
+++ b/kernel.c
@@ -77,7 +77,7 @@ __attribute__((weak)) int app_main(void *p)
     return 0;
 }
 
-void start_kernel(void* par)
+void start_kernel(void)
 {
     /* Set up events. */
     init_events();
@@ -107,7 +107,7 @@ void start_kernel(void* par)
 
 #ifdef CONFIG_XENBUS
     /* Init shutdown thread */
-    init_shutdown((start_info_t *)par);
+    init_shutdown();
 #endif
 
     /* Call (possibly overridden) app_main() */
index 4c0b13cc32dbb42002afe4f3068879e9cac14a44..08546704b2c473c7e97cbd6665e0d795b31d19a0 100644 (file)
@@ -46,7 +46,7 @@
 #include <mini-os/xmalloc.h>
 
 
-static start_info_t *start_info_ptr;
+extern start_info_t *start_info_ptr;
 
 #ifdef CONFIG_XENBUS
 static const char *path = "control/shutdown";
@@ -111,10 +111,8 @@ static void shutdown_thread(void *p)
     }
 }
 
-void init_shutdown(start_info_t *si)
+void init_shutdown(void)
 {
-    start_info_ptr = si;
-
     end_shutdown_thread = 0;
     create_thread("shutdown", shutdown_thread, NULL);
 }
@@ -145,6 +143,8 @@ void kernel_suspend(void)
     /*
      * This hypercall returns 1 if the suspend
      * was cancelled and 0 if resuming in a new domain
+     *
+     * TODO Fix this for ARM
      */
     rc = HYPERVISOR_suspend(virt_to_mfn(start_info_ptr));