ia64/xen-unstable

changeset 886:2a289f47eb41

bitkeeper revision 1.557 (3fa7bf54uSRjwiFPziJvGyBirhU24A)

network.c, dom0_ops.h, processor.h, domain.c, dom0_ops.c, xi_build.c:
More fixes and tweaks.
author kaf24@scramble.cl.cam.ac.uk
date Tue Nov 04 15:01:40 2003 +0000 (2003-11-04)
parents 784ff7081d81
children 77eeb794412d
files tools/internal/xi_build.c xen/common/dom0_ops.c xen/common/domain.c xen/include/asm-i386/processor.h xen/include/hypervisor-ifs/dom0_ops.h xenolinux-2.4.22-sparse/arch/xeno/drivers/network/network.c
line diff
     1.1 --- a/tools/internal/xi_build.c	Tue Nov 04 14:18:59 2003 +0000
     1.2 +++ b/tools/internal/xi_build.c	Tue Nov 04 15:01:40 2003 +0000
     1.3 @@ -9,6 +9,9 @@
     1.4  #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
     1.5  #define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
     1.6  
     1.7 +static unsigned long virt_startinfo_addr;
     1.8 +static unsigned long startinfo_frame;
     1.9 +
    1.10  static char *argv0 = "internal_domain_build";
    1.11  
    1.12  static long get_tot_pages(int domain_id)
    1.13 @@ -313,10 +316,11 @@ static int setup_guestos(
    1.14          num_pgt_updates++;
    1.15      }
    1.16  
    1.17 -    builddomain->virt_startinfo_addr =
    1.18 +    virt_startinfo_addr =
    1.19          virt_load_addr + ((alloc_index-1) << PAGE_SHIFT);
    1.20 +    startinfo_frame = page_array[alloc_index-1];
    1.21  
    1.22 -    start_info = map_pfn(page_array[alloc_index-1]);
    1.23 +    start_info = map_pfn(startinfo_frame);
    1.24      memset(start_info, 0, sizeof(*start_info));
    1.25      start_info->pt_base     = virt_load_addr + ((tot_pages-1) << PAGE_SHIFT);
    1.26      start_info->mod_start   = initrd_addr;
    1.27 @@ -473,8 +477,8 @@ int main(int argc, char **argv)
    1.28      ctxt->i386_ctxt.ss = FLAT_RING1_DS;
    1.29      ctxt->i386_ctxt.cs = FLAT_RING1_CS;
    1.30      ctxt->i386_ctxt.eip = load_addr;
    1.31 -    ctxt->i386_ctxt.esp = launch_op.u.builddomain.virt_startinfo_addr;
    1.32 -    ctxt->i386_ctxt.esi = launch_op.u.builddomain.virt_startinfo_addr;
    1.33 +    ctxt->i386_ctxt.esp = virt_startinfo_addr;
    1.34 +    ctxt->i386_ctxt.esi = virt_startinfo_addr;
    1.35      ctxt->i386_ctxt.eflags = (1<<9) | (1<<2);
    1.36  
    1.37      /* FPU is set up to default initial state. */
    1.38 @@ -496,7 +500,7 @@ int main(int argc, char **argv)
    1.39  
    1.40      /* Ring 1 stack is the initial stack. */
    1.41      ctxt->ring1_ss  = FLAT_RING1_DS;
    1.42 -    ctxt->ring1_esp = launch_op.u.builddomain.virt_startinfo_addr;
    1.43 +    ctxt->ring1_esp = virt_startinfo_addr;
    1.44  
    1.45      /* No debugging. */
    1.46      memset(ctxt->debugreg, 0, sizeof(ctxt->debugreg));
    1.47 @@ -507,6 +511,8 @@ int main(int argc, char **argv)
    1.48      ctxt->failsafe_callback_cs  = FLAT_RING1_CS;
    1.49      ctxt->failsafe_callback_eip = 0;
    1.50  
    1.51 +    ctxt->start_info_frame = startinfo_frame;
    1.52 +
    1.53      launch_op.u.builddomain.domain   = domain_id;
    1.54      launch_op.u.builddomain.num_vifs = atoi(argv[3]);
    1.55  
     2.1 --- a/xen/common/dom0_ops.c	Tue Nov 04 14:18:59 2003 +0000
     2.2 +++ b/xen/common/dom0_ops.c	Tue Nov 04 15:01:40 2003 +0000
     2.3 @@ -321,6 +321,8 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     2.4                      p->failsafe_selector;
     2.5                  op.u.getdomaininfo.ctxt.failsafe_callback_eip = 
     2.6                      p->failsafe_address;
     2.7 +                op.u.getdomaininfo.ctxt.start_info_frame = 
     2.8 +                    p->thread.start_info_frame;
     2.9              }
    2.10          }
    2.11          read_unlock_irqrestore(&tasklist_lock, flags);
     3.1 --- a/xen/common/domain.c	Tue Nov 04 14:18:59 2003 +0000
     3.2 +++ b/xen/common/domain.c	Tue Nov 04 15:01:40 2003 +0000
     3.3 @@ -325,7 +325,7 @@ void release_task(struct task_struct *p)
     3.4   */
     3.5  int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *builddomain)
     3.6  {
     3.7 -    start_info_t *virt_startinfo_addr;
     3.8 +    start_info_t *startinfo;
     3.9      unsigned long phys_l2tab;
    3.10      net_ring_t *shared_rings;
    3.11      net_vif_t *net_vif;
    3.12 @@ -365,6 +365,7 @@ int final_setup_guestos(struct task_stru
    3.13      p->event_address     = builddomain->ctxt.event_callback_eip;
    3.14      p->failsafe_selector = builddomain->ctxt.failsafe_callback_cs;
    3.15      p->failsafe_address  = builddomain->ctxt.failsafe_callback_eip;
    3.16 +    p->thread.start_info_frame = builddomain->ctxt.start_info_frame;
    3.17      
    3.18      /* NB. Page base must already be pinned! */
    3.19      phys_l2tab = builddomain->ctxt.pt_base;
    3.20 @@ -375,18 +376,12 @@ int final_setup_guestos(struct task_stru
    3.21      /* Set up the shared info structure. */
    3.22      update_dom_time(p->shared_info);
    3.23  
    3.24 -    virt_startinfo_addr = (start_info_t *)builddomain->virt_startinfo_addr;
    3.25 -
    3.26 -    /*
    3.27 -     * We need to populate start_info struct within the context of the new
    3.28 -     * domain. Thus temporarely install its pagetables.
    3.29 -     */
    3.30 -    __cli();
    3.31 -    __asm__ __volatile__ ( 
    3.32 -        "mov %%eax,%%cr3" : : "a" (pagetable_val(p->mm.pagetable)));
    3.33 +    startinfo = (start_info_t *)
    3.34 +        map_domain_mem(p->thread.start_info_frame << PAGE_SHIFT);
    3.35  
    3.36      /* Add virtual network interfaces and point to them in startinfo. */
    3.37 -    while (builddomain->num_vifs-- > 0) {
    3.38 +    while ( builddomain->num_vifs-- > 0 )
    3.39 +    {
    3.40          net_vif = create_net_vif(p->domain);
    3.41          shared_rings = net_vif->shared_rings;
    3.42          if (!shared_rings) panic("no network ring!\n");
    3.43 @@ -395,19 +390,16 @@ int final_setup_guestos(struct task_stru
    3.44      for ( i = 0; i < MAX_DOMAIN_VIFS; i++ )
    3.45      {
    3.46          if ( p->net_vif_list[i] == NULL ) continue;
    3.47 -        virt_startinfo_addr->net_rings[i] = 
    3.48 +        startinfo->net_rings[i] = 
    3.49              virt_to_phys(p->net_vif_list[i]->shared_rings);
    3.50 -        memcpy(virt_startinfo_addr->net_vmac[i],
    3.51 +        memcpy(startinfo->net_vmac[i],
    3.52                 p->net_vif_list[i]->vmac, ETH_ALEN);
    3.53      }
    3.54  
    3.55      /* Add block io interface */
    3.56 -    virt_startinfo_addr->blk_ring = virt_to_phys(p->blk_ring_base);
    3.57 +    startinfo->blk_ring = virt_to_phys(p->blk_ring_base);
    3.58  
    3.59 -    /* Reinstate the caller's page tables. */
    3.60 -    __asm__ __volatile__ (
    3.61 -        "mov %%eax,%%cr3" : : "a" (pagetable_val(current->mm.pagetable)));    
    3.62 -    __sti();
    3.63 +    unmap_domain_mem(startinfo);
    3.64  
    3.65      p->flags |= PF_CONSTRUCTED;
    3.66      
    3.67 @@ -589,6 +581,9 @@ int setup_guestos(struct task_struct *p,
    3.68      update_dom_time(p->shared_info);
    3.69      p->shared_info->domain_time = 0;
    3.70  
    3.71 +    /* DOM0 can't be stopped/started, so no need for an ongoing s.i. frame. */
    3.72 +    p->thread.start_info_frame = 0;
    3.73 +
    3.74      virt_startinfo_address = (start_info_t *)
    3.75          (virt_load_address + ((alloc_index - 1) << PAGE_SHIFT));
    3.76      virt_stack_address  = (unsigned long)virt_startinfo_address;
     4.1 --- a/xen/include/asm-i386/processor.h	Tue Nov 04 14:18:59 2003 +0000
     4.2 +++ b/xen/include/asm-i386/processor.h	Tue Nov 04 15:01:40 2003 +0000
     4.3 @@ -354,6 +354,7 @@ struct tss_struct {
     4.4  };
     4.5  
     4.6  struct thread_struct {
     4.7 +    unsigned long start_info_frame; /* Filled in on DOM0_START */
     4.8      unsigned long esp1, ss1;
     4.9  /* Hardware debugging registers */
    4.10      unsigned long	debugreg[8];  /* %%db0-7 debug registers */
    4.11 @@ -385,7 +386,7 @@ extern struct desc_struct *idt_tables[];
    4.12  long set_fast_trap(struct task_struct *p, int idx);
    4.13  
    4.14  #define INIT_THREAD  {						\
    4.15 -	0, 0,		      					\
    4.16 +	0, 0, 0,		      		       		\
    4.17  	{ [0 ... 7] = 0 },	/* debugging registers */	\
    4.18  	{ { 0, }, },		/* 387 state */			\
    4.19  	0x20, { 0, 0 },		/* DEFAULT_FAST_TRAP */		\
     5.1 --- a/xen/include/hypervisor-ifs/dom0_ops.h	Tue Nov 04 14:18:59 2003 +0000
     5.2 +++ b/xen/include/hypervisor-ifs/dom0_ops.h	Tue Nov 04 15:01:40 2003 +0000
     5.3 @@ -41,6 +41,7 @@ typedef struct full_execution_context_st
     5.4      unsigned long event_callback_eip;
     5.5      unsigned long failsafe_callback_cs;     /* CS:EIP of failsafe callback  */
     5.6      unsigned long failsafe_callback_eip;
     5.7 +    unsigned long start_info_frame;         /* Page frame containing s.i.   */
     5.8  } full_execution_context_t;
     5.9  
    5.10  #define MAX_CMD_LEN       256
    5.11 @@ -94,7 +95,6 @@ typedef struct dom0_builddomain_st
    5.12  {
    5.13      /* IN variables. */
    5.14      unsigned int  domain;
    5.15 -    unsigned long virt_startinfo_addr;
    5.16      unsigned int  num_vifs;
    5.17      full_execution_context_t ctxt;
    5.18  } dom0_builddomain_t;
     6.1 --- a/xenolinux-2.4.22-sparse/arch/xeno/drivers/network/network.c	Tue Nov 04 14:18:59 2003 +0000
     6.2 +++ b/xenolinux-2.4.22-sparse/arch/xeno/drivers/network/network.c	Tue Nov 04 15:01:40 2003 +0000
     6.3 @@ -517,7 +517,7 @@ int __init init_module(void)
     6.4          goto fail;
     6.5      }
     6.6      
     6.7 -    err = request_irq(_EVENT_DEBUG, dbg_network_int, SA_SHIRQ, "debug", NULL);
     6.8 +    err = request_irq(_EVENT_DEBUG, dbg_network_int, 0, "debug", NULL);
     6.9      if ( err )
    6.10          printk(KERN_WARNING "Non-fatal error -- no debug interrupt\n");
    6.11