ia64/xen-unstable

changeset 3339:597555bad4b5

bitkeeper revision 1.1159.1.509 (41d2caf2cGsHkns4vKFDopvGUuM4BQ)

Merge
author kaf24@scramble.cl.cam.ac.uk
date Wed Dec 29 15:19:14 2004 +0000 (2004-12-29)
parents a477f7643de6 4b44501cd54c
children e8043ed6d8d5
files xen/arch/x86/boot/x86_32.S xen/arch/x86/setup.c xen/common/domain.c xen/common/kernel.c xen/drivers/char/console.c xen/include/xen/domain.h xen/include/xen/lib.h
line diff
     1.1 --- a/xen/arch/x86/boot/x86_32.S	Wed Dec 29 14:46:12 2004 +0000
     1.2 +++ b/xen/arch/x86/boot/x86_32.S	Wed Dec 29 15:19:14 2004 +0000
     1.3 @@ -150,7 +150,7 @@ 1:      /* Paging enabled, so we can now
     1.4          je      start_secondary
     1.5  
     1.6          /* Call into main C routine. This should never return.*/
     1.7 -       	call	cmain
     1.8 +       	call	__start_xen
     1.9          ud2     /* Force a panic (invalid opcode). */
    1.10  
    1.11  /* This is the default interrupt handler. */
     2.1 --- a/xen/arch/x86/setup.c	Wed Dec 29 14:46:12 2004 +0000
     2.2 +++ b/xen/arch/x86/setup.c	Wed Dec 29 15:19:14 2004 +0000
     2.3 @@ -7,6 +7,9 @@
     2.4  #include <xen/serial.h>
     2.5  #include <xen/softirq.h>
     2.6  #include <xen/acpi.h>
     2.7 +#include <xen/console.h>
     2.8 +#include <xen/trace.h>
     2.9 +#include <xen/multiboot.h>
    2.10  #include <asm/bitops.h>
    2.11  #include <asm/smp.h>
    2.12  #include <asm/processor.h>
    2.13 @@ -15,6 +18,18 @@
    2.14  #include <asm/desc.h>
    2.15  #include <asm/domain_page.h>
    2.16  #include <asm/pdb.h>
    2.17 +#include <asm/shadow.h>
    2.18 +
    2.19 +/* opt_dom0_mem: Kilobytes of memory allocated to domain 0. */
    2.20 +static unsigned int opt_dom0_mem = 16000;
    2.21 +integer_param("dom0_mem", opt_dom0_mem);
    2.22 +
    2.23 +/*
    2.24 + * opt_xenheap_megabytes: Size of Xen heap in megabytes, excluding the
    2.25 + * pfn_info table and allocation bitmap.
    2.26 + */
    2.27 +static unsigned int opt_xenheap_megabytes = XENHEAP_DEFAULT_MB;
    2.28 +integer_param("xenheap_megabytes", opt_xenheap_megabytes);
    2.29  
    2.30  /* opt_noht: If true, Hyperthreading is ignored. */
    2.31  int opt_noht = 0;
    2.32 @@ -37,6 +52,8 @@ boolean_param("ignorebiostables", opt_ig
    2.33  static int opt_watchdog = 0;
    2.34  boolean_param("watchdog", opt_watchdog);
    2.35  
    2.36 +unsigned long xenheap_phys_end;
    2.37 +
    2.38  extern void arch_init_memory(void);
    2.39  extern void init_IRQ(void);
    2.40  extern void trap_init(void);
    2.41 @@ -335,7 +352,7 @@ static void __init do_initcalls(void)
    2.42  
    2.43  unsigned long pci_mem_start = 0x10000000;
    2.44  
    2.45 -void __init start_of_day(void)
    2.46 +static void __init start_of_day(void)
    2.47  {
    2.48      unsigned long low_mem_size;
    2.49      
    2.50 @@ -445,3 +462,176 @@ void __init start_of_day(void)
    2.51  
    2.52      watchdog_on = 1;
    2.53  }
    2.54 +
    2.55 +void __init __start_xen(multiboot_info_t *mbi)
    2.56 +{
    2.57 +    unsigned long max_page;
    2.58 +    unsigned char *cmdline;
    2.59 +    module_t *mod = (module_t *)__va(mbi->mods_addr);
    2.60 +    void *heap_start;
    2.61 +    unsigned long max_mem;
    2.62 +    unsigned long dom0_memory_start, dom0_memory_end;
    2.63 +    unsigned long initial_images_start, initial_images_end;
    2.64 +
    2.65 +    /* Parse the command-line options. */
    2.66 +    cmdline = (unsigned char *)(mbi->cmdline ? __va(mbi->cmdline) : NULL);
    2.67 +    cmdline_parse(cmdline);
    2.68 +
    2.69 +    /* Must do this early -- e.g., spinlocks rely on get_current(). */
    2.70 +    set_current(&idle0_task);
    2.71 +
    2.72 +    /* We initialise the serial devices very early so we can get debugging. */
    2.73 +    serial_init_stage1();
    2.74 +
    2.75 +    init_console();
    2.76 +
    2.77 +    /* We require memory and module information. */
    2.78 +    if ( (mbi->flags & 9) != 9 )
    2.79 +    {
    2.80 +        printk("FATAL ERROR: Bad flags passed by bootloader: 0x%x\n", 
    2.81 +               (unsigned)mbi->flags);
    2.82 +        for ( ; ; ) ;
    2.83 +    }
    2.84 +
    2.85 +    if ( mbi->mods_count == 0 )
    2.86 +    {
    2.87 +        printk("Require at least one Multiboot module!\n");
    2.88 +        for ( ; ; ) ;
    2.89 +    }
    2.90 +
    2.91 +    if ( opt_xenheap_megabytes < 4 )
    2.92 +    {
    2.93 +        printk("Xen heap size is too small to safely continue!\n");
    2.94 +        for ( ; ; ) ;
    2.95 +    }
    2.96 +
    2.97 +    xenheap_phys_end = opt_xenheap_megabytes << 20;
    2.98 +
    2.99 +    max_mem = max_page = (mbi->mem_upper+1024) >> (PAGE_SHIFT - 10);
   2.100 +
   2.101 +#if defined(__i386__)
   2.102 +
   2.103 +    initial_images_start = DIRECTMAP_PHYS_END;
   2.104 +    initial_images_end   = initial_images_start + 
   2.105 +        (mod[mbi->mods_count-1].mod_end - mod[0].mod_start);
   2.106 +    if ( initial_images_end > (max_page << PAGE_SHIFT) )
   2.107 +    {
   2.108 +        printk("Not enough memory to stash the DOM0 kernel image.\n");
   2.109 +        for ( ; ; ) ;
   2.110 +    }
   2.111 +    memmove((void *)initial_images_start,  /* use low mapping */
   2.112 +            (void *)mod[0].mod_start,      /* use low mapping */
   2.113 +            mod[mbi->mods_count-1].mod_end - mod[0].mod_start);
   2.114 +
   2.115 +    if ( opt_xenheap_megabytes > XENHEAP_DEFAULT_MB )
   2.116 +    {
   2.117 +        printk("Xen heap size is limited to %dMB - you specified %dMB.\n",
   2.118 +               XENHEAP_DEFAULT_MB, opt_xenheap_megabytes);
   2.119 +        for ( ; ; ) ;
   2.120 +    }
   2.121 +
   2.122 +    ASSERT((sizeof(struct pfn_info) << 20) <=
   2.123 +           (FRAMETABLE_VIRT_END - FRAMETABLE_VIRT_START));
   2.124 +
   2.125 +    init_frametable((void *)FRAMETABLE_VIRT_START, max_page);
   2.126 +
   2.127 +#elif defined(__x86_64__)
   2.128 +
   2.129 +    init_frametable(__va(xenheap_phys_end), max_page);
   2.130 +
   2.131 +    initial_images_start = __pa(frame_table) + frame_table_size;
   2.132 +    initial_images_end   = initial_images_start + 
   2.133 +        (mod[mbi->mods_count-1].mod_end - mod[0].mod_start);
   2.134 +    if ( initial_images_end > (max_page << PAGE_SHIFT) )
   2.135 +    {
   2.136 +        printk("Not enough memory to stash the DOM0 kernel image.\n");
   2.137 +        for ( ; ; ) ;
   2.138 +    }
   2.139 +    memmove(__va(initial_images_start),
   2.140 +            __va(mod[0].mod_start),
   2.141 +            mod[mbi->mods_count-1].mod_end - mod[0].mod_start);
   2.142 +
   2.143 +#endif
   2.144 +
   2.145 +    dom0_memory_start    = (initial_images_end + ((4<<20)-1)) & ~((4<<20)-1);
   2.146 +    dom0_memory_end      = dom0_memory_start + (opt_dom0_mem << 10);
   2.147 +    dom0_memory_end      = (dom0_memory_end + PAGE_SIZE - 1) & PAGE_MASK;
   2.148 +    
   2.149 +    /* Cheesy sanity check: enough memory for DOM0 allocation + some slack? */
   2.150 +    if ( (dom0_memory_end + (8<<20)) > (max_page << PAGE_SHIFT) )
   2.151 +    {
   2.152 +        printk("Not enough memory for DOM0 memory reservation.\n");
   2.153 +        for ( ; ; ) ;
   2.154 +    }
   2.155 +
   2.156 +    printk("Initialised %luMB memory (%lu pages) on a %luMB machine\n",
   2.157 +           max_page >> (20-PAGE_SHIFT), max_page,
   2.158 +	   max_mem  >> (20-PAGE_SHIFT));
   2.159 +
   2.160 +    heap_start = memguard_init(&_end);
   2.161 +    heap_start = __va(init_heap_allocator(__pa(heap_start), max_page));
   2.162 + 
   2.163 +    init_xenheap_pages(__pa(heap_start), xenheap_phys_end);
   2.164 +    printk("Xen heap size is %luKB\n", 
   2.165 +	   (xenheap_phys_end-__pa(heap_start))/1024 );
   2.166 +
   2.167 +    init_domheap_pages(dom0_memory_end, max_page << PAGE_SHIFT);
   2.168 +
   2.169 +    /* Initialise the slab allocator. */
   2.170 +    xmem_cache_init();
   2.171 +    xmem_cache_sizes_init(max_page);
   2.172 +
   2.173 +    domain_startofday();
   2.174 +
   2.175 +    start_of_day();
   2.176 +
   2.177 +    grant_table_init();
   2.178 +
   2.179 +    shadow_mode_init();
   2.180 +
   2.181 +    /* Create initial domain 0. */
   2.182 +    dom0 = do_createdomain(0, 0);
   2.183 +    if ( dom0 == NULL )
   2.184 +        panic("Error creating domain 0\n");
   2.185 +
   2.186 +    set_bit(DF_PRIVILEGED, &dom0->flags);
   2.187 +
   2.188 +    /* Grab the DOM0 command line. Skip past the image name. */
   2.189 +    cmdline = (unsigned char *)(mod[0].string ? __va(mod[0].string) : NULL);
   2.190 +    if ( cmdline != NULL )
   2.191 +    {
   2.192 +        while ( *cmdline == ' ' ) cmdline++;
   2.193 +        if ( (cmdline = strchr(cmdline, ' ')) != NULL )
   2.194 +            while ( *cmdline == ' ' ) cmdline++;
   2.195 +    }
   2.196 +
   2.197 +    /*
   2.198 +     * We're going to setup domain0 using the module(s) that we stashed safely
   2.199 +     * above our heap. The second module, if present, is an initrd ramdisk.
   2.200 +     */
   2.201 +    if ( construct_dom0(dom0, dom0_memory_start, dom0_memory_end,
   2.202 +                        (char *)initial_images_start, 
   2.203 +                        mod[0].mod_end-mod[0].mod_start,
   2.204 +                        (mbi->mods_count == 1) ? 0 :
   2.205 +                        (char *)initial_images_start + 
   2.206 +                        (mod[1].mod_start-mod[0].mod_start),
   2.207 +                        (mbi->mods_count == 1) ? 0 :
   2.208 +                        mod[mbi->mods_count-1].mod_end - mod[1].mod_start,
   2.209 +                        cmdline) != 0)
   2.210 +        panic("Could not set up DOM0 guest OS\n");
   2.211 +
   2.212 +    /* The stash space for the initial kernel image can now be freed up. */
   2.213 +    init_domheap_pages(__pa(frame_table) + frame_table_size,
   2.214 +                       dom0_memory_start);
   2.215 +
   2.216 +    scrub_heap_pages();
   2.217 +
   2.218 +    init_trace_bufs();
   2.219 +
   2.220 +    /* Give up the VGA console if DOM0 is configured to grab it. */
   2.221 +    console_endboot(cmdline && strstr(cmdline, "tty0"));
   2.222 +
   2.223 +    domain_unpause_by_systemcontroller(current);
   2.224 +    domain_unpause_by_systemcontroller(dom0);
   2.225 +    startup_cpu_idle_loop();
   2.226 +}
     3.1 --- a/xen/common/domain.c	Wed Dec 29 14:46:12 2004 +0000
     3.2 +++ b/xen/common/domain.c	Wed Dec 29 15:19:14 2004 +0000
     3.3 @@ -23,6 +23,18 @@ rwlock_t domlist_lock = RW_LOCK_UNLOCKED
     3.4  struct domain *domain_hash[DOMAIN_HASH_SIZE];
     3.5  struct domain *domain_list;
     3.6  
     3.7 +xmem_cache_t *domain_struct_cachep;
     3.8 +struct domain *dom0;
     3.9 +
    3.10 +void __init domain_startofday(void)
    3.11 +{
    3.12 +    domain_struct_cachep = xmem_cache_create(
    3.13 +        "domain_cache", sizeof(struct domain),
    3.14 +        0, SLAB_HWCACHE_ALIGN, NULL, NULL);
    3.15 +    if ( domain_struct_cachep == NULL )
    3.16 +        panic("No slab cache for domain structs.");
    3.17 +}
    3.18 +
    3.19  struct domain *do_createdomain(domid_t dom_id, unsigned int cpu)
    3.20  {
    3.21      struct domain *d, **pd;
     4.1 --- a/xen/common/kernel.c	Wed Dec 29 14:46:12 2004 +0000
     4.2 +++ b/xen/common/kernel.c	Wed Dec 29 15:19:14 2004 +0000
     4.3 @@ -7,283 +7,61 @@
     4.4   * Copyright (c) 2002-2003 K A Fraser
     4.5   */
     4.6  
     4.7 -#include <stdarg.h>
     4.8  #include <xen/config.h>
     4.9  #include <xen/init.h>
    4.10  #include <xen/lib.h>
    4.11  #include <xen/errno.h>
    4.12 -#include <xen/spinlock.h>
    4.13 -#include <xen/multiboot.h>
    4.14 -#include <xen/sched.h>
    4.15 -#include <xen/mm.h>
    4.16 -#include <xen/delay.h>
    4.17  #include <xen/compile.h>
    4.18 -#include <xen/console.h>
    4.19 -#include <xen/serial.h>
    4.20 -#include <xen/trace.h>
    4.21 -#include <asm/shadow.h>
    4.22 -#include <asm/io.h>
    4.23 -#include <asm/uaccess.h>
    4.24 -#include <asm/domain_page.h>
    4.25 -#include <public/dom0_ops.h>
    4.26 -
    4.27 -/* opt_dom0_mem: Kilobytes of memory allocated to domain 0. */
    4.28 -static unsigned int opt_dom0_mem = 16000;
    4.29 -integer_param("dom0_mem", opt_dom0_mem);
    4.30 -
    4.31 -/*
    4.32 - * opt_xenheap_megabytes: Size of Xen heap in megabytes, excluding the
    4.33 - * pfn_info table and allocation bitmap.
    4.34 - */
    4.35 -static unsigned int opt_xenheap_megabytes = XENHEAP_DEFAULT_MB;
    4.36 -integer_param("xenheap_megabytes", opt_xenheap_megabytes);
    4.37 +#include <xen/sched.h>
    4.38  
    4.39 -unsigned long xenheap_phys_end;
    4.40 -
    4.41 -xmem_cache_t *domain_struct_cachep;
    4.42 -xmem_cache_t *exec_domain_struct_cachep;
    4.43 -struct domain *dom0;
    4.44 -
    4.45 -vm_assist_info_t vm_assist_info[MAX_VMASST_TYPE + 1];
    4.46 -
    4.47 -void start_of_day(void);
    4.48 -
    4.49 -void cmain(multiboot_info_t *mbi)
    4.50 +void cmdline_parse(char *cmdline)
    4.51  {
    4.52 -    unsigned long max_page;
    4.53 -    unsigned char *cmdline;
    4.54 -    module_t *mod = (module_t *)__va(mbi->mods_addr);
    4.55 -    void *heap_start;
    4.56 -    unsigned long max_mem;
    4.57 -    unsigned long dom0_memory_start, dom0_memory_end;
    4.58 -    unsigned long initial_images_start, initial_images_end;
    4.59 +    unsigned char *opt_end, *opt;
    4.60 +    struct kernel_param *param;
    4.61 +    
    4.62 +    if ( cmdline == NULL )
    4.63 +        return;
    4.64  
    4.65 -    /* Parse the command-line options. */
    4.66 -    cmdline = (unsigned char *)(mbi->cmdline ? __va(mbi->cmdline) : NULL);
    4.67 -    if ( cmdline != NULL )
    4.68 +    while ( *cmdline == ' ' )
    4.69 +        cmdline++;
    4.70 +    cmdline = strchr(cmdline, ' '); /* skip the image name */
    4.71 +    while ( cmdline != NULL )
    4.72      {
    4.73 -        unsigned char *opt_end, *opt;
    4.74 -        struct kernel_param *param;
    4.75          while ( *cmdline == ' ' )
    4.76              cmdline++;
    4.77 -        cmdline = strchr(cmdline, ' '); /* skip the image name */
    4.78 -        while ( cmdline != NULL )
    4.79 +        if ( *cmdline == '\0' )
    4.80 +            break;
    4.81 +        opt_end = strchr(cmdline, ' ');
    4.82 +        if ( opt_end != NULL )
    4.83 +            *opt_end++ = '\0';
    4.84 +        opt = strchr(cmdline, '=');
    4.85 +        if ( opt != NULL )
    4.86 +            *opt++ = '\0';
    4.87 +        for ( param = &__setup_start; param != &__setup_end; param++ )
    4.88          {
    4.89 -            while ( *cmdline == ' ' )
    4.90 -                cmdline++;
    4.91 -            if ( *cmdline == '\0' )
    4.92 -                break;
    4.93 -            opt_end = strchr(cmdline, ' ');
    4.94 -            if ( opt_end != NULL )
    4.95 -                *opt_end++ = '\0';
    4.96 -            opt = strchr(cmdline, '=');
    4.97 -            if ( opt != NULL )
    4.98 -                *opt++ = '\0';
    4.99 -            for ( param = &__setup_start; param != &__setup_end; param++ )
   4.100 +            if ( strcmp(param->name, cmdline ) != 0 )
   4.101 +                continue;
   4.102 +            switch ( param->type )
   4.103              {
   4.104 -                if ( strcmp(param->name, cmdline ) != 0 )
   4.105 -                    continue;
   4.106 -                switch ( param->type )
   4.107 +            case OPT_STR:
   4.108 +                if ( opt != NULL )
   4.109                  {
   4.110 -                case OPT_STR:
   4.111 -                    if ( opt != NULL )
   4.112 -                    {
   4.113 -                        strncpy(param->var, opt, param->len);
   4.114 -                        ((char *)param->var)[param->len-1] = '\0';
   4.115 -                    }
   4.116 -                    break;
   4.117 -                case OPT_UINT:
   4.118 -                    if ( opt != NULL )
   4.119 -                        *(unsigned int *)param->var =
   4.120 -                            simple_strtol(opt, (char **)&opt, 0);
   4.121 -                    break;
   4.122 -                case OPT_BOOL:
   4.123 -                    *(int *)param->var = 1;
   4.124 -                    break;
   4.125 +                    strncpy(param->var, opt, param->len);
   4.126 +                    ((char *)param->var)[param->len-1] = '\0';
   4.127                  }
   4.128 +                break;
   4.129 +            case OPT_UINT:
   4.130 +                if ( opt != NULL )
   4.131 +                    *(unsigned int *)param->var =
   4.132 +                        simple_strtol(opt, (char **)&opt, 0);
   4.133 +                break;
   4.134 +            case OPT_BOOL:
   4.135 +                *(int *)param->var = 1;
   4.136 +                break;
   4.137              }
   4.138 -            cmdline = opt_end;
   4.139          }
   4.140 -    }
   4.141 -
   4.142 -    /* Must do this early -- e.g., spinlocks rely on get_current(). */
   4.143 -    set_current(&idle0_exec_domain);
   4.144 -
   4.145 -    /* We initialise the serial devices very early so we can get debugging. */
   4.146 -    serial_init_stage1();
   4.147 -
   4.148 -    init_console();
   4.149 -
   4.150 -    /* HELLO WORLD --- start-of-day banner text. */
   4.151 -    printk(XEN_BANNER);
   4.152 -    printk(" http://www.cl.cam.ac.uk/netos/xen\n");
   4.153 -    printk(" University of Cambridge Computer Laboratory\n\n");
   4.154 -    printk(" Xen version %d.%d%s (%s@%s) (%s) %s\n",
   4.155 -           XEN_VERSION, XEN_SUBVERSION, XEN_EXTRAVERSION,
   4.156 -           XEN_COMPILE_BY, XEN_COMPILE_DOMAIN,
   4.157 -           XEN_COMPILER, XEN_COMPILE_DATE);
   4.158 -    printk(" Latest ChangeSet: %s\n\n", XEN_CHANGESET);
   4.159 -    set_printk_prefix("(XEN) ");
   4.160 -
   4.161 -    /* We require memory and module information. */
   4.162 -    if ( (mbi->flags & 9) != 9 )
   4.163 -    {
   4.164 -        printk("FATAL ERROR: Bad flags passed by bootloader: 0x%x\n", 
   4.165 -               (unsigned)mbi->flags);
   4.166 -        for ( ; ; ) ;
   4.167 -    }
   4.168 -
   4.169 -    if ( mbi->mods_count == 0 )
   4.170 -    {
   4.171 -        printk("Require at least one Multiboot module!\n");
   4.172 -        for ( ; ; ) ;
   4.173 -    }
   4.174 -
   4.175 -    if ( opt_xenheap_megabytes < 4 )
   4.176 -    {
   4.177 -        printk("Xen heap size is too small to safely continue!\n");
   4.178 -        for ( ; ; ) ;
   4.179 -    }
   4.180 -
   4.181 -    xenheap_phys_end = opt_xenheap_megabytes << 20;
   4.182 -
   4.183 -    max_mem = max_page = (mbi->mem_upper+1024) >> (PAGE_SHIFT - 10);
   4.184 -
   4.185 -#if defined(__i386__)
   4.186 -
   4.187 -    initial_images_start = DIRECTMAP_PHYS_END;
   4.188 -    initial_images_end   = initial_images_start + 
   4.189 -        (mod[mbi->mods_count-1].mod_end - mod[0].mod_start);
   4.190 -    if ( initial_images_end > (max_page << PAGE_SHIFT) )
   4.191 -    {
   4.192 -        printk("Not enough memory to stash the DOM0 kernel image.\n");
   4.193 -        for ( ; ; ) ;
   4.194 -    }
   4.195 -    memmove((void *)initial_images_start,  /* use low mapping */
   4.196 -            (void *)mod[0].mod_start,      /* use low mapping */
   4.197 -            mod[mbi->mods_count-1].mod_end - mod[0].mod_start);
   4.198 -
   4.199 -    if ( opt_xenheap_megabytes > XENHEAP_DEFAULT_MB )
   4.200 -    {
   4.201 -        printk("Xen heap size is limited to %dMB - you specified %dMB.\n",
   4.202 -               XENHEAP_DEFAULT_MB, opt_xenheap_megabytes);
   4.203 -        for ( ; ; ) ;
   4.204 +        cmdline = opt_end;
   4.205      }
   4.206 -
   4.207 -    ASSERT((sizeof(struct pfn_info) << 20) <=
   4.208 -           (FRAMETABLE_VIRT_END - FRAMETABLE_VIRT_START));
   4.209 -
   4.210 -    init_frametable((void *)FRAMETABLE_VIRT_START, max_page);
   4.211 -
   4.212 -#elif defined(__x86_64__)
   4.213 -
   4.214 -    init_frametable(__va(xenheap_phys_end), max_page);
   4.215 -
   4.216 -    initial_images_start = __pa(frame_table) + frame_table_size;
   4.217 -    initial_images_end   = initial_images_start + 
   4.218 -        (mod[mbi->mods_count-1].mod_end - mod[0].mod_start);
   4.219 -    if ( initial_images_end > (max_page << PAGE_SHIFT) )
   4.220 -    {
   4.221 -        printk("Not enough memory to stash the DOM0 kernel image.\n");
   4.222 -        for ( ; ; ) ;
   4.223 -    }
   4.224 -    memmove(__va(initial_images_start),
   4.225 -            __va(mod[0].mod_start),
   4.226 -            mod[mbi->mods_count-1].mod_end - mod[0].mod_start);
   4.227 -
   4.228 -#endif
   4.229 -
   4.230 -    dom0_memory_start    = (initial_images_end + ((4<<20)-1)) & ~((4<<20)-1);
   4.231 -    dom0_memory_end      = dom0_memory_start + (opt_dom0_mem << 10);
   4.232 -    dom0_memory_end      = (dom0_memory_end + PAGE_SIZE - 1) & PAGE_MASK;
   4.233 -    
   4.234 -    /* Cheesy sanity check: enough memory for DOM0 allocation + some slack? */
   4.235 -    if ( (dom0_memory_end + (8<<20)) > (max_page << PAGE_SHIFT) )
   4.236 -    {
   4.237 -        printk("Not enough memory for DOM0 memory reservation.\n");
   4.238 -        for ( ; ; ) ;
   4.239 -    }
   4.240 -
   4.241 -    printk("Initialised %luMB memory (%lu pages) on a %luMB machine\n",
   4.242 -           max_page >> (20-PAGE_SHIFT), max_page,
   4.243 -	   max_mem  >> (20-PAGE_SHIFT));
   4.244 -
   4.245 -    heap_start = memguard_init(&_end);
   4.246 -    heap_start = __va(init_heap_allocator(__pa(heap_start), max_page));
   4.247 - 
   4.248 -    init_xenheap_pages(__pa(heap_start), xenheap_phys_end);
   4.249 -    printk("Xen heap size is %luKB\n", 
   4.250 -	   (xenheap_phys_end-__pa(heap_start))/1024 );
   4.251 -
   4.252 -    init_domheap_pages(dom0_memory_end, max_page << PAGE_SHIFT);
   4.253 -
   4.254 -    /* Initialise the slab allocator. */
   4.255 -    xmem_cache_init();
   4.256 -    xmem_cache_sizes_init(max_page);
   4.257 -
   4.258 -    domain_struct_cachep = xmem_cache_create(
   4.259 -        "domain_cache", sizeof(struct domain),
   4.260 -        0, SLAB_HWCACHE_ALIGN, NULL, NULL);
   4.261 -    if ( domain_struct_cachep == NULL )
   4.262 -        panic("No slab cache for task structs.");
   4.263 -
   4.264 -    exec_domain_struct_cachep = xmem_cache_create(
   4.265 -        "exec_dom_cache", sizeof(struct exec_domain),
   4.266 -        0, SLAB_HWCACHE_ALIGN, NULL, NULL);
   4.267 -    if ( exec_domain_struct_cachep == NULL )
   4.268 -        panic("No slab cache for task structs.");
   4.269 -
   4.270 -    start_of_day();
   4.271 -
   4.272 -    grant_table_init();
   4.273 -
   4.274 -    /* Create initial domain 0. */
   4.275 -    dom0 = do_createdomain(0, 0);
   4.276 -    if ( dom0 == NULL )
   4.277 -        panic("Error creating domain 0\n");
   4.278 -
   4.279 -    set_bit(DF_PRIVILEGED, &dom0->d_flags);
   4.280 -
   4.281 -    shadow_mode_init();
   4.282 -
   4.283 -    /* Grab the DOM0 command line. Skip past the image name. */
   4.284 -    cmdline = (unsigned char *)(mod[0].string ? __va(mod[0].string) : NULL);
   4.285 -    if ( cmdline != NULL )
   4.286 -    {
   4.287 -        while ( *cmdline == ' ' ) cmdline++;
   4.288 -        if ( (cmdline = strchr(cmdline, ' ')) != NULL )
   4.289 -            while ( *cmdline == ' ' ) cmdline++;
   4.290 -    }
   4.291 -
   4.292 -    /*
   4.293 -     * We're going to setup domain0 using the module(s) that we stashed safely
   4.294 -     * above our heap. The second module, if present, is an initrd ramdisk.
   4.295 -     */
   4.296 -    if ( construct_dom0(dom0, dom0_memory_start, dom0_memory_end,
   4.297 -                        (char *)initial_images_start, 
   4.298 -                        mod[0].mod_end-mod[0].mod_start,
   4.299 -                        (mbi->mods_count == 1) ? 0 :
   4.300 -                        (char *)initial_images_start + 
   4.301 -                        (mod[1].mod_start-mod[0].mod_start),
   4.302 -                        (mbi->mods_count == 1) ? 0 :
   4.303 -                        mod[mbi->mods_count-1].mod_end - mod[1].mod_start,
   4.304 -                        cmdline) != 0)
   4.305 -        panic("Could not set up DOM0 guest OS\n");
   4.306 -
   4.307 -    /* The stash space for the initial kernel image can now be freed up. */
   4.308 -    init_domheap_pages(__pa(frame_table) + frame_table_size,
   4.309 -                       dom0_memory_start);
   4.310 -
   4.311 -    scrub_heap_pages();
   4.312 -
   4.313 -    init_trace_bufs();
   4.314 -
   4.315 -    /* Give up the VGA console if DOM0 is configured to grab it. */
   4.316 -    console_endboot(cmdline && strstr(cmdline, "tty0"));
   4.317 -
   4.318 -    domain_unpause_by_systemcontroller(current->domain);
   4.319 -    domain_unpause_by_systemcontroller(dom0);
   4.320 -    startup_cpu_idle_loop();
   4.321  }
   4.322  
   4.323  /*
   4.324 @@ -297,6 +75,7 @@ long do_xen_version(int cmd)
   4.325      return (XEN_VERSION<<16) | (XEN_SUBVERSION);
   4.326  }
   4.327  
   4.328 +vm_assist_info_t vm_assist_info[MAX_VMASST_TYPE + 1];
   4.329  long do_vm_assist(unsigned int cmd, unsigned int type)
   4.330  {
   4.331      return vm_assist(current->domain, cmd, type);
     5.1 --- a/xen/drivers/char/console.c	Wed Dec 29 14:46:12 2004 +0000
     5.2 +++ b/xen/drivers/char/console.c	Wed Dec 29 15:19:14 2004 +0000
     5.3 @@ -8,6 +8,7 @@
     5.4  
     5.5  #include <stdarg.h>
     5.6  #include <xen/config.h>
     5.7 +#include <xen/compile.h>
     5.8  #include <xen/init.h>
     5.9  #include <xen/lib.h>
    5.10  #include <xen/errno.h>
    5.11 @@ -416,6 +417,17 @@ void init_console(void)
    5.12      init_vga();
    5.13  
    5.14      serial_set_rx_handler(sercon_handle, serial_rx);
    5.15 +
    5.16 +    /* HELLO WORLD --- start-of-day banner text. */
    5.17 +    printk(XEN_BANNER);
    5.18 +    printk(" http://www.cl.cam.ac.uk/netos/xen\n");
    5.19 +    printk(" University of Cambridge Computer Laboratory\n\n");
    5.20 +    printk(" Xen version %d.%d%s (%s@%s) (%s) %s\n",
    5.21 +           XEN_VERSION, XEN_SUBVERSION, XEN_EXTRAVERSION,
    5.22 +           XEN_COMPILE_BY, XEN_COMPILE_DOMAIN,
    5.23 +           XEN_COMPILER, XEN_COMPILE_DATE);
    5.24 +    printk(" Latest ChangeSet: %s\n\n", XEN_CHANGESET);
    5.25 +    set_printk_prefix("(XEN) ");
    5.26  }
    5.27  
    5.28  void console_endboot(int disable_vga)
     6.1 --- a/xen/include/xen/domain.h	Wed Dec 29 14:46:12 2004 +0000
     6.2 +++ b/xen/include/xen/domain.h	Wed Dec 29 15:19:14 2004 +0000
     6.3 @@ -2,7 +2,7 @@
     6.4  #ifndef __XEN_DOMAIN_H__
     6.5  #define __XEN_DOMAIN_H__
     6.6  
     6.7 -
     6.8 +extern void domain_startofday(void);
     6.9  
    6.10  /*
    6.11   * Arch-specifics.
     7.1 --- a/xen/include/xen/lib.h	Wed Dec 29 14:46:12 2004 +0000
     7.2 +++ b/xen/include/xen/lib.h	Wed Dec 29 15:19:14 2004 +0000
     7.3 @@ -19,7 +19,8 @@ printk("Memory Reservation 0x%lx, %lu by
     7.4  
     7.5  struct domain;
     7.6  
     7.7 -/* kernel.c */
     7.8 +void cmdline_parse(char *cmdline);
     7.9 +
    7.10  #define printk printf
    7.11  void printf(const char *format, ...);
    7.12  void panic(const char *format, ...);