ia64/xen-unstable

changeset 4137:c77189c38646

bitkeeper revision 1.1236.31.1 (4235d7e6zfwsw0_e5xhU8KHoDsP69Q)

config.h, xenmisc.c, xenasm.S, process.c, domain.c:
cleanup
author djm@djmnc4000.(none)
date Mon Mar 14 18:28:54 2005 +0000 (2005-03-14)
parents 557e8cf002c3
children 0c846e77cca4
files BitKeeper/etc/logging_ok xen/arch/ia64/domain.c xen/arch/ia64/process.c xen/arch/ia64/xenasm.S xen/arch/ia64/xenmisc.c xen/include/asm-ia64/config.h
line diff
     1.1 --- a/BitKeeper/etc/logging_ok	Wed Mar 09 20:35:53 2005 +0000
     1.2 +++ b/BitKeeper/etc/logging_ok	Mon Mar 14 18:28:54 2005 +0000
     1.3 @@ -20,6 +20,7 @@ cl349@freefall.cl.cam.ac.uk
     1.4  cl349@labyrinth.cl.cam.ac.uk
     1.5  cwc22@centipede.cl.cam.ac.uk
     1.6  cwc22@donkeykong.cl.cam.ac.uk
     1.7 +djm@djmnc4000.(none)
     1.8  djm@kirby.fc.hp.com
     1.9  gm281@boulderdash.cl.cam.ac.uk
    1.10  gm281@tetrapod.cl.cam.ac.uk
     2.1 --- a/xen/arch/ia64/domain.c	Wed Mar 09 20:35:53 2005 +0000
     2.2 +++ b/xen/arch/ia64/domain.c	Mon Mar 14 18:28:54 2005 +0000
     2.3 @@ -670,6 +670,7 @@ void dummy(void)
     2.4  }
     2.5  
     2.6  
     2.7 +#if 0
     2.8  void switch_to(struct exec_domain *prev, struct exec_domain *next)
     2.9  {
    2.10   	struct exec_domain *last;
    2.11 @@ -677,6 +678,7 @@ void switch_to(struct exec_domain *prev,
    2.12  	__switch_to(prev,next,last);
    2.13  	//set_current(next);
    2.14  }
    2.15 +#endif
    2.16  
    2.17  void domain_pend_keyboard_interrupt(int irq)
    2.18  {
     3.1 --- a/xen/arch/ia64/process.c	Wed Mar 09 20:35:53 2005 +0000
     3.2 +++ b/xen/arch/ia64/process.c	Mon Mar 14 18:28:54 2005 +0000
     3.3 @@ -143,15 +143,13 @@ void reflect_interruption(unsigned long 
     3.4  	}
     3.5  	if (!PSCB(ed,interrupt_collection_enabled)) {
     3.6  		if (!(PSCB(ed,ipsr) & IA64_PSR_DT)) {
     3.7 -			printf("psr.dt off, trying to deliver nested dtlb!\n");
     3.8 -			while(1);
     3.9 +			panic_domain(regs,"psr.dt off, trying to deliver nested dtlb!\n");
    3.10  		}
    3.11  		vector &= ~0xf;
    3.12  		if (vector != IA64_DATA_TLB_VECTOR &&
    3.13  		    vector != IA64_DATA_TLB_VECTOR) {
    3.14 -printf("psr.ic off, delivering fault=%lx,iip=%p,isr=%p,PSCB.iip=%p\n",
    3.15 +panic_domain(regs,"psr.ic off, delivering fault=%lx,iip=%p,isr=%p,PSCB.iip=%p\n",
    3.16  	vector,regs->cr_iip,isr,PSCB(ed,iip));
    3.17 -			while(1);
    3.18  			
    3.19  		}
    3.20  //printf("Delivering NESTED DATA TLB fault\n");
    3.21 @@ -243,9 +241,6 @@ void xen_handle_domain_access(unsigned l
    3.22  	unsigned long lookup_domain_mpa(struct domain *,unsigned long);
    3.23  	unsigned long match_dtlb(struct exec_domain *,unsigned long, unsigned long *, unsigned long *);
    3.24  	IA64FAULT fault;
    3.25 -#ifndef USER_ACCESS
    3.26 -	extern void __get_domain_bundle(void);
    3.27 -#endif
    3.28  
    3.29  // NEED TO HANDLE THREE CASES:
    3.30  // 1) domain is in metaphysical mode
    3.31 @@ -268,13 +263,6 @@ void xen_handle_domain_access(unsigned l
    3.32  		vcpu_itc_no_srlz(ed,2,address,pteval,-1UL,PAGE_SHIFT);
    3.33  		return;
    3.34  	}
    3.35 -#ifndef USER_ACCESS
    3.36 -	if (*(unsigned long *)__get_domain_bundle != iip) {
    3.37 -		printf("Bad user space access @%p ",address);
    3.38 -		printf("iip=%p, ipsr=%p, b0=%p\n",iip,psr,regs->b0);
    3.39 -		while(1);
    3.40 -	}
    3.41 -#endif
    3.42  if (address < 0x4000) printf("WARNING: page_fault @%p, iip=%p\n",address,iip);
    3.43  		
    3.44  	// if we are fortunate enough to have it in the 1-entry TLB...
    3.45 @@ -285,13 +273,6 @@ if (address < 0x4000) printf("WARNING: p
    3.46  	// look in the TRs
    3.47  	fault = vcpu_tpa(ed,address,&mpaddr);
    3.48  	if (fault != IA64_NO_FAULT) {
    3.49 -#ifndef USER_ACCESS
    3.50 -		// this is hardcoded to handle __get_domain_bundle only
    3.51 -		regs->r8 = 0; regs->r9 = 0;
    3.52 -		regs->cr_iip += 0x20;
    3.53 -		//regs->cr_iip |= (2UL << IA64_PSR_RI_BIT);
    3.54 -		return;
    3.55 -#else /* USER_ACCESS */
    3.56  		static int uacnt = 0;
    3.57  		// can't translate it, just fail (poor man's exception)
    3.58  		// which results in retrying execution
    3.59 @@ -303,12 +284,10 @@ if (address < 0x4000) printf("WARNING: p
    3.60  		else {
    3.61  			// should never happen.  If it does, region 0 addr may
    3.62  			// indicate a bad xen pointer
    3.63 -			printk("*** xen_handle_domain_access: exception table"
    3.64 +			panic_domain(regs,"*** xen_handle_domain_access: exception table"
    3.65                                 " lookup failed, iip=%p, addr=%p, spinning...\n",
    3.66  				iip,address);
    3.67 -			while(1);
    3.68  		}
    3.69 -#endif /* USER_ACCESS */
    3.70  	}
    3.71  	if (d == dom0) {
    3.72  		if (mpaddr < dom0_start || mpaddr >= dom0_start + dom0_size) {
    3.73 @@ -375,7 +354,9 @@ void ia64_do_page_fault (unsigned long a
    3.74  	}
    3.75  	vector = is_data ? IA64_DATA_TLB_VECTOR : IA64_INST_TLB_VECTOR;
    3.76  	if (handle_lazy_cover(current, isr, regs)) return;
    3.77 -if (!(address>>61)) { printf("ia64_do_page_fault: @%p???, iip=%p, itc=%p (spinning...)\n",address,iip,ia64_get_itc()); while(1); }
    3.78 +if (!(address>>61)) {
    3.79 +panic_domain(0,"ia64_do_page_fault: @%p???, iip=%p, itc=%p (spinning...)\n",address,iip,ia64_get_itc());
    3.80 +}
    3.81  	if ((isr & IA64_ISR_SP)
    3.82  	    || ((isr & IA64_ISR_NA) && (isr & IA64_ISR_CODE_MASK) == IA64_ISR_CODE_LFETCH))
    3.83  	{
    3.84 @@ -835,8 +816,7 @@ ia64_handle_reflection (unsigned long if
    3.85  	unsigned long itir = vcpu_get_itir_on_fault(ed,ifa);
    3.86  
    3.87  	if (!(psr & IA64_PSR_CPL)) {
    3.88 -		printf("ia64_handle_reflection: reflecting with priv=0!!\n");
    3.89 -		while(1);
    3.90 +		panic_domain(regs,"ia64_handle_reflection: reflecting with priv=0!!\n");
    3.91  	}
    3.92  	// FIXME: no need to pass itir in to this routine as we need to
    3.93  	// compute the virtual itir anyway (based on domain's RR.ps)
     4.1 --- a/xen/arch/ia64/xenasm.S	Wed Mar 09 20:35:53 2005 +0000
     4.2 +++ b/xen/arch/ia64/xenasm.S	Mon Mar 14 18:28:54 2005 +0000
     4.3 @@ -261,24 +261,6 @@ GLOBAL_ENTRY(ia64_prepare_handle_reflect
     4.4  	br.cond.sptk.many rp			// goes to ia64_leave_kernel
     4.5  END(ia64_prepare_handle_reflection)
     4.6  
     4.7 -#ifndef USER_ACCESS
     4.8 -// REMOVE: replaced with get_user
     4.9 -// NOTE: instruction spacing must be explicit for recovery on miss
    4.10 -GLOBAL_ENTRY(__get_domain_bundle)
    4.11 -	ld8 r8=[r32],8
    4.12 -	nop 0
    4.13 -	nop 0
    4.14 -	;;
    4.15 -	ld8 r9=[r32]
    4.16 -	nop 0
    4.17 -	nop 0
    4.18 -	;;
    4.19 -	br.ret.sptk.many rp
    4.20 -	nop 0
    4.21 -	nop 0
    4.22 -	;;
    4.23 -END(__get_domain_bundle)
    4.24 -#else
    4.25  GLOBAL_ENTRY(__get_domain_bundle)
    4.26  	EX(.failure_in_get_bundle,ld8 r8=[r32],8)
    4.27  	;;
    4.28 @@ -294,7 +276,6 @@ GLOBAL_ENTRY(__get_domain_bundle)
    4.29  	br.ret.sptk.many rp
    4.30  	;;
    4.31  END(__get_domain_bundle)
    4.32 -#endif
    4.33  
    4.34  GLOBAL_ENTRY(dorfirfi)
    4.35  #define SI_CR_IIP_OFFSET 0x10
     5.1 --- a/xen/arch/ia64/xenmisc.c	Wed Mar 09 20:35:53 2005 +0000
     5.2 +++ b/xen/arch/ia64/xenmisc.c	Mon Mar 14 18:28:54 2005 +0000
     5.3 @@ -203,7 +203,7 @@ char * __devinit  pcibios_setup(char *st
     5.4  
     5.5  void show_registers(struct pt_regs *regs)
     5.6  {
     5.7 -	dummy();
     5.8 +	printf("*** ADD REGISTER DUMP HERE FOR DEBUGGING\n");
     5.9  }	
    5.10  
    5.11  ///////////////////////////////
    5.12 @@ -240,12 +240,36 @@ void *module_text_address(unsigned long 
    5.13  	return NULL;
    5.14  }
    5.15  
    5.16 +void cs10foo(void) {}
    5.17 +void cs01foo(void) {}
    5.18 +
    5.19  // context_switch
    5.20  void context_switch(struct exec_domain *prev, struct exec_domain *next)
    5.21  {
    5.22 -	switch_to(prev,next);
    5.23 +printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
    5.24 +printk("@@@@@@ context switch from domain %d (%x) to domain %d (%x)\n",
    5.25 +prev->domain->id,(long)prev&0xffffff,next->domain->id,(long)next&0xffffff);
    5.26 +printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
    5.27 +if (prev->domain->id == 1 && next->domain->id == 0) cs10foo();
    5.28 +if (prev->domain->id == 0 && next->domain->id == 1) cs01foo();
    5.29 +	switch_to(prev,next,prev);
    5.30  	clear_bit(EDF_RUNNING, &prev->ed_flags);
    5.31  	//if (!is_idle_task(next->domain) )
    5.32  		//send_guest_virq(next, VIRQ_TIMER);
    5.33 -	schedule_tail(next);
    5.34 +	load_region_regs(current);
    5.35  }
    5.36 +
    5.37 +void panic_domain(struct pt_regs *regs, const char *fmt, ...)
    5.38 +{
    5.39 +	va_list args;
    5.40 +	char buf[128];
    5.41 +	struct exec_domain *ed = current;
    5.42 +	static volatile int test = 1;	// so can continue easily in debug
    5.43 +    
    5.44 +	printf("$$$$$ PANIC in domain %d:",ed->domain->id);
    5.45 +	va_start(args, fmt);
    5.46 +	(void)vsnprintf(buf, sizeof(buf), fmt, args);
    5.47 +	va_end(args);
    5.48 +	if (regs) show_registers(regs);
    5.49 +	while(test);
    5.50 +}
     6.1 --- a/xen/include/asm-ia64/config.h	Wed Mar 09 20:35:53 2005 +0000
     6.2 +++ b/xen/include/asm-ia64/config.h	Mon Mar 14 18:28:54 2005 +0000
     6.3 @@ -1,6 +1,6 @@
     6.4  // control flags for turning on/off features under test
     6.5 -#undef CLONE_DOMAIN0
     6.6 -//#define CLONE_DOMAIN0 1
     6.7 +//#undef CLONE_DOMAIN0
     6.8 +#define CLONE_DOMAIN0 1
     6.9  //#undef CLONE_DOMAIN0
    6.10  #define USER_ACCESS
    6.11