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

[Xen-changelog] [xen-unstable] [MINIOS] Added a new file arc/x86/setup.c and moved some x86 specific



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID d913017a5c66f6923c3396fdc402e31871198da4
# Parent  5c58df8c78851d47bf7130308895c4e0ac5fa5ad
[MINIOS] Added a new file arc/x86/setup.c and moved some x86 specific
initialization stuff from kernel.c there. Two new functions are added
to handle this.

Signed-off-by: Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxxxxxxx>
---
 extras/mini-os/arch/x86/setup.c |  108 ++++++++++++++++++++++++++++++++++++++++
 extras/mini-os/include/x86/os.h |    5 +
 extras/mini-os/kernel.c         |   67 +-----------------------
 3 files changed, 116 insertions(+), 64 deletions(-)

diff -r 5c58df8c7885 -r d913017a5c66 extras/mini-os/include/x86/os.h
--- a/extras/mini-os/include/x86/os.h   Sat Sep 23 13:57:55 2006 +0100
+++ b/extras/mini-os/include/x86/os.h   Sat Sep 23 14:00:38 2006 +0100
@@ -60,6 +60,11 @@ extern shared_info_t *HYPERVISOR_shared_
 extern shared_info_t *HYPERVISOR_shared_info;
 
 void trap_init(void);
+
+void arch_init(start_info_t *si);
+void arch_print_info(void);
+
+
 
 
 
diff -r 5c58df8c7885 -r d913017a5c66 extras/mini-os/kernel.c
--- a/extras/mini-os/kernel.c   Sat Sep 23 13:57:55 2006 +0100
+++ b/extras/mini-os/kernel.c   Sat Sep 23 14:00:38 2006 +0100
@@ -38,49 +38,6 @@
 #include <gnttab.h>
 #include <xen/features.h>
 #include <xen/version.h>
-
-/*
- * Shared page for communicating with the hypervisor.
- * Events flags go here, for example.
- */
-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.
- */
-char stack[8192];
-
-
-/* Assembler interface fns in entry.S. */
-void hypervisor_callback(void);
-void failsafe_callback(void);
-
-extern char shared_info[PAGE_SIZE];
-
-#if !defined(CONFIG_X86_PAE)
-#define __pte(x) ((pte_t) { (x) } )
-#else
-#define __pte(x) ({ unsigned long long _x = (x);        \
-    ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); })
-#endif
-
-static shared_info_t *map_shared_info(unsigned long pa)
-{
-    if ( HYPERVISOR_update_va_mapping(
-        (unsigned long)shared_info, __pte(pa | 7), UVMF_INVLPG) )
-    {
-        printk("Failed to map shared_info!!\n");
-        do_exit();
-    }
-    return (shared_info_t *)shared_info;
-}
 
 
 u8 xen_features[XENFEAT_NR_SUBMAPS * 32];
@@ -126,27 +83,8 @@ void start_kernel(start_info_t *si)
 
     (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(hello), hello);
 
-    /* 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. */
-    memcpy(&start_info, si, sizeof(*si));
-    
-    /* set up minimal memory infos */
-    phys_to_machine_mapping = (unsigned long *)start_info.mfn_list;
+    arch_init(si);
 
-    /* Grab the shared_info pointer and put it in a safe place. */
-    HYPERVISOR_shared_info = map_shared_info(start_info.shared_info);
-
-    /* Set up event and failsafe callback addresses. */
-#ifdef __i386__
-    HYPERVISOR_set_callbacks(
-        __KERNEL_CS, (unsigned long)hypervisor_callback,
-        __KERNEL_CS, (unsigned long)failsafe_callback);
-#else
-    HYPERVISOR_set_callbacks(
-        (unsigned long)hypervisor_callback,
-        (unsigned long)failsafe_callback, 0);
-#endif
     trap_init();
 
     /* ENABLE EVENT DELIVERY. This is disabled at start of day. */
@@ -163,7 +101,8 @@ void start_kernel(start_info_t *si)
     printk("  flags:      0x%x\n",  (unsigned int)si->flags);
     printk("  cmd_line:   %s\n",  
            si->cmd_line ? (const char *)si->cmd_line : "NULL");
-    printk("  stack:      %p-%p\n", stack, stack + 8192);
+
+    arch_print_info();
 
     setup_xen_features();
 
diff -r 5c58df8c7885 -r d913017a5c66 extras/mini-os/arch/x86/setup.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/mini-os/arch/x86/setup.c   Sat Sep 23 14:00:38 2006 +0100
@@ -0,0 +1,108 @@
+/******************************************************************************
+ * common.c
+ * 
+ * Common stuff special to x86 goes here.
+ * 
+ * Copyright (c) 2002-2003, K A Fraser & R Neugebauer
+ * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include <os.h>
+
+
+/*
+ * Shared page for communicating with the hypervisor.
+ * Events flags go here, for example.
+ */
+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.
+ */
+char stack[8192];
+
+extern char shared_info[PAGE_SIZE];
+
+/* Assembler interface fns in entry.S. */
+void hypervisor_callback(void);
+void failsafe_callback(void);
+
+#if !defined(CONFIG_X86_PAE)
+#define __pte(x) ((pte_t) { (x) } )
+#else
+#define __pte(x) ({ unsigned long long _x = (x);        \
+    ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); })
+#endif
+
+static
+shared_info_t *map_shared_info(unsigned long pa)
+{
+       if ( HYPERVISOR_update_va_mapping(
+               (unsigned long)shared_info, __pte(pa | 7), UVMF_INVLPG) )
+       {
+               printk("Failed to map shared_info!!\n");
+               do_exit();
+       }
+       return (shared_info_t *)shared_info;
+}
+
+void
+arch_init(start_info_t *si)
+{
+       /* 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. */
+       memcpy(&start_info, si, sizeof(*si));
+
+       /* set up minimal memory infos */
+       phys_to_machine_mapping = (unsigned long *)start_info.mfn_list;
+
+       /* Grab the shared_info pointer and put it in a safe place. */
+       HYPERVISOR_shared_info = map_shared_info(start_info.shared_info);
+
+           /* Set up event and failsafe callback addresses. */
+#ifdef __i386__
+       HYPERVISOR_set_callbacks(
+               __KERNEL_CS, (unsigned long)hypervisor_callback,
+               __KERNEL_CS, (unsigned long)failsafe_callback);
+#else
+       HYPERVISOR_set_callbacks(
+               (unsigned long)hypervisor_callback,
+               (unsigned long)failsafe_callback, 0);
+#endif
+
+}
+
+void
+arch_print_info(void)
+{
+       printk("  stack:      %p-%p\n", stack, stack + 8192);
+}
+
+

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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