ia64/xen-unstable

changeset 4341:ed530b24ab7c

bitkeeper revision 1.1236.1.130 (4244e3f89CxDxAfTO7Rtb2HsrEirWA)

DomainU's can now be loaded from domain0 using hypercalls
author djm@sportsman.spdomain
date Sat Mar 26 04:24:24 2005 +0000 (2005-03-26)
parents 22fdee49d272
children fac5011f75be
files xen/arch/ia64/domain.c xen/arch/ia64/hypercall.c xen/arch/ia64/xenmisc.c xen/arch/ia64/xensetup.c
line diff
     1.1 --- a/xen/arch/ia64/domain.c	Thu Mar 24 22:16:25 2005 +0000
     1.2 +++ b/xen/arch/ia64/domain.c	Sat Mar 26 04:24:24 2005 +0000
     1.3 @@ -311,7 +311,8 @@ extern unsigned long vhpt_paddr, vhpt_pe
     1.4  
     1.5  	pmd = pmd_offset(pgd, mpaddr);
     1.6  	if (pmd_none(*pmd))
     1.7 -		pmd_populate(mm, pmd, pte_alloc_one(mm,mpaddr));
     1.8 +		pmd_populate_kernel(mm, pmd, pte_alloc_one_kernel(mm,mpaddr));
     1.9 +//		pmd_populate(mm, pmd, pte_alloc_one(mm,mpaddr));
    1.10  
    1.11  	pte = pte_offset_map(pmd, mpaddr);
    1.12  	if (pte_none(*pte)) {
    1.13 @@ -509,14 +510,17 @@ parsedomainelfimage(char *elfbase, unsig
    1.14  	    return -EINVAL;
    1.15  	}
    1.16  
    1.17 +#if 0
    1.18  	/* Find the section-header strings table. */
    1.19  	if ( ehdr.e_shstrndx == SHN_UNDEF )
    1.20  	{
    1.21  	    printk("ELF image has no section-header strings table (shstrtab).\n");
    1.22  	    return -EINVAL;
    1.23  	}
    1.24 +#endif
    1.25  
    1.26  	*entry = ehdr.e_entry;
    1.27 +printf("parsedomainelfimage: entry point = %p\n",*entry);
    1.28  
    1.29  	return 0;
    1.30  }
    1.31 @@ -559,8 +563,16 @@ void alloc_domU_staging(void)
    1.32  		while(1);
    1.33  	}
    1.34  	else domU_staging_area = (unsigned long *)__va(domU_staging_start);
    1.35 -	printf("alloc_domU_staging: domU_staging_start=%p\n",domU_staging_start);
    1.36 +	printf("alloc_domU_staging: domU_staging_area=%p\n",domU_staging_area);
    1.37 +
    1.38 +}
    1.39  
    1.40 +unsigned long
    1.41 +domU_staging_read_8(unsigned long at)
    1.42 +{
    1.43 +	// no way to return errors so just do it
    1.44 +	return domU_staging_area[at>>3];
    1.45 +	
    1.46  }
    1.47  
    1.48  unsigned long
    1.49 @@ -569,7 +581,7 @@ domU_staging_write_32(unsigned long at, 
    1.50  {
    1.51  	if (at + 32 > domU_staging_size) return -1;
    1.52  	if (at & 0x1f) return -1;
    1.53 -	at >>= 5;
    1.54 +	at >>= 3;
    1.55  	domU_staging_area[at++] = a;
    1.56  	domU_staging_area[at++] = b;
    1.57  	domU_staging_area[at++] = c;
    1.58 @@ -796,7 +808,7 @@ int construct_domU(struct domain *d,
    1.59  		d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
    1.60  
    1.61  	/* Copy the OS image. */
    1.62 -	printk("calling loaddomainelfimage\n");
    1.63 +	printk("calling loaddomainelfimage(%p,%p)\n",d,image_start);
    1.64  	loaddomainelfimage(d,image_start);
    1.65  	printk("loaddomainelfimage returns\n");
    1.66  
    1.67 @@ -813,7 +825,11 @@ int construct_domU(struct domain *d,
    1.68  // FIXME: When dom0 can construct domains, this goes away (or is rewritten)
    1.69  int launch_domainU(unsigned long size)
    1.70  {
    1.71 -	static int next = 100;  // FIXME
    1.72 +#ifdef CLONE_DOMAIN0
    1.73 +	static int next = CLONE_DOMAIN0+1;
    1.74 +#else
    1.75 +	static int next = 1;
    1.76 +#endif	
    1.77  
    1.78  	struct domain *d = do_createdomain(next,0);
    1.79  	if (!d) {
     2.1 --- a/xen/arch/ia64/hypercall.c	Thu Mar 24 22:16:25 2005 +0000
     2.2 +++ b/xen/arch/ia64/hypercall.c	Sat Mar 26 04:24:24 2005 +0000
     2.3 @@ -89,7 +89,6 @@ ia64_hypercall (struct pt_regs *regs)
     2.4  			vcpu_get_gr(ed,32),
     2.5  			vcpu_get_gr(ed,33));
     2.6  		break;
     2.7 -#ifdef DOMU_BUILD_STAGING
     2.8  	    case 0xfffd: // test dummy hypercall
     2.9  		regs->r8 = launch_domainU(
    2.10  			vcpu_get_gr(ed,32));
    2.11 @@ -102,6 +101,8 @@ ia64_hypercall (struct pt_regs *regs)
    2.12  			vcpu_get_gr(ed,35),
    2.13  			vcpu_get_gr(ed,36));
    2.14  		break;
    2.15 -#endif
    2.16 +	    case 0xfffb: // test dummy hypercall
    2.17 +		regs->r8 = domU_staging_read_8(vcpu_get_gr(ed,32));
    2.18 +		break;
    2.19  	}
    2.20  }
     3.1 --- a/xen/arch/ia64/xenmisc.c	Thu Mar 24 22:16:25 2005 +0000
     3.2 +++ b/xen/arch/ia64/xenmisc.c	Sat Mar 26 04:24:24 2005 +0000
     3.3 @@ -247,10 +247,19 @@ void context_switch(struct exec_domain *
     3.4  //printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
     3.5  //printk("@@@@@@ context switch from domain %d (%x) to domain %d (%x)\n",
     3.6  //prev->domain->id,(long)prev&0xffffff,next->domain->id,(long)next&0xffffff);
     3.7 -//printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
     3.8  //if (prev->domain->id == 1 && next->domain->id == 0) cs10foo();
     3.9  //if (prev->domain->id == 0 && next->domain->id == 1) cs01foo();
    3.10 +//printk("@@sw %d->%d\n",prev->domain->id,next->domain->id);
    3.11  	switch_to(prev,next,prev);
    3.12 +// leave this debug for now: it acts as a heartbeat when more than
    3.13 +// one domain is active
    3.14 +{
    3.15 +static long cnt[16] = { 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50};
    3.16 +static int i = 100;
    3.17 +int id = ((struct exec_domain *)current)->domain->id & 0xf;
    3.18 +if (!cnt[id]--) { printk("%x",id); cnt[id] = 50; }
    3.19 +if (!i--) { printk("+",id); cnt[id] = 100; }
    3.20 +}
    3.21  	clear_bit(EDF_RUNNING, &prev->ed_flags);
    3.22  	//if (!is_idle_task(next->domain) )
    3.23  		//send_guest_virq(next, VIRQ_TIMER);
     4.1 --- a/xen/arch/ia64/xensetup.c	Thu Mar 24 22:16:25 2005 +0000
     4.2 +++ b/xen/arch/ia64/xensetup.c	Sat Mar 26 04:24:24 2005 +0000
     4.3 @@ -297,7 +297,7 @@ printk("About to call construct_dom0()\n
     4.4      dom0_memory_end = ia64_boot_param->initrd_size;
     4.5      for (i = 0; i < CLONE_DOMAIN0; i++) {
     4.6  printk("CONSTRUCTING DOMAIN0 CLONE #%d\n",i+1);
     4.7 -        if ( construct_domN(clones[i], dom0_memory_start, dom0_memory_end,
     4.8 +        if ( construct_domU(clones[i], dom0_memory_start, dom0_memory_end,
     4.9                          0, 
    4.10                          0,
    4.11  			0) != 0)