]> xenbits.xensource.com Git - people/pauldu/mini-os.git/commitdiff
mini-os: remove using start_info in architecture independent code
authorJuergen Gross <jgross@suse.com>
Mon, 22 Aug 2016 07:01:09 +0000 (09:01 +0200)
committerWei Liu <wei.liu2@citrix.com>
Wed, 24 Aug 2016 10:37:05 +0000 (11:37 +0100)
The start_info structure should be used only in case of CONFIG_PARAVIRT
defined. Remove it from being used in other places. Especially the
usage as parameter for applications linked to the kernel is no good
idea.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
arch/arm/setup.c
arch/x86/setup.c
daytime.c
include/hypervisor.h
kernel.c
main.c
test.c

index 05b405be81847c0a92e6374704899c8670550fdc..b65023ca4c189c7bb4dee32942a2bb7277eecc32 100644 (file)
@@ -8,13 +8,6 @@
 #include <arch_mm.h>
 #include <libfdt.h>
 
-/*
- * This structure contains start-of-day info, such as pagetable base pointer,
- * address of the shared_info structure, and things like that.
- * On x86, the hypervisor passes it to us. On ARM, we fill it in ourselves.
- */
-union start_info_union start_info_union;
-
 /*
  * Shared page for communicating with the hypervisor.
  * Events flags go here, for example.
@@ -47,7 +40,6 @@ void arch_init(void *dtb_pointer, uint32_t physical_offset)
     /* Map shared_info page */
     HYPERVISOR_shared_info = map_shared_info(NULL);
 
-    /* Fill in start_info */
     get_console(NULL);
     get_xenbus(NULL);
 
index 278e88f623d86598f77fa60c1c2f26b3a2085757..50aa504dc2597bc1476565556710d3fa4cb4b48d 100644 (file)
  */
 shared_info_t *HYPERVISOR_shared_info;
 
-/*
- * This structure contains start-of-day info, such as pagetable base pointer,
- * address of the shared_info structure, and things like that.
- */
-union start_info_union start_info_union;
-
 /*
  * Just allocate the kernel stack here. SS:ESP is set up to point here
  * in head.S.
@@ -151,7 +145,6 @@ arch_init(void *par)
        /* Setup memory management info from start_info. */
        arch_mm_preinit(par);
 
-       /* Copy the start_info struct to a globally-accessible area. */
        /* WARN: don't do printk before here, it uses information from
           shared_info. Use xprintk instead. */
        get_console(par);
@@ -162,7 +155,6 @@ arch_init(void *par)
        HYPERVISOR_shared_info = map_shared_info(par);
 
        si = par;
-       memcpy(&start_info, si, sizeof(*si));
 
        /* print out some useful information  */
        printk("Xen Minimal OS!\n");
index 7dc0de05e946e25ae25181217e3d4c76f6c3bbcd..6049e7829e2306fa9c1fe769b21282e50df05481 100644 (file)
--- a/daytime.c
+++ b/daytime.c
@@ -60,7 +60,7 @@ void run_server(void *p)
 }
 
 
-int app_main(start_info_t *si)
+int app_main(void *p)
 {
     create_thread("server", run_server, NULL);
     return 0;
index 7c44702322d707dd64afe9b8075d19dce6509f7c..3073a8ad37a720170f784121a175dc4f9472505c 100644 (file)
 #include <xen/hvm/hvm_op.h>
 #include <mini-os/traps.h>
 
-/*
- * a placeholder for the start of day information passed up from the hypervisor
- */
-union start_info_union
-{
-    start_info_t start_info;
-    char padding[512];
-};
-extern union start_info_union start_info_union;
-#define start_info (start_info_union.start_info)
-
 /* hypervisor.c */
 #ifndef CONFIG_PARAVIRT
 int hvm_get_parameter(int idx, uint64_t *value);
index f22997e079f82f36ed485c40e1c16cca8790b5cf..0d84a9bc9d8c832a1220d3d93d49b8aa18d3f39a 100644 (file)
--- a/kernel.c
+++ b/kernel.c
@@ -110,9 +110,9 @@ static void shutdown_thread(void *p)
 
 
 /* This should be overridden by the application we are linked against. */
-__attribute__((weak)) int app_main(start_info_t *si)
+__attribute__((weak)) int app_main(void *p)
 {
-    printk("kernel.c: dummy main: start_info=%p\n", si);
+    printk("kernel.c: dummy main: par=%p\n", p);
     return 0;
 }
 
@@ -149,7 +149,7 @@ void start_kernel(void)
 #endif
 
     /* Call (possibly overridden) app_main() */
-    app_main(&start_info);
+    app_main(NULL);
 
     /* Everything initialised, start idle thread */
     run_idle_thread();
diff --git a/main.c b/main.c
index 71e3be31d197dfc80ff05b2f123ffa5dacda70a2..263364c46cee134d4200f36d300a941c3d54a13e 100644 (file)
--- a/main.c
+++ b/main.c
@@ -185,10 +185,10 @@ void _exit(int ret)
     do_exit();
 }
 
-int app_main(start_info_t *si)
+int app_main(void *p)
 {
-    printk("main.c: dummy main: start_info=%p\n", si);
-    main_thread = create_thread("main", call_main, si);
+    printk("main.c: dummy main: par=%p\n", p);
+    main_thread = create_thread("main", call_main, p);
     return 0;
 }
 #endif
diff --git a/test.c b/test.c
index 154af497f2ff26ec1d627253562dcc1eac992ad5..42a2666182e0848a801042bbbc5bffc55ce9f01b 100644 (file)
--- a/test.c
+++ b/test.c
@@ -552,28 +552,28 @@ static void shutdown_thread(void *p)
 }
 #endif
 
-int app_main(start_info_t *si)
+int app_main(void *p)
 {
-    printk("Test main: start_info=%p\n", si);
+    printk("Test main: par=%p\n", p);
 #ifdef CONFIG_XENBUS
-    create_thread("xenbus_tester", xenbus_tester, si);
+    create_thread("xenbus_tester", xenbus_tester, p);
 #endif
-    create_thread("periodic_thread", periodic_thread, si);
+    create_thread("periodic_thread", periodic_thread, p);
 #ifdef CONFIG_NETFRONT
-    create_thread("netfront", netfront_thread, si);
+    create_thread("netfront", netfront_thread, p);
 #endif
 #ifdef CONFIG_BLKFRONT
-    create_thread("blkfront", blkfront_thread, si);
+    create_thread("blkfront", blkfront_thread, p);
 #endif
 #if defined(CONFIG_FBFRONT) && defined(CONFIG_KBDFRONT)
-    create_thread("fbfront", fbfront_thread, si);
-    create_thread("kbdfront", kbdfront_thread, si);
+    create_thread("fbfront", fbfront_thread, p);
+    create_thread("kbdfront", kbdfront_thread, p);
 #endif
 #ifdef CONFIG_PCIFRONT
-    create_thread("pcifront", pcifront_thread, si);
+    create_thread("pcifront", pcifront_thread, p);
 #endif
 #ifdef CONFIG_XENBUS
-    create_thread("shutdown", shutdown_thread, si);
+    create_thread("shutdown", shutdown_thread, p);
 #endif
     return 0;
 }