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

[Xen-devel] [PATCH ARM v3 5/7] mini-os: switched initial C entry point to arch_init



From: Karim Raslan <karim.allah.ahmed@xxxxxxxxx>

arch_print_info (a debug print called during start up) was also removed.

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@xxxxxxxxx>
[talex5@xxxxxxxxx: separated from big ARM commit]
[talex5@xxxxxxxxx: restored comment, moved prototypes to headers]
Signed-off-by: Thomas Leonard <talex5@xxxxxxxxx>
---
 extras/mini-os/arch/x86/setup.c  | 44 ++++++++++++++++++++++++++++++++--------
 extras/mini-os/arch/x86/x86_32.S |  2 +-
 extras/mini-os/arch/x86/x86_64.S |  2 +-
 extras/mini-os/include/kernel.h  |  6 ++++--
 extras/mini-os/include/x86/os.h  |  2 --
 extras/mini-os/kernel.c          | 38 +++++-----------------------------
 6 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/extras/mini-os/arch/x86/setup.c b/extras/mini-os/arch/x86/setup.c
index 54046d3..58ede15 100644
--- a/extras/mini-os/arch/x86/setup.c
+++ b/extras/mini-os/arch/x86/setup.c
@@ -28,6 +28,7 @@
 
 #include <mini-os/os.h>
 #include <mini-os/lib.h> /* for printk, memcpy */
+#include <xen/xen.h>
 
 /*
  * Shared page for communicating with the hypervisor.
@@ -87,14 +88,40 @@ static inline void sse_init(void) {
 #define sse_init()
 #endif
 
+
+void start_kernel(void);
+
+/*
+ * INITIAL C ENTRY POINT.
+ */
 void
 arch_init(start_info_t *si)
 {
+       static char hello[] = "Bootstrapping...\n";
+
+       (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(hello), hello);
+
+       trap_init();
+
+       /* print out some useful information  */
+       printk("Xen Minimal OS!\n");
+       printk("  start_info: %p(VA)\n", si);
+       printk("    nr_pages: 0x%lx\n", si->nr_pages);
+       printk("  shared_inf: 0x%08lx(MA)\n", si->shared_info);
+       printk("     pt_base: %p(VA)\n", (void *)si->pt_base);
+       printk("nr_pt_frames: 0x%lx\n", si->nr_pt_frames);
+       printk("    mfn_list: %p(VA)\n", (void *)si->mfn_list);
+       printk("   mod_start: 0x%lx(VA)\n", si->mod_start);
+       printk("     mod_len: %lu\n", si->mod_len);
+       printk("       flags: 0x%x\n", (unsigned int)si->flags);
+       printk("    cmd_line: %s\n",
+                       si->cmd_line ? (const char *)si->cmd_line : "NULL");
+
        /*Initialize floating point unit */
-        fpu_init();
+       fpu_init();
 
-        /* Initialize SSE */
-        sse_init();
+       /* Initialize SSE */
+       sse_init();
 
        /* Copy the start_info struct to a globally-accessible area. */
        /* WARN: don't do printk before here, it uses information from
@@ -118,12 +145,15 @@ arch_init(start_info_t *si)
                (unsigned long)failsafe_callback, 0);
 #endif
 
-
+       start_kernel();
 }
 
 void
 arch_fini(void)
 {
+       /* Reset traps */
+       trap_fini();
+
 #ifdef __i386__
        HYPERVISOR_set_callbacks(0, 0, 0, 0);
 #else
@@ -132,9 +162,7 @@ arch_fini(void)
 }
 
 void
-arch_print_info(void)
+arch_do_exit(void)
 {
-       printk("  stack:      %p-%p\n", stack, stack + sizeof(stack));
+       stack_walk();
 }
-
-
diff --git a/extras/mini-os/arch/x86/x86_32.S b/extras/mini-os/arch/x86/x86_32.S
index fb3e30a..b9aa392 100644
--- a/extras/mini-os/arch/x86/x86_32.S
+++ b/extras/mini-os/arch/x86/x86_32.S
@@ -20,7 +20,7 @@ _start:
         lss stack_start,%esp
         andl $(~(__STACK_SIZE-1)), %esp
         push %esi 
-        call start_kernel
+        call arch_init
 
 stack_start:
        .long stack+(2*__STACK_SIZE), __KERNEL_SS
diff --git a/extras/mini-os/arch/x86/x86_64.S b/extras/mini-os/arch/x86/x86_64.S
index f022eb3..df3469e 100644
--- a/extras/mini-os/arch/x86/x86_64.S
+++ b/extras/mini-os/arch/x86/x86_64.S
@@ -21,7 +21,7 @@ _start:
         movq stack_start(%rip),%rsp
         andq $(~(__STACK_SIZE-1)), %rsp
         movq %rsi,%rdi
-        call start_kernel
+        call arch_init
 
 stack_start:
         .quad stack+(2*__STACK_SIZE)
diff --git a/extras/mini-os/include/kernel.h b/extras/mini-os/include/kernel.h
index b36f172..13e3274 100644
--- a/extras/mini-os/include/kernel.h
+++ b/extras/mini-os/include/kernel.h
@@ -1,7 +1,9 @@
 #ifndef _KERNEL_H_
 #define _KERNEL_H_
 
-extern void do_exit(void) __attribute__((noreturn));
-extern void stop_kernel(void);
+void start_kernel(void);
+void do_exit(void) __attribute__((noreturn));
+void arch_do_exit(void);
+void stop_kernel(void);
 
 #endif /* _KERNEL_H_ */
diff --git a/extras/mini-os/include/x86/os.h b/extras/mini-os/include/x86/os.h
index f193865..73b8297 100644
--- a/extras/mini-os/include/x86/os.h
+++ b/extras/mini-os/include/x86/os.h
@@ -64,8 +64,6 @@ extern shared_info_t *HYPERVISOR_shared_info;
 void trap_init(void);
 void trap_fini(void);
 
-void arch_init(start_info_t *si);
-void arch_print_info(void);
 void arch_fini(void);
 
 
diff --git a/extras/mini-os/kernel.c b/extras/mini-os/kernel.c
index 27e3c56..b9ab0a2 100644
--- a/extras/mini-os/kernel.c
+++ b/extras/mini-os/kernel.c
@@ -114,41 +114,14 @@ __attribute__((weak)) int app_main(start_info_t *si)
     return 0;
 }
 
-/*
- * INITIAL C ENTRY POINT.
- */
-void start_kernel(start_info_t *si)
+void start_kernel(void)
 {
-    static char hello[] = "Bootstrapping...\n";
-
-    (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(hello), hello);
-
-    arch_init(si);
-
-    trap_init();
-
-    /* print out some useful information  */
-    printk("Xen Minimal OS!\n");
-    printk("  start_info: %p(VA)\n", si);
-    printk("    nr_pages: 0x%lx\n", si->nr_pages);
-    printk("  shared_inf: 0x%08lx(MA)\n", si->shared_info);
-    printk("     pt_base: %p(VA)\n", (void *)si->pt_base); 
-    printk("nr_pt_frames: 0x%lx\n", si->nr_pt_frames);
-    printk("    mfn_list: %p(VA)\n", (void *)si->mfn_list); 
-    printk("   mod_start: 0x%lx(VA)\n", si->mod_start);
-    printk("     mod_len: %lu\n", si->mod_len); 
-    printk("       flags: 0x%x\n", (unsigned int)si->flags);
-    printk("    cmd_line: %s\n",  
-           si->cmd_line ? (const char *)si->cmd_line : "NULL");
-
     /* Set up events. */
     init_events();
-    
+
     /* ENABLE EVENT DELIVERY. This is disabled at start of day. */
     __sti();
 
-    arch_print_info();
-
     setup_xen_features();
 
     /* Init memory management. */
@@ -201,13 +174,12 @@ void stop_kernel(void)
     /* Reset events. */
     fini_events();
 
-    /* Reset traps */
-    trap_fini();
-
     /* Reset arch details */
     arch_fini();
 }
 
+void arch_do_exit(void);
+
 /*
  * do_exit: This is called whenever an IRET fails in entry.S.
  * This will generally be because an application has got itself into
@@ -218,7 +190,7 @@ void stop_kernel(void)
 void do_exit(void)
 {
     printk("Do_exit called!\n");
-    stack_walk();
+    arch_do_exit();
     for( ;; )
     {
         struct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_crash };
-- 
2.0.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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