ia64/xen-unstable

view extras/mini-os/arch/x86/setup.c @ 13878:9d103e5fd471

[XEN] Fix typos in comment describing 32on64 memory layout

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
author Ian Campbell <ian.campbell@xensource.com>
date Thu Feb 08 12:33:32 2007 +0000 (2007-02-08)
parents d913017a5c66
children a510c94ceaa3 75cb82d277be
line source
1 /******************************************************************************
2 * common.c
3 *
4 * Common stuff special to x86 goes here.
5 *
6 * Copyright (c) 2002-2003, K A Fraser & R Neugebauer
7 * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to
11 * deal in the Software without restriction, including without limitation the
12 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
13 * sell copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE.
26 *
27 */
29 #include <os.h>
32 /*
33 * Shared page for communicating with the hypervisor.
34 * Events flags go here, for example.
35 */
36 shared_info_t *HYPERVISOR_shared_info;
38 /*
39 * This structure contains start-of-day info, such as pagetable base pointer,
40 * address of the shared_info structure, and things like that.
41 */
42 union start_info_union start_info_union;
44 /*
45 * Just allocate the kernel stack here. SS:ESP is set up to point here
46 * in head.S.
47 */
48 char stack[8192];
50 extern char shared_info[PAGE_SIZE];
52 /* Assembler interface fns in entry.S. */
53 void hypervisor_callback(void);
54 void failsafe_callback(void);
56 #if !defined(CONFIG_X86_PAE)
57 #define __pte(x) ((pte_t) { (x) } )
58 #else
59 #define __pte(x) ({ unsigned long long _x = (x); \
60 ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); })
61 #endif
63 static
64 shared_info_t *map_shared_info(unsigned long pa)
65 {
66 if ( HYPERVISOR_update_va_mapping(
67 (unsigned long)shared_info, __pte(pa | 7), UVMF_INVLPG) )
68 {
69 printk("Failed to map shared_info!!\n");
70 do_exit();
71 }
72 return (shared_info_t *)shared_info;
73 }
75 void
76 arch_init(start_info_t *si)
77 {
78 /* Copy the start_info struct to a globally-accessible area. */
79 /* WARN: don't do printk before here, it uses information from
80 shared_info. Use xprintk instead. */
81 memcpy(&start_info, si, sizeof(*si));
83 /* set up minimal memory infos */
84 phys_to_machine_mapping = (unsigned long *)start_info.mfn_list;
86 /* Grab the shared_info pointer and put it in a safe place. */
87 HYPERVISOR_shared_info = map_shared_info(start_info.shared_info);
89 /* Set up event and failsafe callback addresses. */
90 #ifdef __i386__
91 HYPERVISOR_set_callbacks(
92 __KERNEL_CS, (unsigned long)hypervisor_callback,
93 __KERNEL_CS, (unsigned long)failsafe_callback);
94 #else
95 HYPERVISOR_set_callbacks(
96 (unsigned long)hypervisor_callback,
97 (unsigned long)failsafe_callback, 0);
98 #endif
100 }
102 void
103 arch_print_info(void)
104 {
105 printk(" stack: %p-%p\n", stack, stack + 8192);
106 }