ia64/xen-unstable

changeset 7773:476d02c1346c

Merge with http://xenbits.xensource.com/ext/xen-unstable-docs.hg
author kaf24@firebug.cl.cam.ac.uk
date Thu Nov 10 18:25:27 2005 +0100 (2005-11-10)
parents f1c07363956b 6a593de2f8ba
children 5aa93e3c2a22
files
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S	Thu Nov 10 11:43:24 2005 -0500
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S	Thu Nov 10 18:25:27 2005 +0100
     1.3 @@ -81,7 +81,7 @@ VM_MASK		= 0x00020000
     1.4  #define evtchn_upcall_pending		/* 0 */
     1.5  #define evtchn_upcall_mask		1
     1.6  
     1.7 -#define sizeof_vcpu_shift		3
     1.8 +#define sizeof_vcpu_shift		4
     1.9  
    1.10  #ifdef CONFIG_SMP
    1.11  #define preempt_disable(reg)	incl TI_preempt_count(reg)
    1.12 @@ -813,35 +813,9 @@ ENTRY(alignment_check)
    1.13  	pushl $do_alignment_check
    1.14  	jmp error_code
    1.15  
    1.16 -# This handler is special, because it gets an extra value on its stack,
    1.17 -# which is the linear faulting address.
    1.18 -# fastcall register usage:  %eax = pt_regs, %edx = error code,
    1.19 -#			    %ecx = fault address
    1.20  ENTRY(page_fault)
    1.21 -	pushl %ds
    1.22 -	pushl %eax
    1.23 -	xorl %eax, %eax
    1.24 -	pushl %ebp
    1.25 -	pushl %edi
    1.26 -	pushl %esi
    1.27 -	pushl %edx
    1.28 -	decl %eax			/* eax = -1 */
    1.29 -	pushl %ecx
    1.30 -	pushl %ebx
    1.31 -	cld
    1.32 -	pushl %es
    1.33 -#	UNWIND_ESPFIX_STACK
    1.34 -	popl %edi
    1.35 -	movl ES(%esp), %ecx		/* get the faulting address */
    1.36 -	movl ORIG_EAX(%esp), %edx	/* get the error code */
    1.37 -	movl %eax, ORIG_EAX(%esp)
    1.38 -	movl %edi, ES(%esp)
    1.39 -	movl $(__KERNEL_DS),%eax
    1.40 -	movl %eax, %ds
    1.41 -	movl %eax, %es
    1.42 -	movl %esp,%eax			/* pt_regs pointer */
    1.43 -	call do_page_fault
    1.44 -	jmp ret_from_exception
    1.45 +	pushl $do_page_fault
    1.46 +	jmp error_code
    1.47  
    1.48  #ifdef CONFIG_X86_MCE
    1.49  ENTRY(machine_check)
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c	Thu Nov 10 11:43:24 2005 -0500
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c	Thu Nov 10 18:25:27 2005 +0100
     2.3 @@ -650,7 +650,7 @@ fastcall void do_int3(struct pt_regs *re
     2.4  
     2.5  static inline void conditional_sti(struct pt_regs *regs)
     2.6  {
     2.7 -	if ((uint8_t)(regs->xcs >> 16) == 0)
     2.8 +	if (regs->eflags & (X86_EFLAGS_IF|VM_MASK))
     2.9  		local_irq_enable();
    2.10  }
    2.11  
    2.12 @@ -972,7 +972,7 @@ void __init trap_init_f00f_bug(void)
    2.13  
    2.14  
    2.15  /*
    2.16 - * NB. All these are "trap gates" (i.e. events_mask isn't cleared) except
    2.17 + * NB. All these are "trap gates" (i.e. events_mask isn't set) except
    2.18   * for those that specify <dpl>|4 in the second field.
    2.19   */
    2.20  static trap_info_t trap_table[] = {
    2.21 @@ -988,7 +988,7 @@ static trap_info_t trap_table[] = {
    2.22  	{ 11, 0, __KERNEL_CS, (unsigned long)segment_not_present	},
    2.23  	{ 12, 0, __KERNEL_CS, (unsigned long)stack_segment		},
    2.24  	{ 13, 0, __KERNEL_CS, (unsigned long)general_protection		},
    2.25 -	{ 14, 0, __KERNEL_CS, (unsigned long)page_fault			},
    2.26 +	{ 14, 0|4, __KERNEL_CS, (unsigned long)page_fault		},
    2.27  	{ 15, 0, __KERNEL_CS, (unsigned long)fixup_4gb_segment		},
    2.28  	{ 16, 0, __KERNEL_CS, (unsigned long)coprocessor_error		},
    2.29  	{ 17, 0, __KERNEL_CS, (unsigned long)alignment_check		},
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c	Thu Nov 10 11:43:24 2005 -0500
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c	Thu Nov 10 18:25:27 2005 +0100
     3.3 @@ -279,15 +279,18 @@ static void dump_fault_path(unsigned lon
     3.4   *	bit 1 == 0 means read, 1 means write
     3.5   *	bit 2 == 0 means kernel, 1 means user-mode
     3.6   */
     3.7 -fastcall void do_page_fault(struct pt_regs *regs, unsigned long error_code,
     3.8 -			      unsigned long address)
     3.9 +fastcall void do_page_fault(struct pt_regs *regs, unsigned long error_code)
    3.10  {
    3.11  	struct task_struct *tsk;
    3.12  	struct mm_struct *mm;
    3.13  	struct vm_area_struct * vma;
    3.14 +	unsigned long address;
    3.15  	int write;
    3.16  	siginfo_t info;
    3.17  
    3.18 +	address = HYPERVISOR_shared_info->vcpu_data[
    3.19 +		smp_processor_id()].arch.cr2;
    3.20 +
    3.21  	/* Set the "privileged fault" bit to something sane. */
    3.22  	error_code &= ~4;
    3.23  	error_code |= (regs->xcs & 2) << 1;
    3.24 @@ -297,11 +300,9 @@ fastcall void do_page_fault(struct pt_re
    3.25  	if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
    3.26  					SIGSEGV) == NOTIFY_STOP)
    3.27  		return;
    3.28 -#if 0
    3.29  	/* It's safe to allow irq's after cr2 has been saved */
    3.30  	if (regs->eflags & (X86_EFLAGS_IF|VM_MASK))
    3.31  		local_irq_enable();
    3.32 -#endif
    3.33  
    3.34  	tsk = current;
    3.35  
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c	Thu Nov 10 11:43:24 2005 -0500
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c	Thu Nov 10 18:25:27 2005 +0100
     4.3 @@ -342,8 +342,8 @@ int xen_create_contiguous_region(
     4.4  		mfn = pte_mfn(*pte);
     4.5  		BUG_ON(HYPERVISOR_update_va_mapping(
     4.6  			vstart + (i*PAGE_SIZE), __pte_ma(0), 0));
     4.7 -		phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] =
     4.8 -			INVALID_P2M_ENTRY;
     4.9 +		set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i,
    4.10 +			INVALID_P2M_ENTRY);
    4.11  		BUG_ON(HYPERVISOR_memory_op(
    4.12  			XENMEM_decrease_reservation, &reservation) != 1);
    4.13  	}
    4.14 @@ -361,7 +361,7 @@ int xen_create_contiguous_region(
    4.15  			vstart + (i*PAGE_SIZE),
    4.16  			pfn_pte_ma(mfn+i, PAGE_KERNEL), 0));
    4.17  		xen_machphys_update(mfn+i, (__pa(vstart)>>PAGE_SHIFT)+i);
    4.18 -		phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] = mfn+i;
    4.19 +		set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i, mfn+i);
    4.20  	}
    4.21  
    4.22  	flush_tlb_all();
    4.23 @@ -383,7 +383,7 @@ int xen_create_contiguous_region(
    4.24  			vstart + (i*PAGE_SIZE),
    4.25  			pfn_pte_ma(mfn, PAGE_KERNEL), 0));
    4.26  		xen_machphys_update(mfn, (__pa(vstart)>>PAGE_SHIFT)+i);
    4.27 -		phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] = mfn;
    4.28 +		set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i, mfn);
    4.29  	}
    4.30  
    4.31  	flush_tlb_all();
    4.32 @@ -422,8 +422,8 @@ void xen_destroy_contiguous_region(unsig
    4.33  		mfn = pte_mfn(*pte);
    4.34  		BUG_ON(HYPERVISOR_update_va_mapping(
    4.35  			vstart + (i*PAGE_SIZE), __pte_ma(0), 0));
    4.36 -		phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] =
    4.37 -			INVALID_P2M_ENTRY;
    4.38 +		set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i,
    4.39 +			INVALID_P2M_ENTRY);
    4.40  		BUG_ON(HYPERVISOR_memory_op(
    4.41  			XENMEM_decrease_reservation, &reservation) != 1);
    4.42  	}
    4.43 @@ -436,7 +436,7 @@ void xen_destroy_contiguous_region(unsig
    4.44  			vstart + (i*PAGE_SIZE),
    4.45  			pfn_pte_ma(mfn, PAGE_KERNEL), 0));
    4.46  		xen_machphys_update(mfn, (__pa(vstart)>>PAGE_SHIFT)+i);
    4.47 -		phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] = mfn;
    4.48 +		set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i, mfn);
    4.49  	}
    4.50  
    4.51  	flush_tlb_all();
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S	Thu Nov 10 11:43:24 2005 -0500
     5.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S	Thu Nov 10 18:25:27 2005 +0100
     5.3 @@ -874,42 +874,8 @@ 1:      RESTORE_ARGS
     5.4  	ret
     5.5  	CFI_ENDPROC
     5.6  
     5.7 -
     5.8 - /*
     5.9 - * Copy error_entry because of the different stack frame
    5.10 - */                        
    5.11  ENTRY(page_fault)
    5.12 -        movq (%rsp),%rcx
    5.13 -        movq 8(%rsp),%r11
    5.14 -        addq $0x10,%rsp         # now %rsp points to %cr2
    5.15 -        pushq %rax
    5.16 -        leaq do_page_fault(%rip),%rax
    5.17 -	cld	
    5.18 -	subq  $13*8,%rsp
    5.19 -	movq %rdx,12*8(%rsp)    # save %rdx
    5.20 -	movq 13*8(%rsp),%rdx	# load rax
    5.21 -	movq %rcx,11*8(%rsp)
    5.22 -	movq %rdx,10*8(%rsp)	# store rax
    5.23 -        movq %rsi,13*8(%rsp)    # now save %rsi
    5.24 -        movq 14*8(%rsp),%rdx    # load %cr2, 3rd argument
    5.25 -	movq %r8, 9*8(%rsp)
    5.26 -	movq %r9, 8*8(%rsp)
    5.27 -	movq %r10,7*8(%rsp)
    5.28 -	movq %r11,6*8(%rsp)
    5.29 -	movq %rbx,5*8(%rsp) 
    5.30 -	movq %rbp,4*8(%rsp) 
    5.31 -	movq %r12,3*8(%rsp) 
    5.32 -	movq %r13,2*8(%rsp) 
    5.33 -	movq %r14,1*8(%rsp) 
    5.34 -	movq %r15,(%rsp)
    5.35 -#if 0        
    5.36 -	cmpl $__KERNEL_CS,CS(%rsp)
    5.37 -	je  error_kernelspace
    5.38 -#endif
    5.39 -        /*
    5.40 -         * 1st and 2nd arguments are set by error_call_handler
    5.41 -         */
    5.42 -        jmp error_call_handler
    5.43 +	errorentry do_page_fault
    5.44  
    5.45  ENTRY(coprocessor_error)
    5.46  	zeroentry do_coprocessor_error
    5.47 @@ -948,24 +914,15 @@ ENTRY(nmi)
    5.48  paranoid_exit:
    5.49  	testl %ebx,%ebx				/* swapgs needed? */
    5.50  	jnz paranoid_restore
    5.51 +	testl $3,CS(%rsp)
    5.52 +	jnz   paranoid_userspace
    5.53  paranoid_swapgs:	
    5.54 -/*	swapgs */
    5.55 +	swapgs
    5.56  paranoid_restore:	
    5.57  	RESTORE_ALL 8
    5.58 -/*	iretq */
    5.59 +	iretq
    5.60  paranoid_userspace:	
    5.61  	GET_THREAD_INFO(%rcx)
    5.62 -#	movl threadinfo_flags(%rcx),%edx
    5.63 -#	testl $_TIF_NEED_RESCHED,%edx
    5.64 -#	jnz paranoid_resched
    5.65 -#	testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx
    5.66 -#	jnz paranoid_signal
    5.67 -#	jmp paranoid_swapgs
    5.68 -#paranoid_resched:		
    5.69 -#/*	sti */
    5.70 -#	call schedule
    5.71 -#	jmp paranoid_exit
    5.72 -#paranoid_signal:		
    5.73  	movl threadinfo_flags(%rcx),%ebx
    5.74  	andl $_TIF_WORK_MASK,%ebx
    5.75  	jz paranoid_swapgs
    5.76 @@ -975,13 +932,10 @@ paranoid_userspace:
    5.77  	testl $_TIF_NEED_RESCHED,%ebx
    5.78  	jnz paranoid_schedule
    5.79  	movl %ebx,%edx			/* arg3: thread flags */
    5.80 -/*	sti */
    5.81 -#	xorl %esi,%esi /* oldset */
    5.82 -#	movq %rsp,%rdi /* &pt_regs */
    5.83 +	sti
    5.84  	xorl %esi,%esi 			/* arg2: oldset */
    5.85  	movq %rsp,%rdi 			/* arg1: &pt_regs */
    5.86  	call do_notify_resume
    5.87 -#	jmp paranoid_exit
    5.88  	cli
    5.89  	jmp paranoid_userspace
    5.90  paranoid_schedule:
    5.91 @@ -1057,4 +1011,3 @@ ENTRY(machine_check)
    5.92  ENTRY(call_debug)
    5.93         zeroentry do_call_debug
    5.94  
    5.95 -
     6.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/traps.c	Thu Nov 10 11:43:24 2005 -0500
     6.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/traps.c	Thu Nov 10 18:25:27 2005 +0100
     6.3 @@ -905,30 +905,33 @@ void do_call_debug(struct pt_regs *regs)
     6.4  }
     6.5  
     6.6  
     6.7 +/*
     6.8 + * NB. All these are "interrupt gates" (i.e. events_mask is set) because we
     6.9 + * specify <dpl>|4 in the second field.
    6.10 + */
    6.11  static trap_info_t trap_table[] = {
    6.12 -        {  0, 0, (__KERNEL_CS|0x3), (unsigned long)divide_error               },
    6.13 -        {  1, 0, (__KERNEL_CS|0x3), (unsigned long)debug                      },
    6.14 -        {  3, 3, (__KERNEL_CS|0x3), (unsigned long)int3                       },
    6.15 -        {  4, 3, (__KERNEL_CS|0x3), (unsigned long)overflow                   },
    6.16 -        {  5, 3, (__KERNEL_CS|0x3), (unsigned long)bounds                     },
    6.17 -        {  6, 0, (__KERNEL_CS|0x3), (unsigned long)invalid_op                 },
    6.18 -        {  7, 0, (__KERNEL_CS|0x3), (unsigned long)device_not_available       },
    6.19 -        {  9, 0, (__KERNEL_CS|0x3), (unsigned long)coprocessor_segment_overrun},
    6.20 -        { 10, 0, (__KERNEL_CS|0x3), (unsigned long)invalid_TSS                },
    6.21 -        { 11, 0, (__KERNEL_CS|0x3), (unsigned long)segment_not_present        },
    6.22 -        { 12, 0, (__KERNEL_CS|0x3), (unsigned long)stack_segment              },
    6.23 -        { 13, 0, (__KERNEL_CS|0x3), (unsigned long)general_protection         },
    6.24 -        { 14, 0, (__KERNEL_CS|0x3), (unsigned long)page_fault                 },
    6.25 -        { 15, 0, (__KERNEL_CS|0x3), (unsigned long)spurious_interrupt_bug     },
    6.26 -        { 16, 0, (__KERNEL_CS|0x3), (unsigned long)coprocessor_error          },
    6.27 -        { 17, 0, (__KERNEL_CS|0x3), (unsigned long)alignment_check            },
    6.28 +        {  0, 0|4, (__KERNEL_CS|0x3), (unsigned long)divide_error               },
    6.29 +        {  1, 0|4, (__KERNEL_CS|0x3), (unsigned long)debug                      },
    6.30 +        {  3, 3|4, (__KERNEL_CS|0x3), (unsigned long)int3                       },
    6.31 +        {  4, 3|4, (__KERNEL_CS|0x3), (unsigned long)overflow                   },
    6.32 +        {  5, 3|4, (__KERNEL_CS|0x3), (unsigned long)bounds                     },
    6.33 +        {  6, 0|4, (__KERNEL_CS|0x3), (unsigned long)invalid_op                 },
    6.34 +        {  7, 0|4, (__KERNEL_CS|0x3), (unsigned long)device_not_available       },
    6.35 +        {  9, 0|4, (__KERNEL_CS|0x3), (unsigned long)coprocessor_segment_overrun},
    6.36 +        { 10, 0|4, (__KERNEL_CS|0x3), (unsigned long)invalid_TSS                },
    6.37 +        { 11, 0|4, (__KERNEL_CS|0x3), (unsigned long)segment_not_present        },
    6.38 +        { 12, 0|4, (__KERNEL_CS|0x3), (unsigned long)stack_segment              },
    6.39 +        { 13, 0|4, (__KERNEL_CS|0x3), (unsigned long)general_protection         },
    6.40 +        { 14, 0|4, (__KERNEL_CS|0x3), (unsigned long)page_fault                 },
    6.41 +        { 15, 0|4, (__KERNEL_CS|0x3), (unsigned long)spurious_interrupt_bug     },
    6.42 +        { 16, 0|4, (__KERNEL_CS|0x3), (unsigned long)coprocessor_error          },
    6.43 +        { 17, 0|4, (__KERNEL_CS|0x3), (unsigned long)alignment_check            },
    6.44  #ifdef CONFIG_X86_MCE
    6.45 -        { 18, 0, (__KERNEL_CS|0x3), (unsigned long)machine_check              },
    6.46 +        { 18, 0|4, (__KERNEL_CS|0x3), (unsigned long)machine_check              },
    6.47  #endif
    6.48 -        { 19, 0, (__KERNEL_CS|0x3), (unsigned long)simd_coprocessor_error     },
    6.49 -        { SYSCALL_VECTOR, 3, (__KERNEL_CS|0x3), (unsigned long)system_call   },
    6.50 +        { 19, 0|4, (__KERNEL_CS|0x3), (unsigned long)simd_coprocessor_error     },
    6.51  #ifdef CONFIG_IA32_EMULATION
    6.52 -	{ IA32_SYSCALL_VECTOR, 3, (__KERNEL_CS|0x3), (unsigned long)ia32_syscall},
    6.53 +	{ IA32_SYSCALL_VECTOR, 3|4, (__KERNEL_CS|0x3), (unsigned long)ia32_syscall},
    6.54  #endif
    6.55          {  0, 0,           0, 0                                              }
    6.56  };
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/x8664_ksyms.c	Thu Nov 10 11:43:24 2005 -0500
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/x8664_ksyms.c	Thu Nov 10 18:25:27 2005 +0100
     7.3 @@ -128,8 +128,10 @@ EXPORT_SYMBOL(get_wchan);
     7.4  
     7.5  EXPORT_SYMBOL(rtc_lock);
     7.6  
     7.7 -/* EXPORT_SYMBOL_GPL(set_nmi_callback);
     7.8 -   EXPORT_SYMBOL_GPL(unset_nmi_callback); */
     7.9 +#ifdef CONFIG_X86_LOCAL_APIC
    7.10 +EXPORT_SYMBOL_GPL(set_nmi_callback);
    7.11 +EXPORT_SYMBOL_GPL(unset_nmi_callback);
    7.12 +#endif
    7.13  
    7.14  /* Export string functions. We normally rely on gcc builtin for most of these,
    7.15     but gcc sometimes decides not to inline them. */    
     8.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/xen_entry.S	Thu Nov 10 11:43:24 2005 -0500
     8.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/xen_entry.S	Thu Nov 10 18:25:27 2005 +0100
     8.3 @@ -5,7 +5,7 @@
     8.4  #define evtchn_upcall_pending		0
     8.5  #define evtchn_upcall_mask		1
     8.6  
     8.7 -#define sizeof_vcpu_shift		4
     8.8 +#define sizeof_vcpu_shift		5
     8.9  
    8.10  #ifdef CONFIG_SMP
    8.11  //#define preempt_disable(reg)	incl threadinfo_preempt_count(reg)
     9.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c	Thu Nov 10 11:43:24 2005 -0500
     9.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c	Thu Nov 10 18:25:27 2005 +0100
     9.3 @@ -318,12 +318,12 @@ int exception_trace = 1;
     9.4   *	bit 2 == 0 means kernel, 1 means user-mode
     9.5   *      bit 3 == 1 means fault was an instruction fetch
     9.6   */
     9.7 -asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code,
     9.8 -       unsigned long address)
     9.9 +asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code)
    9.10  {
    9.11  	struct task_struct *tsk;
    9.12  	struct mm_struct *mm;
    9.13  	struct vm_area_struct * vma;
    9.14 +	unsigned long address;
    9.15  	const struct exception_table_entry *fixup;
    9.16  	int write;
    9.17  	siginfo_t info;
    9.18 @@ -342,6 +342,11 @@ asmlinkage void do_page_fault(struct pt_
    9.19  		}
    9.20  	}
    9.21  #endif
    9.22 +
    9.23 +	/* get the address */
    9.24 +	address = HYPERVISOR_shared_info->vcpu_data[
    9.25 +		smp_processor_id()].arch.cr2;
    9.26 +
    9.27  	if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
    9.28  					SIGSEGV) == NOTIFY_STOP)
    9.29  		return;
    10.1 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Thu Nov 10 11:43:24 2005 -0500
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Thu Nov 10 18:25:27 2005 +0100
    10.3 @@ -210,7 +210,7 @@ static int increase_reservation(unsigned
    10.4  		BUG_ON(phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY);
    10.5  
    10.6  		/* Update P->M and M->P tables. */
    10.7 -		phys_to_machine_mapping[pfn] = mfn_list[i];
    10.8 +		set_phys_to_machine(pfn, mfn_list[i]);
    10.9  		xen_machphys_update(mfn_list[i], pfn);
   10.10              
   10.11  		/* Link back into the page tables if not highmem. */
   10.12 @@ -295,7 +295,7 @@ static int decrease_reservation(unsigned
   10.13  	/* No more mappings: invalidate P2M and add to balloon. */
   10.14  	for (i = 0; i < nr_pages; i++) {
   10.15  		pfn = mfn_to_pfn(mfn_list[i]);
   10.16 -		phys_to_machine_mapping[pfn] = INVALID_P2M_ENTRY;
   10.17 +		set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
   10.18  		balloon_append(pfn_to_page(pfn));
   10.19  	}
   10.20  
   10.21 @@ -515,8 +515,7 @@ static int dealloc_pte_fn(
   10.22  		.domid        = DOMID_SELF
   10.23  	};
   10.24  	set_pte_at(&init_mm, addr, pte, __pte_ma(0));
   10.25 -	phys_to_machine_mapping[__pa(addr) >> PAGE_SHIFT] =
   10.26 -		INVALID_P2M_ENTRY;
   10.27 +	set_phys_to_machine(__pa(addr) >> PAGE_SHIFT, INVALID_P2M_ENTRY);
   10.28  	ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation);
   10.29  	BUG_ON(ret != 1);
   10.30  	return 0;
    11.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Thu Nov 10 11:43:24 2005 -0500
    11.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Thu Nov 10 18:25:27 2005 +0100
    11.3 @@ -386,9 +386,9 @@ static void dispatch_rw_block_io(blkif_t
    11.4  #ifdef __ia64__
    11.5  			MMAP_VADDR(pending_idx,i) = gnttab_map_vaddr(map[i]);
    11.6  #else
    11.7 -			phys_to_machine_mapping[__pa(MMAP_VADDR(
    11.8 -				pending_idx, i)) >> PAGE_SHIFT] =
    11.9 -				FOREIGN_FRAME(map[i].dev_bus_addr>>PAGE_SHIFT);
   11.10 +			set_phys_to_machine(__pa(MMAP_VADDR(
   11.11 +				pending_idx, i)) >> PAGE_SHIFT,
   11.12 +				FOREIGN_FRAME(map[i].dev_bus_addr>>PAGE_SHIFT));
   11.13  #endif
   11.14  			fas        = req->frame_and_sects[i];
   11.15  			seg[i].buf = map[i].dev_bus_addr | 
    12.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c	Thu Nov 10 11:43:24 2005 -0500
    12.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c	Thu Nov 10 18:25:27 2005 +0100
    12.3 @@ -777,8 +777,8 @@ static void dispatch_rw_block_io(blkif_t
    12.4  		/* Set the necessary mappings in p2m and in the VM_FOREIGN 
    12.5  		 * vm_area_struct to allow user vaddr -> struct page lookups
    12.6  		 * to work.  This is needed for direct IO to foreign pages. */
    12.7 -		phys_to_machine_mapping[__pa(kvaddr) >> PAGE_SHIFT] =
    12.8 -			FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT);
    12.9 +		set_phys_to_machine(__pa(kvaddr) >> PAGE_SHIFT,
   12.10 +				FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT));
   12.11  
   12.12  		offset = (uvaddr - blktap_vma->vm_start) >> PAGE_SHIFT;
   12.13  		((struct page **)blktap_vma->vm_private_data)[offset] =
    13.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Nov 10 11:43:24 2005 -0500
    13.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Nov 10 18:25:27 2005 +0100
    13.3 @@ -248,8 +248,7 @@ static void net_rx_action(unsigned long 
    13.4  		 * Set the new P2M table entry before reassigning the old data
    13.5  		 * page. Heed the comment in pgtable-2level.h:pte_page(). :-)
    13.6  		 */
    13.7 -		phys_to_machine_mapping[__pa(skb->data) >> PAGE_SHIFT] =
    13.8 -			new_mfn;
    13.9 +		set_phys_to_machine(__pa(skb->data) >> PAGE_SHIFT, new_mfn);
   13.10  
   13.11  		MULTI_update_va_mapping(mcl, vdata,
   13.12  					pfn_pte_ma(new_mfn, PAGE_KERNEL), 0);
   13.13 @@ -631,9 +630,9 @@ static void net_tx_action(unsigned long 
   13.14  				pending_idx;
   13.15  			continue;
   13.16  		}
   13.17 -		phys_to_machine_mapping[
   13.18 -			__pa(MMAP_VADDR(pending_idx)) >> PAGE_SHIFT] =
   13.19 -			FOREIGN_FRAME(mop->dev_bus_addr >> PAGE_SHIFT);
   13.20 +		set_phys_to_machine(
   13.21 +			__pa(MMAP_VADDR(pending_idx)) >> PAGE_SHIFT,
   13.22 +			FOREIGN_FRAME(mop->dev_bus_addr >> PAGE_SHIFT));
   13.23  		grant_tx_ref[pending_idx] = mop->handle;
   13.24  
   13.25  		data_len = (txreq.size > PKT_PROT_LEN) ?
    14.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Thu Nov 10 11:43:24 2005 -0500
    14.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Thu Nov 10 18:25:27 2005 +0100
    14.3 @@ -342,8 +342,7 @@ static void network_alloc_rx_buffers(str
    14.4  		rx_pfn_array[i] = virt_to_mfn(skb->head);
    14.5  
    14.6  		/* Remove this page from map before passing back to Xen. */
    14.7 -		phys_to_machine_mapping[__pa(skb->head) >> PAGE_SHIFT] 
    14.8 -			= INVALID_P2M_ENTRY;
    14.9 +		set_phys_to_machine(__pa(skb->head) >> PAGE_SHIFT, INVALID_P2M_ENTRY);
   14.10  
   14.11  		MULTI_update_va_mapping(rx_mcl+i, (unsigned long)skb->head,
   14.12  					__pte(0), 0);
   14.13 @@ -570,7 +569,7 @@ static int netif_poll(struct net_device 
   14.14  					pfn_pte_ma(mfn, PAGE_KERNEL), 0);
   14.15  		mcl++;
   14.16  
   14.17 -		phys_to_machine_mapping[__pa(skb->head) >> PAGE_SHIFT] = mfn;
   14.18 +		set_phys_to_machine(__pa(skb->head) >> PAGE_SHIFT, mfn);
   14.19  
   14.20  		__skb_queue_tail(&rxq, skb);
   14.21  	}
    15.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c	Thu Nov 10 11:43:24 2005 -0500
    15.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c	Thu Nov 10 18:25:27 2005 +0100
    15.3 @@ -296,9 +296,8 @@ static int
    15.4  			DPRINTK(" Grant table operation failure !\n");
    15.5  			return 0;
    15.6  		}
    15.7 -		phys_to_machine_mapping[__pa(MMAP_VADDR(tpmif,i)) >>
    15.8 -					PAGE_SHIFT] =
    15.9 -			FOREIGN_FRAME(map_op.dev_bus_addr >> PAGE_SHIFT);
   15.10 +		set_phys_to_machine(__pa(MMAP_VADDR(tpmif,i)) >> PAGE_SHIFT,
   15.11 +			FOREIGN_FRAME(map_op.dev_bus_addr >> PAGE_SHIFT));
   15.12  
   15.13  		tocopy = MIN(size - offset, PAGE_SIZE);
   15.14  
    16.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h	Thu Nov 10 11:43:24 2005 -0500
    16.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h	Thu Nov 10 18:25:27 2005 +0100
    16.3 @@ -86,6 +86,11 @@ static inline unsigned long mfn_to_pfn(u
    16.4  	return pfn;
    16.5  }
    16.6  
    16.7 +static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
    16.8 +{
    16.9 +	phys_to_machine_mapping[pfn] = mfn;
   16.10 +}
   16.11 +
   16.12  /* Definitions for machine and pseudophysical addresses. */
   16.13  #ifdef CONFIG_X86_PAE
   16.14  typedef unsigned long long paddr_t;
    17.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/page.h	Thu Nov 10 11:43:24 2005 -0500
    17.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/page.h	Thu Nov 10 18:25:27 2005 +0100
    17.3 @@ -88,6 +88,11 @@ static inline unsigned long mfn_to_pfn(u
    17.4  	return pfn;
    17.5  }
    17.6  
    17.7 +static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
    17.8 +{
    17.9 +	phys_to_machine_mapping[pfn] = mfn;
   17.10 +}
   17.11 +
   17.12  /* Definitions for machine and pseudophysical addresses. */
   17.13  typedef unsigned long paddr_t;
   17.14  typedef unsigned long maddr_t;
    18.1 --- a/tools/examples/network-bridge	Thu Nov 10 11:43:24 2005 -0500
    18.2 +++ b/tools/examples/network-bridge	Thu Nov 10 18:25:27 2005 +0100
    18.3 @@ -16,7 +16,7 @@
    18.4  #
    18.5  # Usage:
    18.6  #
    18.7 -# network (start|stop|status) {VAR=VAL}*
    18.8 +# network-bridge (start|stop|status) {VAR=VAL}*
    18.9  #
   18.10  # Vars:
   18.11  #
   18.12 @@ -27,18 +27,27 @@
   18.13  # netdev     The interface to add to the bridge (default eth${vifnum}).
   18.14  # antispoof  Whether to use iptables to prevent spoofing (default no).
   18.15  #
   18.16 +# Internal Vars:
   18.17 +# pdev="p${netdev}"
   18.18 +# vdev="veth${vifnum}"
   18.19 +# vif0="vif0.${vifnum}"
   18.20 +#
   18.21  # start:
   18.22 -# Creates the bridge and enslaves netdev to it.
   18.23 -# Copies the IP addresses from netdev to the bridge.
   18.24 -# Deletes the routes to netdev and adds them on bridge.
   18.25 +# Creates the bridge
   18.26 +# Copies the IP and MAC addresses from netdev to vdev
   18.27 +# Renames netdev to be pdev 
   18.28 +# Renames vdev to be netdev 
   18.29 +# Enslaves pdev, vdev to bridge
   18.30  #
   18.31  # stop:
   18.32 -# Removes netdev from the bridge.
   18.33 -# Deletes the routes to bridge and adds them to netdev.
   18.34 +# Removes netdev from the bridge
   18.35 +# Transfers addresses, routes from netdev to pdev
   18.36 +# Renames netdev to vdev
   18.37 +# Renames pdev to netdev 
   18.38 +# Deletes bridge
   18.39  #
   18.40  # status:
   18.41 -# Print ifconfig for netdev and bridge.
   18.42 -# Print routes.
   18.43 +# Print addresses, interfaces, routes
   18.44  #
   18.45  #============================================================================
   18.46  
   18.47 @@ -97,7 +106,7 @@ s/inet/ip addr add/
   18.48  s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/[0-9]\+\)@\1@
   18.49  s/${src}/dev ${dst}/
   18.50  " | sh -e
   18.51 -    # Remove automatic routes on destionation device
   18.52 +    # Remove automatic routes on destination device
   18.53      ip route list | sed -ne "
   18.54  /dev ${dst}\( \|$\)/ {
   18.55    s/^/ip route del /
   18.56 @@ -105,17 +114,6 @@ s/${src}/dev ${dst}/
   18.57  }" | sh -e
   18.58  }
   18.59  
   18.60 -# Usage: del_addrs src
   18.61 -del_addrs () {
   18.62 -    local src=$1
   18.63 -    ip addr show dev ${src} | egrep '^ *inet ' | sed -e "
   18.64 -s/inet/ip addr del/
   18.65 -s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)/[0-9]\+@\1@
   18.66 -s/${src}/dev ${src}/
   18.67 -" | sh -e
   18.68 -    ip link set dev ${dst} up
   18.69 -}
   18.70 -
   18.71  # Usage: transfer_routes src dst
   18.72  # Get all IP routes to device $src, delete them, and
   18.73  # add the same routes to device $dst.
    19.1 --- a/tools/examples/xmexample.vmx	Thu Nov 10 11:43:24 2005 -0500
    19.2 +++ b/tools/examples/xmexample.vmx	Thu Nov 10 18:25:27 2005 +0100
    19.3 @@ -35,7 +35,11 @@ vcpus=1
    19.4  
    19.5  # Optionally define mac and/or bridge for the network interfaces.
    19.6  # Random MACs are assigned if not given.
    19.7 -#vif = [ 'mac=aa:00:00:00:00:11, bridge=xenbr0' ]
    19.8 +# nics default is 1
    19.9 +#vif = [ 'type=ioemu, mac=aa:00:00:00:00:11, bridge=xenbr0' ]
   19.10 +nics=1 
   19.11 +# type=ioemu specify the NIC is an ioemu device not netfront
   19.12 +vif = [ 'type=ioemu, bridge=xenbr0' ]
   19.13  
   19.14  #----------------------------------------------------------------------------
   19.15  # Define the disk devices you want the domain to have access to, and
   19.16 @@ -117,6 +121,11 @@ vncviewer=1
   19.17  #nographic=0
   19.18  
   19.19  
   19.20 +#-----------------------------------------------------------------------------
   19.21 +#   serial port re-direct to pty deivce, /dev/pts/n 
   19.22 +#   then xm console or minicom can connect
   19.23 +#serial='pty'
   19.24 +
   19.25  #----------------------------------------------------------------------------
   19.26  # enable ne2000, default = 0(use pcnet)
   19.27  ne2000=0
    20.1 --- a/tools/ioemu/target-i386-dm/Makefile	Thu Nov 10 11:43:24 2005 -0500
    20.2 +++ b/tools/ioemu/target-i386-dm/Makefile	Thu Nov 10 18:25:27 2005 +0100
    20.3 @@ -7,7 +7,7 @@ INSTALL_DIR := $(DESTDIR)/usr/$(LIBDIR)/
    20.4  TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH)
    20.5  VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
    20.6  DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH)
    20.7 -DEFINES+= -I$(XEN_ROOT)/tools/libxc
    20.8 +DEFINES+= -I$(XEN_ROOT)/tools/libxc -I$(XEN_ROOT)/tools/xenstore
    20.9  ifdef CONFIG_USER_ONLY
   20.10  VPATH+=:$(SRC_PATH)/linux-user
   20.11  DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
   20.12 @@ -188,7 +188,7 @@ endif
   20.13  #########################################################
   20.14  
   20.15  DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
   20.16 -LIBS+=-lm -L../../libxc -lxenctrl -lxenguest
   20.17 +LIBS+=-lm -L../../libxc -lxenctrl -lxenguest -L../../xenstore -lxenstore
   20.18  ifndef CONFIG_USER_ONLY
   20.19  LIBS+=-lz
   20.20  endif
    21.1 --- a/tools/ioemu/target-i386-dm/qemu-ifup	Thu Nov 10 11:43:24 2005 -0500
    21.2 +++ b/tools/ioemu/target-i386-dm/qemu-ifup	Thu Nov 10 18:25:27 2005 +0100
    21.3 @@ -7,4 +7,4 @@ echo 'config qemu network with xen bridg
    21.4  echo $*
    21.5  
    21.6  ifconfig $1 0.0.0.0 up
    21.7 -brctl addif xenbr0 $1
    21.8 +brctl addif $2 $1
    22.1 --- a/tools/ioemu/vl.c	Thu Nov 10 11:43:24 2005 -0500
    22.2 +++ b/tools/ioemu/vl.c	Thu Nov 10 18:25:27 2005 +0100
    22.3 @@ -76,6 +76,7 @@
    22.4  #endif /* CONFIG_SDL */
    22.5  
    22.6  #include "xenctrl.h"
    22.7 +#include "xs.h"
    22.8  #include "exec-all.h"
    22.9  
   22.10  //#define DO_TB_FLUSH
   22.11 @@ -123,6 +124,7 @@ int domid = -1;
   22.12  static char network_script[1024];
   22.13  int pit_min_timer_count = 0;
   22.14  int nb_nics;
   22.15 +char bridge[16];
   22.16  NetDriverState nd_table[MAX_NICS];
   22.17  QEMUTimer *gui_timer;
   22.18  QEMUTimer *polling_timer;
   22.19 @@ -1171,6 +1173,48 @@ CharDriverState *qemu_chr_open_stdio(voi
   22.20      return chr;
   22.21  }
   22.22  
   22.23 +int store_console_dev(int domid, char *pts)
   22.24 +{
   22.25 +    int xc_handle;
   22.26 +    unsigned int len = 0;
   22.27 +    struct xs_handle *xs;
   22.28 +    char *path;
   22.29 +
   22.30 +    xs = xs_daemon_open();
   22.31 +    if (xs == NULL) {
   22.32 +        fprintf(logfile, "Could not contact XenStore\n");
   22.33 +        return -1;
   22.34 +    }
   22.35 +
   22.36 +    xc_handle = xc_interface_open();
   22.37 +    if (xc_handle == -1) {
   22.38 +        fprintf(logfile, "xc_interface_open() error\n");
   22.39 +        return -1;
   22.40 +    }
   22.41 +    
   22.42 +    path = xs_get_domain_path(xs, domid);
   22.43 +    if (path == NULL) {
   22.44 +        fprintf(logfile, "xs_get_domain_path() error\n");
   22.45 +        return -1;
   22.46 +    }
   22.47 +    path = realloc(path, strlen(path) + strlen("/console/tty") + 1);
   22.48 +    if (path == NULL) {
   22.49 +        fprintf(logfile, "realloc error\n");
   22.50 +        return -1;
   22.51 +    }
   22.52 +    strcat(path, "/console/tty");
   22.53 +    if (!xs_write(xs, NULL, path, pts, strlen(pts))) {
   22.54 +        fprintf(logfile, "xs_write for console fail");
   22.55 +        return -1;
   22.56 +    }
   22.57 +    
   22.58 +    free(path);
   22.59 +    xs_daemon_close(xs);
   22.60 +    close(xc_handle);
   22.61 +
   22.62 +    return 0;
   22.63 +}
   22.64 +
   22.65  #if defined(__linux__)
   22.66  CharDriverState *qemu_chr_open_pty(void)
   22.67  {
   22.68 @@ -1182,6 +1226,7 @@ CharDriverState *qemu_chr_open_pty(void)
   22.69          return NULL;
   22.70      }
   22.71      fprintf(stderr, "char device redirected to %s\n", slave_name);
   22.72 +    store_console_dev(domid, slave_name);
   22.73      return qemu_chr_open_fd(master_fd, master_fd);
   22.74  }
   22.75  #else
   22.76 @@ -1542,7 +1587,7 @@ static void tun_add_read_packet(NetDrive
   22.77  static int net_tun_init(NetDriverState *nd)
   22.78  {
   22.79      int pid, status;
   22.80 -    char *args[3];
   22.81 +    char *args[4];
   22.82      char **parg;
   22.83      extern int highest_fds;
   22.84  
   22.85 @@ -1558,6 +1603,7 @@ static int net_tun_init(NetDriverState *
   22.86              parg = args;
   22.87              *parg++ = network_script;
   22.88              *parg++ = nd->ifname;
   22.89 +            *parg++ = bridge;
   22.90              *parg++ = NULL;
   22.91              execv(network_script, args);
   22.92              exit(1);
   22.93 @@ -2163,6 +2209,7 @@ void help(void)
   22.94             "Network options:\n"
   22.95             "-nics n         simulate 'n' network cards [default=1]\n"
   22.96             "-macaddr addr   set the mac address of the first interface\n"
   22.97 +           "-bridge  br     set the bridge interface for nic\n"
   22.98             "-n script       set tap/tun network init script [default=%s]\n"
   22.99             "-tun-fd fd      use this fd as already opened tap/tun interface\n"
  22.100  #ifdef CONFIG_SLIRP
  22.101 @@ -2253,6 +2300,7 @@ enum {
  22.102  
  22.103      QEMU_OPTION_nics,
  22.104      QEMU_OPTION_macaddr,
  22.105 +    QEMU_OPTION_bridge,
  22.106      QEMU_OPTION_n,
  22.107      QEMU_OPTION_tun_fd,
  22.108      QEMU_OPTION_user_net,
  22.109 @@ -2323,6 +2371,7 @@ const QEMUOption qemu_options[] = {
  22.110  
  22.111      { "nics", HAS_ARG, QEMU_OPTION_nics},
  22.112      { "macaddr", HAS_ARG, QEMU_OPTION_macaddr},
  22.113 +    { "bridge", HAS_ARG, QEMU_OPTION_bridge},
  22.114      { "n", HAS_ARG, QEMU_OPTION_n },
  22.115      { "tun-fd", HAS_ARG, QEMU_OPTION_tun_fd },
  22.116  #ifdef CONFIG_SLIRP
  22.117 @@ -2701,7 +2750,9 @@ int main(int argc, char **argv)
  22.118                  break;
  22.119              case QEMU_OPTION_nographic:
  22.120                  pstrcpy(monitor_device, sizeof(monitor_device), "stdio");
  22.121 -                pstrcpy(serial_devices[0], sizeof(serial_devices[0]), "stdio");
  22.122 +                if(!strcmp(serial_devices[0], "vc"))
  22.123 +                    pstrcpy(serial_devices[0], sizeof(serial_devices[0]),
  22.124 +                            "stdio");
  22.125                  nographic = 1;
  22.126                  break;
  22.127  #ifdef CONFIG_VNC
  22.128 @@ -2779,6 +2830,9 @@ int main(int argc, char **argv)
  22.129                      exit(1);
  22.130                  }
  22.131                  break;
  22.132 +            case QEMU_OPTION_bridge:
  22.133 +                pstrcpy(bridge, sizeof(bridge), optarg);
  22.134 +                break;
  22.135              case QEMU_OPTION_macaddr:
  22.136                  {
  22.137                      const char *p;
    23.1 --- a/tools/libxc/xc_vmx_build.c	Thu Nov 10 11:43:24 2005 -0500
    23.2 +++ b/tools/libxc/xc_vmx_build.c	Thu Nov 10 18:25:27 2005 +0100
    23.3 @@ -565,8 +565,10 @@ static int setup_guest(int xc_handle,
    23.4      return 0;
    23.5  
    23.6   error_out:
    23.7 -    free(mmu);
    23.8 -    free(page_array);
    23.9 +    if ( mmu != NULL )
   23.10 +        free(mmu);
   23.11 +    if ( page_array != NULL )
   23.12 +        free(page_array);
   23.13      return -1;
   23.14  }
   23.15  
   23.16 @@ -627,7 +629,7 @@ int xc_vmx_build(int xc_handle,
   23.17  
   23.18      if ( mlock(&st_ctxt, sizeof(st_ctxt) ) )
   23.19      {
   23.20 -        PERROR("xc_vmx_build: ctxt mlock failed");
   23.21 +        PERROR("%s: ctxt mlock failed", __func__);
   23.22          return 1;
   23.23      }
   23.24  
   23.25 @@ -661,7 +663,8 @@ int xc_vmx_build(int xc_handle,
   23.26          goto error_out;
   23.27      }
   23.28  
   23.29 -    free(image);
   23.30 +    if ( image != NULL )
   23.31 +        free(image);
   23.32  
   23.33      ctxt->flags = VGCF_VMX_GUEST;
   23.34      /* FPU is set up to default initial state. */
   23.35 @@ -707,7 +710,8 @@ int xc_vmx_build(int xc_handle,
   23.36      return rc;
   23.37  
   23.38   error_out:
   23.39 -    free(image);
   23.40 +    if ( image != NULL )
   23.41 +        free(image);
   23.42  
   23.43      return -1;
   23.44  }
    24.1 --- a/tools/pygrub/setup.py	Thu Nov 10 11:43:24 2005 -0500
    24.2 +++ b/tools/pygrub/setup.py	Thu Nov 10 18:25:27 2005 +0100
    24.3 @@ -34,6 +34,8 @@ if os.path.exists("/usr/include/reiserfs
    24.4      fsys_mods.append(reiser)
    24.5      fsys_pkgs.append("grub.fsys.reiser")
    24.6  
    24.7 +pkgs = ['grub', 'grub.fsys']
    24.8 +pkgs.extend(fsys_pkgs)
    24.9  setup(name='pygrub',
   24.10        version='0.3',
   24.11        description='Boot loader that looks a lot like grub for Xen',
   24.12 @@ -42,8 +44,7 @@ setup(name='pygrub',
   24.13        license='GPL',
   24.14        package_dir={'grub': 'src'},
   24.15        scripts = ["src/pygrub"],
   24.16 -      packages=['grub',
   24.17 -                'grub.fsys'].extend(fsys_pkgs),
   24.18 +      packages=pkgs,
   24.19        ext_modules = fsys_mods
   24.20        )
   24.21                 
    25.1 --- a/tools/pygrub/src/pygrub	Thu Nov 10 11:43:24 2005 -0500
    25.2 +++ b/tools/pygrub/src/pygrub	Thu Nov 10 18:25:27 2005 +0100
    25.3 @@ -89,8 +89,8 @@ def get_active_offset(file):
    25.4      buf = os.read(fd, 512)
    25.5      for poff in (446, 462, 478, 494): # partition offsets
    25.6          # active partition has 0x80 as the first byte
    25.7 -        if struct.unpack("<c", buf[p:p+1]) == ('\x80',):
    25.8 -            return struct.unpack("<", buf[p+8:p+12])[0] * SECTOR_SIZE
    25.9 +        if struct.unpack("<c", buf[poff:poff+1]) == ('\x80',):
   25.10 +            return struct.unpack("<L", buf[poff+8:poff+12])[0] * SECTOR_SIZE
   25.11      return -1
   25.12  
   25.13  def get_config(fn):
   25.14 @@ -113,11 +113,13 @@ def get_config(fn):
   25.15              break
   25.16  
   25.17      if fs is not None:
   25.18 -        if fs.file_exist("/boot/grub/menu.lst"):
   25.19 -            grubfile = "/boot/grub/menu.lst"
   25.20 -        elif fs.file_exist("/boot/grub/grub.conf"):
   25.21 -            grubfile = "/boot/grub/grub.conf"
   25.22 -        else:
   25.23 +        grubfile = None
   25.24 +        for f in ("/boot/grub/menu.lst", "/boot/grub/grub.conf",
   25.25 +                  "/grub/menu.lst", "/grub/grub.conf"):
   25.26 +            if fs.file_exist(f):
   25.27 +                grubfile = f
   25.28 +                break
   25.29 +        if grubfile is None:
   25.30              raise RuntimeError, "we couldn't find /boot/grub{menu.lst,grub.conf} " + \
   25.31                                  "in the image provided. halt!"
   25.32          f = fs.open_file(grubfile)
   25.33 @@ -169,7 +171,7 @@ def main(cf = None):
   25.34  #        if c == ord('q'):
   25.35  #            selected = -1
   25.36  #            break
   25.37 -        elif c == ord('c'):
   25.38 +        if c == ord('c'):
   25.39              # FIXME: needs to go to command line mode
   25.40              continue
   25.41          elif c == ord('a'):
   25.42 @@ -261,7 +263,7 @@ if __name__ == "__main__":
   25.43  
   25.44      offset = 0
   25.45      if is_disk_image(file):
   25.46 -        offset = get_active_offset(fn)
   25.47 +        offset = get_active_offset(file)
   25.48          if offset == -1:
   25.49              raise RuntimeError, "Unable to find active partition on disk"
   25.50  
    26.1 --- a/tools/python/xen/xend/image.py	Thu Nov 10 11:43:24 2005 -0500
    26.2 +++ b/tools/python/xen/xend/image.py	Thu Nov 10 18:25:27 2005 +0100
    26.3 @@ -258,6 +258,7 @@ class VmxImageHandler(ImageHandler):
    26.4              log.debug("args: %s, val: %s" % (a,v))
    26.5  
    26.6          # Handle disk/network related options
    26.7 +        mac = None
    26.8          for (name, info) in deviceConfig:
    26.9              if name == 'vbd':
   26.10                 uname = sxp.child_value(info, 'uname')
   26.11 @@ -276,11 +277,21 @@ class VmxImageHandler(ImageHandler):
   26.12                 ret.append("-%s" % vbddev)
   26.13                 ret.append("%s" % vbdparam)
   26.14              if name == 'vif':
   26.15 +               type = sxp.child_value(info, 'type')
   26.16 +               if type != 'ioemu':
   26.17 +                   continue
   26.18 +               if mac != None:
   26.19 +                   continue
   26.20                 mac = sxp.child_value(info, 'mac')
   26.21 +               bridge = sxp.child_value(info, 'bridge')
   26.22                 if mac == None:
   26.23                     mac = randomMAC()
   26.24 +               if bridge == None:
   26.25 +                   bridge = 'xenbr0'
   26.26                 ret.append("-macaddr")
   26.27                 ret.append("%s" % mac)
   26.28 +               ret.append("-bridge")
   26.29 +               ret.append("%s" % bridge)
   26.30              if name == 'vtpm':
   26.31                 instance = sxp.child_value(info, 'instance')
   26.32                 ret.append("-instance")
    27.1 --- a/tools/python/xen/xend/server/netif.py	Thu Nov 10 11:43:24 2005 -0500
    27.2 +++ b/tools/python/xen/xend/server/netif.py	Thu Nov 10 18:25:27 2005 +0100
    27.3 @@ -71,6 +71,9 @@ class NetifController(DevController):
    27.4          script = os.path.join(xroot.network_script_dir,
    27.5                                sxp.child_value(config, 'script',
    27.6                                                xroot.get_vif_script()))
    27.7 +        type = sxp.child_value(config, 'type')
    27.8 +        if type == 'ioemu':
    27.9 +            return (None,{},{})
   27.10          bridge = sxp.child_value(config, 'bridge')
   27.11          mac    = sxp.child_value(config, 'mac')
   27.12          ipaddr = _get_config_ipaddr(config)
    28.1 --- a/tools/python/xen/xm/create.py	Thu Nov 10 11:43:24 2005 -0500
    28.2 +++ b/tools/python/xen/xm/create.py	Thu Nov 10 18:25:27 2005 +0100
    28.3 @@ -255,10 +255,11 @@ gopts.var('ipaddr', val="IPADDR",
    28.4            fn=append_value, default=[],
    28.5            use="Add an IP address to the domain.")
    28.6  
    28.7 -gopts.var('vif', val="mac=MAC,be_mac=MAC,bridge=BRIDGE,script=SCRIPT,backend=DOM,vifname=NAME",
    28.8 +gopts.var('vif', val="type=TYPE,mac=MAC,be_mac=MAC,bridge=BRIDGE,script=SCRIPT,backend=DOM,vifname=NAME",
    28.9            fn=append_value, default=[],
   28.10            use="""Add a network interface with the given MAC address and bridge.
   28.11            The vif is configured by calling the given configuration script.
   28.12 +          If type is not specified, default is netfront not ioemu device.
   28.13            If mac is not specified a random MAC address is used.
   28.14            The MAC address of the backend interface can be selected with be_mac.
   28.15            If not specified then the network backend chooses it's own MAC address.
   28.16 @@ -356,10 +357,6 @@ gopts.var('cdrom', val='FILE',
   28.17            fn=set_value, default='',
   28.18            use="Path to cdrom")
   28.19  
   28.20 -gopts.var('macaddr', val='MACADDR',
   28.21 -          fn=set_value, default='',
   28.22 -          use="Macaddress of the first network interface")
   28.23 -
   28.24  gopts.var('boot', val="a|b|c|d",
   28.25            fn=set_value, default='c',
   28.26            use="Default boot device")
   28.27 @@ -512,6 +509,7 @@ def configure_vifs(config_devs, vals):
   28.28              backend = d.get('backend')
   28.29              ip = d.get('ip')
   28.30              vifname = d.get('vifname')
   28.31 +            type = d.get('type')
   28.32          else:
   28.33              mac = None
   28.34              be_mac = None
   28.35 @@ -520,6 +518,7 @@ def configure_vifs(config_devs, vals):
   28.36              backend = None
   28.37              ip = None
   28.38              vifname = None
   28.39 +            type = None
   28.40          config_vif = ['vif']
   28.41          if mac:
   28.42              config_vif.append(['mac', mac])
   28.43 @@ -535,6 +534,8 @@ def configure_vifs(config_devs, vals):
   28.44              config_vif.append(['backend', backend])
   28.45          if ip:
   28.46              config_vif.append(['ip', ip])
   28.47 +        if type:
   28.48 +            config_vif.append(['type', type])
   28.49          config_devs.append(['device', config_vif])
   28.50  
   28.51  def configure_vfr(config, vals):
   28.52 @@ -549,7 +550,7 @@ def configure_vmx(config_image, vals):
   28.53      """Create the config for VMX devices.
   28.54      """
   28.55      args = [ 'device_model', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
   28.56 -             'localtime', 'serial', 'macaddr', 'stdvga', 'isa', 'nographic',
   28.57 +             'localtime', 'serial', 'stdvga', 'isa', 'nographic',
   28.58               'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'lapic']
   28.59      for a in args:
   28.60          if (vals.__dict__[a]):
   28.61 @@ -662,7 +663,7 @@ def preprocess_vifs(vals):
   28.62              (k, v) = b.strip().split('=', 1)
   28.63              k = k.strip()
   28.64              v = v.strip()
   28.65 -            if k not in ['mac', 'be_mac', 'bridge', 'script', 'backend', 'ip', 'vifname']:
   28.66 +            if k not in ['type', 'mac', 'be_mac', 'bridge', 'script', 'backend', 'ip', 'vifname']:
   28.67                  err('Invalid vif specifier: ' + vif)
   28.68              d[k] = v
   28.69          vifs.append(d)
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/tools/python/xen/xm/tests/__init__.py	Thu Nov 10 18:25:27 2005 +0100
    29.3 @@ -0,0 +1,2 @@
    29.4 +
    29.5 +
    30.1 --- a/tools/xenstore/xenstored_core.c	Thu Nov 10 11:43:24 2005 -0500
    30.2 +++ b/tools/xenstore/xenstored_core.c	Thu Nov 10 18:25:27 2005 +0100
    30.3 @@ -56,6 +56,7 @@ extern int eventchn_fd; /* in xenstored_
    30.4  static bool verbose;
    30.5  LIST_HEAD(connections);
    30.6  static int tracefd = -1;
    30.7 +static int reopen_log_pipe[2];
    30.8  static char *tracefile = NULL;
    30.9  static TDB_CONTEXT *tdb_ctx;
   30.10  
   30.11 @@ -243,21 +244,35 @@ void trace(const char *fmt, ...)
   30.12  	talloc_free(str);
   30.13  }
   30.14  
   30.15 -void reopen_log()
   30.16 +
   30.17 +/**
   30.18 + * Signal handler for SIGHUP, which requests that the trace log is reopened
   30.19 + * (in the main loop).  A single byte is written to reopen_log_pipe, to awaken
   30.20 + * the select() in the main loop.
   30.21 + */
   30.22 +static void trigger_reopen_log(int signal __attribute__((unused)))
   30.23  {
   30.24 -	if (!tracefile)
   30.25 -		return;
   30.26 +	char c = 'A';
   30.27 +	write(reopen_log_pipe[1], &c, 1);
   30.28 +}
   30.29 +
   30.30  
   30.31 -	if (tracefd > 0)
   30.32 -		close(tracefd);
   30.33 -	tracefd = open(tracefile, O_WRONLY|O_CREAT|O_APPEND, 0600);
   30.34 -	if (tracefd < 0) {
   30.35 -		perror("Could not open tracefile");
   30.36 -		return;
   30.37 +static void reopen_log()
   30.38 +{
   30.39 +	if (tracefile) {
   30.40 +		if (tracefd > 0)
   30.41 +			close(tracefd);
   30.42 +
   30.43 +		tracefd = open(tracefile, O_WRONLY|O_CREAT|O_APPEND, 0600);
   30.44 +
   30.45 +		if (tracefd < 0)
   30.46 +			perror("Could not open tracefile");
   30.47 +		else
   30.48 +			write(tracefd, "\n***\n", strlen("\n***\n"));
   30.49  	}
   30.50 -	write(tracefd, "\n***\n", strlen("\n***\n"));
   30.51  }
   30.52  
   30.53 +
   30.54  static bool write_messages(struct connection *conn)
   30.55  {
   30.56  	int ret;
   30.57 @@ -331,29 +346,33 @@ static int destroy_conn(void *_conn)
   30.58  	return 0;
   30.59  }
   30.60  
   30.61 +
   30.62 +static void set_fd(int fd, fd_set *set, int *max)
   30.63 +{
   30.64 +	FD_SET(fd, set);
   30.65 +	if (fd > *max)
   30.66 +		*max = fd;
   30.67 +}
   30.68 +
   30.69 +
   30.70  static int initialize_set(fd_set *inset, fd_set *outset, int sock, int ro_sock)
   30.71  {
   30.72  	struct connection *i;
   30.73 -	int max;
   30.74 +	int max = -1;
   30.75  
   30.76  	FD_ZERO(inset);
   30.77  	FD_ZERO(outset);
   30.78 -	FD_SET(sock, inset);
   30.79 -	max = sock;
   30.80 -	FD_SET(ro_sock, inset);
   30.81 -	if (ro_sock > max)
   30.82 -		max = ro_sock;
   30.83 -	FD_SET(eventchn_fd, inset);
   30.84 -	if (eventchn_fd > max)
   30.85 -		max = eventchn_fd;
   30.86 +
   30.87 +	set_fd(sock,               inset, &max);
   30.88 +	set_fd(ro_sock,            inset, &max);
   30.89 +	set_fd(eventchn_fd,        inset, &max);
   30.90 +	set_fd(reopen_log_pipe[0], inset, &max);
   30.91  	list_for_each_entry(i, &connections, list) {
   30.92  		if (i->domain)
   30.93  			continue;
   30.94 -		FD_SET(i->fd, inset);
   30.95 +		set_fd(i->fd, inset, &max);
   30.96  		if (!list_empty(&i->out_list))
   30.97  			FD_SET(i->fd, outset);
   30.98 -		if (i->fd > max)
   30.99 -			max = i->fd;
  30.100  	}
  30.101  	return max;
  30.102  }
  30.103 @@ -1570,6 +1589,10 @@ int main(int argc, char *argv[])
  30.104  	    || listen(*ro_sock, 1) != 0)
  30.105  		barf_perror("Could not listen on sockets");
  30.106  
  30.107 +	if (pipe(reopen_log_pipe)) {
  30.108 +		barf_perror("pipe");
  30.109 +	}
  30.110 +
  30.111  	/* Setup the database */
  30.112  	setup_structure();
  30.113  
  30.114 @@ -1592,7 +1615,7 @@ int main(int argc, char *argv[])
  30.115  		close(STDERR_FILENO);
  30.116  	}
  30.117  
  30.118 -	signal(SIGHUP, reopen_log);
  30.119 +	signal(SIGHUP, trigger_reopen_log);
  30.120  
  30.121  #ifdef TESTING
  30.122  	signal(SIGUSR1, stop_failtest);
  30.123 @@ -1612,6 +1635,12 @@ int main(int argc, char *argv[])
  30.124  			barf_perror("Select failed");
  30.125  		}
  30.126  
  30.127 +		if (FD_ISSET(reopen_log_pipe[0], &inset)) {
  30.128 +			char c;
  30.129 +			read(reopen_log_pipe[0], &c, 1);
  30.130 +			reopen_log();
  30.131 +		}
  30.132 +
  30.133  		if (FD_ISSET(*sock, &inset))
  30.134  			accept_connection(*sock, true);
  30.135  
    31.1 --- a/tools/xm-test/lib/XmTestLib/Console.py	Thu Nov 10 11:43:24 2005 -0500
    31.2 +++ b/tools/xm-test/lib/XmTestLib/Console.py	Thu Nov 10 18:25:27 2005 +0100
    31.3 @@ -23,13 +23,13 @@
    31.4       a _very_ specific value, set in the PROMPT
    31.5       variable of this script
    31.6  """
    31.7 -import sys;
    31.8 -import os;
    31.9 -import pty;
   31.10 -import tty;
   31.11 -import termios;
   31.12 -import fcntl;
   31.13 -import select;
   31.14 +import sys
   31.15 +import os
   31.16 +import pty
   31.17 +import tty
   31.18 +import termios
   31.19 +import fcntl
   31.20 +import select
   31.21  
   31.22  from Test import *
   31.23  
   31.24 @@ -52,15 +52,15 @@ class XmConsole:
   31.25                              are included in the history buffer
   31.26          """
   31.27  
   31.28 -        self.TIMEOUT          = 30;
   31.29 -        self.PROMPT           = "@%@%> ";
   31.30 -        self.domain           = domain;
   31.31 -        self.historyBuffer    = [];
   31.32 -        self.historyLines     = 0;
   31.33 -        self.historyLimit     = historyLimit;
   31.34 -        self.historySaveAll   = historySaveAll;
   31.35 -        self.historySaveCmds  = historySaveCmds;
   31.36 -        self.debugMe          = False;
   31.37 +        self.TIMEOUT          = 30
   31.38 +        self.PROMPT           = "@%@%> "
   31.39 +        self.domain           = domain
   31.40 +        self.historyBuffer    = []
   31.41 +        self.historyLines     = 0
   31.42 +        self.historyLimit     = historyLimit
   31.43 +        self.historySaveAll   = historySaveAll
   31.44 +        self.historySaveCmds  = historySaveCmds
   31.45 +        self.debugMe          = False
   31.46          self.limit            = None
   31.47  
   31.48          consoleCmd = ["/usr/sbin/xm", "xm", "console", domain]
   31.49 @@ -68,62 +68,62 @@ class XmConsole:
   31.50          if verbose:
   31.51              print "Console executing: " + str(consoleCmd)
   31.52  
   31.53 -        pid, fd = pty.fork();
   31.54 +        pid, fd = pty.fork()
   31.55  
   31.56          if pid == 0:
   31.57 -            os.execvp("/usr/sbin/xm", consoleCmd[1:]);
   31.58 +            os.execvp("/usr/sbin/xm", consoleCmd[1:])
   31.59  
   31.60 -        self.consolePid = pid;
   31.61 -        self.consoleFd  = fd;
   31.62 +        self.consolePid = pid
   31.63 +        self.consoleFd  = fd
   31.64  
   31.65 -        tty.setraw(self.consoleFd, termios.TCSANOW);
   31.66 +        tty.setraw(self.consoleFd, termios.TCSANOW)
   31.67              
   31.68          bytes = self.__chewall(self.consoleFd)
   31.69          if bytes < 0:
   31.70              raise ConsoleError("Console didn't respond")
   31.71  
   31.72      def __addToHistory(self, line):
   31.73 -        self.historyBuffer.append(line);
   31.74 -        self.historyLines += 1;
   31.75 +        self.historyBuffer.append(line)
   31.76 +        self.historyLines += 1
   31.77          if self.historyLines > self.historyLimit:
   31.78 -            self.historyBuffer = self.historyBuffer[1:];
   31.79 -            self.historyLines -= 1;
   31.80 +            self.historyBuffer = self.historyBuffer[1:]
   31.81 +            self.historyLines -= 1
   31.82  
   31.83  
   31.84      def clearHistory(self):
   31.85          """Clear the history buffer"""
   31.86 -        self.historyBuffer = [];
   31.87 -        self.historyLines = 0;
   31.88 +        self.historyBuffer = []
   31.89 +        self.historyLines = 0
   31.90  
   31.91  
   31.92      def getHistory(self):
   31.93          """Returns a string containing the entire history buffer"""
   31.94 -        output = "";
   31.95 +        output = ""
   31.96  
   31.97          for line in self.historyBuffer:
   31.98 -            output += line + "\n";
   31.99 +            output += line + "\n"
  31.100  
  31.101 -        return output;
  31.102 +        return output
  31.103  
  31.104  
  31.105      def setTimeout(self, timeout):
  31.106          """Sets the timeout used to determine if a remote command
  31.107          has blocked"""
  31.108 -        self.TIMEOUT = timeout;
  31.109 +        self.TIMEOUT = timeout
  31.110  
  31.111  
  31.112      def setPrompt(self, prompt):
  31.113          """Sets the string key used to delimit the end of command
  31.114          output"""
  31.115 -        self.PROMPT = prompt;
  31.116 +        self.PROMPT = prompt
  31.117  
  31.118  
  31.119      def __chewall(self, fd):
  31.120 -        timeout = 0;
  31.121 -        bytes   = 0;
  31.122 +        timeout = 0
  31.123 +        bytes   = 0
  31.124          
  31.125          while timeout < 3:
  31.126 -            i, o, e = select.select([fd], [], [], 1);
  31.127 +            i, o, e = select.select([fd], [], [], 1)
  31.128              if fd in i:
  31.129                  try:
  31.130                      foo = os.read(fd, 1)
  31.131 @@ -143,7 +143,7 @@ class XmConsole:
  31.132          if self.debugMe:
  31.133              print "Ignored %i bytes of miscellaneous console output" % bytes
  31.134          
  31.135 -        return bytes;
  31.136 +        return bytes
  31.137  
  31.138  
  31.139      def __runCmd(self, command, saveHistory=True):
  31.140 @@ -152,15 +152,15 @@ class XmConsole:
  31.141          lines  = 0
  31.142          bytes  = 0
  31.143  
  31.144 -        self.__chewall(self.consoleFd);
  31.145 +        self.__chewall(self.consoleFd)
  31.146  
  31.147          if verbose:
  31.148              print "[%s] Sending `%s'" % (self.domain, command)
  31.149  
  31.150 -        os.write(self.consoleFd, "%s\n" % command);
  31.151 +        os.write(self.consoleFd, "%s\n" % command)
  31.152  
  31.153          while 1==1:
  31.154 -            i, o, e = select.select([self.consoleFd], [], [], self.TIMEOUT);
  31.155 +            i, o, e = select.select([self.consoleFd], [], [], self.TIMEOUT)
  31.156  
  31.157              if self.consoleFd in i:
  31.158                  try:
  31.159 @@ -182,59 +182,59 @@ class XmConsole:
  31.160                  if lines > 0:
  31.161                      output += line + "\n"
  31.162                      if saveHistory:
  31.163 -                        self.__addToHistory(line);
  31.164 +                        self.__addToHistory(line)
  31.165                  elif self.historySaveCmds and saveHistory:
  31.166 -                    self.__addToHistory("*" + line);
  31.167 -                lines += 1;
  31.168 -                line = "";
  31.169 +                    self.__addToHistory("*" + line)
  31.170 +                lines += 1
  31.171 +                line = ""
  31.172              elif str == "\r":
  31.173                  pass # ignore \r's
  31.174              else:
  31.175 -                line += str;
  31.176 +                line += str
  31.177  
  31.178              if line == self.PROMPT:
  31.179 -                break;
  31.180 +                break
  31.181  
  31.182 -        return output;
  31.183 +        return output
  31.184  
  31.185  
  31.186      def runCmd(self, command):
  31.187          """Runs a command on the remote terminal and returns the output
  31.188          as well as the return code.  For example:
  31.189          
  31.190 -        ret = c.runCmd("ls");
  31.191 -        print ret["output"];
  31.192 -        sys.exit(run["return"]);
  31.193 +        ret = c.runCmd("ls")
  31.194 +        print ret["output"]
  31.195 +        sys.exit(run["return"])
  31.196          
  31.197          """
  31.198  
  31.199          # Allow exceptions to bubble up
  31.200 -        realOutput = self.__runCmd(command);
  31.201 -        retOutput  = self.__runCmd("echo $?", saveHistory=False);
  31.202 +        realOutput = self.__runCmd(command)
  31.203 +        retOutput  = self.__runCmd("echo $?", saveHistory=False)
  31.204  
  31.205          try:
  31.206 -            retCode =  int(retOutput);
  31.207 +            retCode =  int(retOutput)
  31.208          except:
  31.209 -            retCode = 255;
  31.210 +            retCode = 255
  31.211          return {
  31.212              "output": realOutput,
  31.213              "return": retCode,
  31.214 -            };
  31.215 +            }
  31.216  
  31.217      def sendInput(self, input):
  31.218          """Sends input to the remote terminal, but doesn't check
  31.219          for a return code"""
  31.220 -        realOutput = self.__runCmd(input);
  31.221 +        realOutput = self.__runCmd(input)
  31.222          return {
  31.223              "output": realOutput,
  31.224              "return": 0,
  31.225 -            };
  31.226 +            }
  31.227  
  31.228      def closeConsole(self):
  31.229          """Closes the console connection and ensures that the console
  31.230          process is killed"""
  31.231 -        os.close(self.consoleFd);
  31.232 -        os.kill(self.consolePid, 2);
  31.233 +        os.close(self.consoleFd)
  31.234 +        os.kill(self.consolePid, 2)
  31.235  
  31.236  
  31.237      def setLimit(self, limit):
  31.238 @@ -254,23 +254,23 @@ if __name__ == "__main__":
  31.239      code as the domU command.
  31.240      """
  31.241  
  31.242 -    verbose = True;
  31.243 +    verbose = True
  31.244      
  31.245      try:
  31.246 -        t = XmConsole(sys.argv[1]);
  31.247 +        t = XmConsole(sys.argv[1])
  31.248      except ConsoleError, e:
  31.249          print "Failed to attach to console (%s)" % str(e)
  31.250          sys.exit(255)
  31.251  
  31.252      try:
  31.253 -        run = t.runCmd(sys.argv[2]);
  31.254 +        run = t.runCmd(sys.argv[2])
  31.255      except ConsoleError, e:
  31.256          print "Console failed (%)" % str(e)
  31.257          sys.exit(255)
  31.258          
  31.259 -    t.closeConsole();
  31.260 +    t.closeConsole()
  31.261      
  31.262 -    print run["output"],;
  31.263 -    sys.exit(run["return"]);
  31.264 +    print run["output"],
  31.265 +    sys.exit(run["return"])
  31.266      
  31.267          
    32.1 --- a/tools/xm-test/lib/XmTestReport/xmtest.py	Thu Nov 10 11:43:24 2005 -0500
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,3 +0,0 @@
    32.4 -#!/usr/bin/python
    32.5 -
    32.6 -XM_TEST_VERSION = "0.4.0"
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/tools/xm-test/mergereport	Thu Nov 10 18:25:27 2005 +0100
    33.3 @@ -0,0 +1,25 @@
    33.4 +#!/bin/sh
    33.5 +
    33.6 +# Dan Smith <danms@us.ibm.com> - 16-Sep-2005
    33.7 +#
    33.8 +# This script takes all the .report files in the current
    33.9 +# directory and generates a summary table, showing the 
   33.10 +# number of PASS, FAIL, XPASS, and XFAIL tests in each 
   33.11 +# report
   33.12 +
   33.13 +
   33.14 +echo "            Platform | PASS | FAIL | XPASS | XFAIL |"
   33.15 +echo "---------------------+------+------+-------+-------+"
   33.16 +
   33.17 +for r in *.report; do
   33.18 +    
   33.19 +    mach=$(basename $r .report)
   33.20 +    pass=$(cat $r | grep '  PASS' | cut -d : -f 2 | sed 's/  *//')
   33.21 +    fail=$(cat $r | grep '  FAIL' | cut -d : -f 2 | sed 's/  *//')
   33.22 +    xpas=$(cat $r | grep ' XPASS' | cut -d : -f 2 | sed 's/  *//')
   33.23 +    xfal=$(cat $r | grep ' XFAIL' | cut -d : -f 2 | sed 's/  *//')
   33.24 +
   33.25 +    printf "%20s | %4s | %4s | %5s | %5s |\n" "$mach" "$pass" \
   33.26 +           "$fail" "$xpas" "$xfal"
   33.27 +
   33.28 +done
    34.1 --- a/tools/xm-test/runtest.sh	Thu Nov 10 11:43:24 2005 -0500
    34.2 +++ b/tools/xm-test/runtest.sh	Thu Nov 10 18:25:27 2005 +0100
    34.3 @@ -1,215 +1,259 @@
    34.4  #!/bin/sh
    34.5  
    34.6 -usage() {
    34.7 -    echo "Usage: $0 [opts] <logfile>"
    34.8 -    echo "  Where opts are:"
    34.9 -    echo "  -d         : do not submit a report for this run"
   34.10 -    echo "  -b         : do not ask any questions (batch mode)"
   34.11 -    echo "  -e <email> : set email address for report"
   34.12 -}
   34.13  ##
   34.14  ## Test driver script
   34.15  ##
   34.16  
   34.17 -#
   34.18 -# Defaults
   34.19 -#
   34.20 -MAXFAIL=10
   34.21 -report=yes
   34.22 -batch=no
   34.23 +usage() {
   34.24 +    echo "Usage: $0 [opts] <report>"
   34.25 +    echo "  Where report is a name that will be used for report files"
   34.26 +    echo ""
   34.27 +    echo "  Where opts are:"
   34.28 +    echo "  -d          : do not submit a report for this run"
   34.29 +    echo "  -b          : do not ask any questions (batch mode)"
   34.30 +    echo "  -q          : run a quick test set"
   34.31 +    echo "  -e <email>  : set email address for report"
   34.32 +    echo "  -s <report> : just submit report <report>"
   34.33 +}
   34.34 +
   34.35 +# Just submit the report
   34.36 +submit_report() {
   34.37  
   34.38 -#
   34.39 -# Resolve options
   34.40 -#
   34.41 -while [ $# -gt 0 ]
   34.42 -do
   34.43 -    case "$1" in
   34.44 -    -d)
   34.45 -        echo "(Skipping report submission)"
   34.46 -        report=no
   34.47 -        ;;
   34.48 -    -b)
   34.49 -        echo "(Batch mode)"
   34.50 -        batch=yes
   34.51 -        ;;
   34.52 -    -e)
   34.53 -        shift
   34.54 -        echo $1 > contact_info
   34.55 -        echo "(Email set to $1)"
   34.56 -        ;;
   34.57 -    *)
   34.58 -        LOGFILE=$1
   34.59 -        break
   34.60 -        ;;
   34.61 -    esac
   34.62 -    shift
   34.63 -done
   34.64 +    reportfile=$1
   34.65 +
   34.66 +    ./lib/XmTestReport/Report.py $reportfile
   34.67 +}
   34.68 +
   34.69 +# Generate XML result report from output file
   34.70 +make_result_report() {
   34.71 +    output=$1
   34.72 +    reportfile=$2
   34.73 +    if ! ./lib/XmTestReport/ResultReport.py $output > $reportfile; then
   34.74 +	echo "Unable to generate clean ResultReport"
   34.75 +	echo "Take a look at $report"
   34.76 +	exit 1
   34.77 +    fi
   34.78 +}
   34.79  
   34.80 -#
   34.81 -# Usage
   34.82 -#
   34.83 -if [ -z $LOGFILE ]; then
   34.84 -	usage
   34.85 +# Collect environment information for XML report
   34.86 +make_environment_report() {
   34.87 +    os=$1
   34.88 +    prog=$2
   34.89 +    if ! ./lib/XmTestReport/OSReport.py > $os; then
   34.90 +	echo "Unable to generate clean OSReport"
   34.91 +	echo "Take a look at $os"
   34.92  	exit 1
   34.93 -fi
   34.94 +    fi
   34.95 +    if ! ./lib/XmTestReport/ProgReport.py > $prog; then
   34.96 +	echo "Unable to generate clean ProgReport"
   34.97 +	echo "Take a look at $prog"
   34.98 +	exit 1
   34.99 +    fi
  34.100 +}
  34.101  
  34.102 -#
  34.103 -# Output files
  34.104 -#
  34.105 -OSREPORTTEMP=${LOGFILE}.os.xml
  34.106 -PROGREPORTTEMP=${LOGFILE}.prog.xml
  34.107 -RESULTREPORTTEMP=${LOGFILE}.result.xml
  34.108 -OUTPUT=${LOGFILE}.output
  34.109 -SUMMARY=${LOGFILE}.summary
  34.110 -PASSFAIL=${LOGFILE}.passfail
  34.111 -REPORT=${LOGFILE}.report
  34.112 -FAILURES=${LOGFILE}.failures
  34.113 -		
  34.114 -#
  34.115 -# Make sure we're root
  34.116 -#
  34.117 -uid=$(id -u)
  34.118 -if [ $uid != 0 ]; then 
  34.119 -    echo "ERROR: I must be run as root!"
  34.120 -    exit 1
  34.121 -fi
  34.122 +# Check conditions needed to actually run the tests
  34.123 +runnable_tests() {	
  34.124 +    # Make sure we're root
  34.125 +    uid=$(id -u)
  34.126 +    if [ $uid != 0 ]; then 
  34.127 +	echo "ERROR: I must be run as root!"
  34.128 +	exit 1
  34.129 +    fi
  34.130  
  34.131 -#
  34.132 -# See if the ramdisk has been built
  34.133 -#
  34.134 -rdsize=$(stat -c %s ramdisk/initrd.img 2>/dev/null)
  34.135 -if [ -z "$rdsize" ] || [ $rdsize -le 16384 ]; then
  34.136 -    echo "Cannot find a valid ramdisk.  You need to run \"make\" or"
  34.137 -    echo "copy in a previously-built ramdisk to the ramdisk/ directory"
  34.138 -    exit 1
  34.139 -fi
  34.140 +    # See if the ramdisk has been built
  34.141 +    rdsize=$(stat -c %s ramdisk/initrd.img 2>/dev/null)
  34.142 +    if [ -z "$rdsize" ] || [ $rdsize -le 16384 ]; then
  34.143 +	echo "Cannot find a valid ramdisk.  You need to run \"make\" or"
  34.144 +	echo "copy in a previously-built ramdisk to the ramdisk/ directory"
  34.145 +	exit 1
  34.146 +    fi
  34.147 +
  34.148 +    # See if xend is running
  34.149 +    if ! xm list >/dev/null 2>&1; then
  34.150 +	echo "'xm list' failed: is xend running?"
  34.151 +	exit 1
  34.152 +    fi
  34.153 +    
  34.154 +}
  34.155  
  34.156 -#
  34.157 -# See if xend is running
  34.158 -#
  34.159 -if ! xm list >/dev/null 2>&1; then
  34.160 -    echo "'xm list' failed: is xend running?"
  34.161 -    exit 1
  34.162 -fi
  34.163 +# Get contact info if needed
  34.164 +get_contact_info() {
  34.165 +    
  34.166 +    if [ ! -f contact_info ]; then
  34.167 +	if [ "$batch" = "yes" ]; then
  34.168 +	    echo "Unable to read contact_info!"
  34.169 +	    echo "Please run me once interactively before using batch mode!"
  34.170 +	    exit 1
  34.171 +	else
  34.172 +	    echo "Please provide your email address so that we can "
  34.173 +	    echo "contact you if we need further information concerning"
  34.174 +	    echo "your results.  Any information provided will be"
  34.175 +	    echo "kept private.  If you wish to remain anonymous, please"
  34.176 +	    echo "hit [ENTER] now."
  34.177 +	    
  34.178 +	    while ! echo "$EMAIL" | grep -q '@'; do
  34.179 +		echo
  34.180 +		echo -n "Your email address: "
  34.181 +		read EMAIL
  34.182 +		if [ -z $EMAIL ]; then
  34.183 +		    EMAIL="anonymous@somewhere.com"
  34.184 +		fi
  34.185 +	    done
  34.186 +	    echo $EMAIL > contact_info
  34.187 +	fi
  34.188 +    fi
  34.189 +}
  34.190  
  34.191 -#
  34.192 -#  Make sure permissions are correct
  34.193 -#
  34.194 -chmod a+x lib/XmTestReport/*
  34.195 -chmod a+x mkreport mergereport
  34.196 +# Run the tests
  34.197 +run_tests() {
  34.198 +    output=$1
  34.199 +    echo Running tests...
  34.200 +    TEST_VERBOSE=1 make -k check > $output 2>&1
  34.201 +}
  34.202  
  34.203 -#
  34.204 -# Get contact info if needed
  34.205 -#
  34.206 -if [ ! -f contact_info ]; then
  34.207 -    if [ "$batch" = "yes" ]; then
  34.208 -	echo "Unable to read contact_info!"
  34.209 -	echo "Please run me once interactively before using batch mode!"
  34.210 -	exit 1
  34.211 -    else
  34.212 -	echo "Please provide your email address so that we can "
  34.213 -	echo "contact you if we need further information concerning"
  34.214 -	echo "your results.  Any information provided will be"
  34.215 -	echo "kept private.  If you wish to remain anonymous, please"
  34.216 -	echo "hit [ENTER] now."
  34.217 -	
  34.218 -	while ! echo "$EMAIL" | grep -q '@'; do
  34.219 -	    echo
  34.220 -	    echo -n "Your email address: "
  34.221 -	    read EMAIL
  34.222 -	    if [ -z $EMAIL ]; then
  34.223 -		EMAIL="anonymous@somewhere.com"
  34.224 -	    fi
  34.225 -	done
  34.226 -	echo $EMAIL > contact_info
  34.227 -    fi
  34.228 -fi
  34.229 +run_tests_quick() {
  34.230 +
  34.231 +    output=$1
  34.232 +
  34.233 +    create_tests="01_create_basic_pos.test 07_create_mem64_pos.test 10_create_fastdestroy.test 14_create_blockroot_pos.test"
  34.234 +    unpause_tests="01_unpause_basic_pos.test"
  34.235 +    memset_tests="01_memset_basic_pos.test 03_memset_random_pos.test"
  34.236 +    help_tests="06_help_allcmds.test"
  34.237 +    testgroups="create unpause memset help"
  34.238 +
  34.239 +    echo "*** Quick test" > $output
  34.240 +    for group in $testgroups; do
  34.241 +	eval $(echo list=\$${group}_tests)
  34.242 +	echo "*** Running tests [$list] from $group"
  34.243 +	(cd tests/$group && TEST_VERBOSE=1 make -k check TESTS="$list") >> $output 2>&1
  34.244 +    done
  34.245 +
  34.246 +}
  34.247  
  34.248 -#
  34.249 -# Collect environment information for XML report
  34.250 -#
  34.251 -if ! ./lib/XmTestReport/OSReport.py > $OSREPORTTEMP; then
  34.252 -    echo "Unable to generate clean OSReport"
  34.253 -    echo "Take a look at $OSREPORTTEMP"
  34.254 -    exit 1
  34.255 -fi
  34.256 -if ! ./lib/XmTestReport/ProgReport.py > $PROGREPORTTEMP; then
  34.257 -    echo "Unable to generate clean ProgReport"
  34.258 -    echo "Take a look at $PROGREPORTTEMP"
  34.259 -    exit 1
  34.260 -fi
  34.261 -
  34.262 -#
  34.263 -# Run the tests
  34.264 -#
  34.265 -export TEST_VERBOSE=1
  34.266 -echo Running tests...
  34.267 -make -k check > $OUTPUT 2>&1
  34.268 -
  34.269 -#
  34.270  # Generate some plain-text reports
  34.271 -#
  34.272 -echo "Making PASS/FAIL report ($PASSFAIL)..."
  34.273 -cat $OUTPUT | egrep '(REASON|PASS|FAIL|XPASS|XFAIL|SKIP)' | perl -pe 's/^(PASS|FAIL|XPASS|XFAIL)(.+)$/$1$2\n/' > $PASSFAIL
  34.274 -
  34.275 -echo "Making FAIL report ($FAILURES)..."
  34.276 -cat $PASSFAIL | egrep '(REASON|FAIL)' > $FAILURES
  34.277 -
  34.278 -NUMPASS=`grep -c PASS $OUTPUT`
  34.279 -NUMFAIL=`grep -c FAIL $OUTPUT`
  34.280 -NUMXPASS=`grep -c XPASS $OUTPUT`
  34.281 -NUMXFAIL=`grep -c XFAIL $OUTPUT`
  34.282 -cat > $SUMMARY << EOF
  34.283 +make_text_reports() {
  34.284 +    passfail=$1
  34.285 +    failures=$2
  34.286 +    output=$3
  34.287 +    reportfile=$4
  34.288 +    summary=summary.tmp
  34.289 +    echo "Making PASS/FAIL report ($passfail)..."
  34.290 +    cat $OUTPUT | egrep '(REASON|PASS|FAIL|XPASS|XFAIL|SKIP)' | perl -pe 's/^(PASS|FAIL|XPASS|XFAIL)(.+)$/$1$2\n/' > $passfail
  34.291 +    
  34.292 +    echo "Making FAIL report ($failures)..."
  34.293 +    cat $passfail | egrep '(REASON|FAIL)' > $failures
  34.294 +    
  34.295 +    NUMPASS=`grep -c PASS $output`
  34.296 +    NUMFAIL=`grep -c FAIL $output`
  34.297 +    NUMXPASS=`grep -c XPASS $output`
  34.298 +    NUMXFAIL=`grep -c XFAIL $output`
  34.299 +    cat > $summary << EOF
  34.300  Xm-test execution summary:
  34.301    PASS:  $NUMPASS
  34.302    FAIL:  $NUMFAIL
  34.303    XPASS: $NUMXPASS
  34.304    XFAIL: $NUMXFAIL
  34.305  EOF
  34.306 +    
  34.307 +    cat $summary > $reportfile
  34.308 +    
  34.309 +    echo -e '\n\nDetails:\n' >> $reportfile
  34.310 +    
  34.311 +    ./mkreport $passfail >> $reportfile
  34.312  
  34.313 -cat $SUMMARY > $REPORT
  34.314 +    rm $summary
  34.315 +}
  34.316  
  34.317 -echo -e '\n\nDetails:\n' >> $REPORT
  34.318 - 
  34.319 -./mkreport $PASSFAIL >> $REPORT
  34.320 +############
  34.321 +### Main ###
  34.322 +############
  34.323 +
  34.324 +# Defaults
  34.325 +MAXFAIL=10
  34.326 +report=yes
  34.327 +batch=no
  34.328 +run=yes
  34.329  
  34.330 -#
  34.331 -# Check to see if it's worth reporting these results
  34.332 -#
  34.333 -#if  [ "$batch"  =   "no" ] && 
  34.334 -#    [ "$report" =   "yes" ] && 
  34.335 -#    [ $NUMFAIL  -gt $MAXFAIL ]; then
  34.336 -#    echo "NOTE: $NUMFAIL tests failed, which may be erroneous.  It may"
  34.337 -#    echo "be a good idea to review the report before sending.  If you"
  34.338 -#    echo "choose not to submit the report, it will be saved for your review"
  34.339 -#    echo "and later submission."
  34.340 -#    echo
  34.341 -#    echo -n "Submit anyway? [y/n] "
  34.342 -#    read ANSWER
  34.343 -#    if [ "$ANSWER" = "n" ]; then
  34.344 -#	report=no
  34.345 -#    fi
  34.346 -#fi
  34.347 +# Resolve options
  34.348 +while [ $# -gt 0 ]
  34.349 +  do
  34.350 +  case "$1" in
  34.351 +      -d)
  34.352 +	  echo "(Skipping report submission)"
  34.353 +	  report=no
  34.354 +	  ;;
  34.355 +      -b)
  34.356 +	  echo "(Batch mode)"
  34.357 +	  batch=yes
  34.358 +	  ;;
  34.359 +      -e)
  34.360 +	  shift
  34.361 +	  echo $1 > contact_info
  34.362 +	  echo "(Email set to $1)"
  34.363 +	  ;;
  34.364 +      -q)
  34.365 +	  run=quick
  34.366 +	  ;;
  34.367 +      -s)
  34.368 +	  run=no
  34.369 +	  ;;
  34.370 +      *)
  34.371 +	  REPORT=$1
  34.372 +	  break
  34.373 +	  ;;
  34.374 +  esac
  34.375 +  shift
  34.376 +done
  34.377  
  34.378 -#
  34.379 -# Generate the XML result report
  34.380 -#
  34.381 -if ! ./lib/XmTestReport/ResultReport.py $OUTPUT > $RESULTREPORTTEMP; then
  34.382 -    echo "Unable to generate clean ResultReport"
  34.383 -    echo "Take a look at $RESULTREPORTTEMP"
  34.384 -    exit 1
  34.385 +# Usage
  34.386 +if [ -z $REPORT ]; then
  34.387 +	usage
  34.388 +	exit 1
  34.389  fi
  34.390  
  34.391 -#
  34.392 -# Maybe submit report and save the combined XML file
  34.393 -#
  34.394 -if [ "$report" = "yes" ]; then
  34.395 -    echo "Sending report..."
  34.396 -    ./lib/XmTestReport/Report.py -D $OSREPORTTEMP $PROGREPORTTEMP \
  34.397 -                                    $RESULTREPORTTEMP > $1.xml
  34.398 -    echo "Report also saved in $1.xml"
  34.399 -else
  34.400 -    echo "Saving report to $1.xml..."
  34.401 -    ./lib/XmTestReport/Report.py -d $OSREPORTTEMP $PROGREPORTTEMP \
  34.402 -                                    $RESULTREPORTTEMP > $1.xml
  34.403 +# Output files
  34.404 +OSREPORTTEMP=${REPORT}.os.xml
  34.405 +PROGREPORTTEMP=${REPORT}.prog.xml
  34.406 +RESULTREPORTTEMP=${REPORT}.result.xml
  34.407 +XMLREPORT=${REPORT}.xml
  34.408 +OUTPUT=${REPORT}.output
  34.409 +SUMMARY=${REPORT}.summary
  34.410 +PASSFAIL=${REPORT}.passfail
  34.411 +TXTREPORT=${REPORT}.report
  34.412 +FAILURES=${REPORT}.failures
  34.413 +	
  34.414 +#  Make sure permissions are correct
  34.415 +chmod a+x lib/XmTestReport/*
  34.416 +chmod a+x mkreport mergereport
  34.417 +
  34.418 +if [ ! -f contact_info ]; then
  34.419 +    if [ "$batch" = "yes" ]; then
  34.420 +	echo "Unable to read contact_info"
  34.421 +	echo "You must run me interactively once!"
  34.422 +	exit 1
  34.423 +    else
  34.424 +	get_contact_info
  34.425 +    fi
  34.426  fi
  34.427 +
  34.428 +if [ "$run" != "no" ]; then
  34.429 +    runnable_tests
  34.430 +    make_environment_report $OSREPORTTEMP $PROGREPORTTEMP
  34.431 +    if [ "$run" = "yes" ]; then
  34.432 +	run_tests $OUTPUT
  34.433 +    else
  34.434 +	run_tests_quick $OUTPUT
  34.435 +    fi
  34.436 +    make_text_reports $PASSFAIL $FAILURES $OUTPUT $TXTREPORT
  34.437 +    make_result_report $OUTPUT $RESULTREPORTTEMP
  34.438 +    cat $OSREPORTTEMP $PROGREPORTTEMP $RESULTREPORTTEMP > $XMLREPORT
  34.439 +    rm $OSREPORTTEMP $PROGREPORTTEMP $RESULTREPORTTEMP
  34.440 +fi
  34.441 +
  34.442 +if [ "$report" = "yes" ] && [ "$run" = "yes" ]; then
  34.443 +    if [ ! -f "$XMLREPORT" ]; then
  34.444 +	echo "No such file: $XMLREPORT"
  34.445 +	exit 1
  34.446 +    fi
  34.447 +    submit_report $XMLREPORT
  34.448 +fi
    35.1 --- a/tools/xm-test/tests/block-create/09_block_attach_and_dettach_device_check_data_pos.py	Thu Nov 10 11:43:24 2005 -0500
    35.2 +++ b/tools/xm-test/tests/block-create/09_block_attach_and_dettach_device_check_data_pos.py	Thu Nov 10 18:25:27 2005 +0100
    35.3 @@ -36,7 +36,9 @@ except ConsoleError, e:
    35.4      saveLog(console.getHistory())
    35.5      FAIL(str(e))
    35.6      
    35.7 -os.system("mkfs.ext2 -F /dev/ram1")
    35.8 +s, o = traceCommand("mke2fs -q -F /dev/ram1")
    35.9 +if s != 0:
   35.10 +    FAIL("mke2fs returned %i != 0" % s)
   35.11  
   35.12  for i in range(10):
   35.13  	status, output = traceCommand("xm block-attach %s phy:ram1 hda1 w" % domain.getName())
    36.1 --- a/tools/xm-test/tests/create/log	Thu Nov 10 11:43:24 2005 -0500
    36.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.3 @@ -1,14 +0,0 @@
    36.4 --- BEGIN XmTest Log @Fri Oct 28 13:00:55 PDT 2005
    36.5 -*input
    36.6 -
    36.7 -
    36.8 -BusyBox v1.01 (2005.10.27-17:34+0000) Built-in shell (ash)
    36.9 -Enter 'help' for a list of built-in commands.
   36.10 -
   36.11 --sh: can't access tty; job control turned off
   36.12 -*ls
   36.13 -CVS         etc         linuxrc     opt         sbin        var
   36.14 -bin         home        lost+found  proc        tmp
   36.15 -dev         lib         mnt         root        usr
   36.16 -
   36.17 --- END XmTest Log
    37.1 --- a/tools/xm-test/tests/restore/04_restore_withdevices_pos.py	Thu Nov 10 11:43:24 2005 -0500
    37.2 +++ b/tools/xm-test/tests/restore/04_restore_withdevices_pos.py	Thu Nov 10 18:25:27 2005 +0100
    37.3 @@ -5,13 +5,20 @@
    37.4  
    37.5  from XmTestLib import *
    37.6  
    37.7 -domain = XmTestDomain()
    37.8 +import re
    37.9 +
   37.10 +domain = XmTestDomain(extraOpts={"nics":2})
   37.11  
   37.12  domain.configAddDisk("phy:/dev/ram0", "hda1", "w")
   37.13 +domain.configAddDisk("phy:/dev/ram1", "hdb2", "w")
   37.14  
   37.15 -s, o = traceCommand("mkfs /dev/ram0")
   37.16 +s, o = traceCommand("mke2fs -q /dev/ram0")
   37.17  if s != 0:
   37.18 -    FAIL("Unable to mkfs /dev/ram0 in dom0")
   37.19 +    FAIL("Unable to mke2fs /dev/ram0 in dom0")
   37.20 +
   37.21 +s, o = traceCommand("mke2fs -q /dev/ram1")
   37.22 +if s != 0:
   37.23 +    FAIL("Unable to mke2fs /dev/ram1 in dom0")
   37.24  
   37.25  try:
   37.26      domain.start()
   37.27 @@ -22,13 +29,38 @@ try:
   37.28      console = XmConsole(domain.getName())
   37.29      console.sendInput("foo")
   37.30  
   37.31 -    run = console.runCmd("mount /dev/hda1 /mnt")
   37.32 +    run = console.runCmd("mkdir /mnt/a /mnt/b")
   37.33 +    if run["return"] != 0:
   37.34 +        FAIL("Unable to mkdir /mnt/a /mnt/b")
   37.35 +
   37.36 +    run = console.runCmd("mount /dev/hda1 /mnt/a")
   37.37      if run["return"] != 0:
   37.38          FAIL("Unable to mount /dev/hda1")
   37.39  
   37.40 -    run = console.runCmd("echo bar > /mnt/foo")
   37.41 +    run = console.runCmd("mount /dev/hdb2 /mnt/b")
   37.42 +    if run["return"] != 0:
   37.43 +        FAIL("Unable to mount /dev/hdb2")
   37.44 +
   37.45 +    run = console.runCmd("echo hda1 > /mnt/a/foo")
   37.46 +    if run["return"] != 0:
   37.47 +        FAIL("Unable to write to block device hda1!")
   37.48 +
   37.49 +    run = console.runCmd("echo hdb2 > /mnt/b/foo")
   37.50      if run["return"] != 0:
   37.51 -        FAIL("Unable to write to block device!")
   37.52 +        FAIL("Unable to write to block device hdb2!")
   37.53 +
   37.54 +    run = console.runCmd("ifconfig eth0 169.254.0.1 netmask 255.255.255.0")
   37.55 +    if run["return"] != 0:
   37.56 +        FAIL("Unable to configure DomU's eth0")
   37.57 +
   37.58 +    run = console.runCmd("ifconfig eth1 169.254.1.1 netmask 255.255.255.0")
   37.59 +    if run["return"] != 0:
   37.60 +        FAIL("Unable to configure DomU's eth1")
   37.61 +
   37.62 +    run = console.runCmd("ifconfig lo 127.0.0.1")
   37.63 +    if run["return"] != 0:
   37.64 +        FAIL("Unable to configure DomU's lo")
   37.65 +
   37.66  
   37.67  except ConsoleError, e:
   37.68      FAIL(str(e))
   37.69 @@ -63,9 +95,31 @@ try:
   37.70      if run["return"] != 0:
   37.71          FAIL("ls failed on restored domain")
   37.72      
   37.73 -    run = console.runCmd("cat /mnt/foo | grep bar")
   37.74 +    run = console.runCmd("cat /mnt/a/foo")
   37.75 +    if run["return"] != 0:
   37.76 +        FAIL("Unable to read from block device hda1")
   37.77 +    if not re.search("hda1", run["output"]):
   37.78 +        FAIL("Failed to read correct data from hda1")
   37.79 +
   37.80 +    run = console.runCmd("cat /mnt/b/foo")
   37.81      if run["return"] != 0:
   37.82 -        FAIL("Unable to read from block device")
   37.83 +        FAIL("Unable to read from block device hdb2")
   37.84 +    if not re.search("hdb2", run["output"]):
   37.85 +        FAIL("Failed to read correct data from hdb2")
   37.86 +
   37.87 +    run = console.runCmd("ifconfig")
   37.88 +    if not re.search("eth0", run["output"]):
   37.89 +        FAIL("DomU's eth0 disappeared")
   37.90 +    if not re.search("169.254.0.1", run["output"]):
   37.91 +        FAIL("DomU's eth0 lost its IP")
   37.92 +    if not re.search("eth1", run["output"]):
   37.93 +        FAIL("DomU's eth1 disappeared")
   37.94 +    if not re.search("169.254.1.1", run["output"]):
   37.95 +        FAIL("DomU's eth1 lost its IP")
   37.96 +    if not re.search("Loopback", run["output"]):
   37.97 +        FAIL("DomU's lo disappeared")
   37.98 +    if not re.search("127.0.0.1", run["output"]):
   37.99 +        FAIL("DomU's lo lost its IP")
  37.100  
  37.101  except ConsoleError, e:
  37.102      FAIL(str(e))
    38.1 --- a/xen/arch/x86/dm/vmx_vioapic.c	Thu Nov 10 11:43:24 2005 -0500
    38.2 +++ b/xen/arch/x86/dm/vmx_vioapic.c	Thu Nov 10 18:25:27 2005 +0100
    38.3 @@ -158,6 +158,14 @@ static unsigned long vmx_vioapic_read(st
    38.4      return result;
    38.5  }
    38.6  
    38.7 +static void vmx_vioapic_update_imr(struct vmx_vioapic *s, int index)
    38.8 +{
    38.9 +   if (s->redirtbl[index].RedirForm.mask)
   38.10 +       set_bit(index, &s->imr);
   38.11 +   else
   38.12 +       clear_bit(index, &s->imr);
   38.13 +}
   38.14 +
   38.15  static void vmx_vioapic_write_indirect(struct vmx_vioapic *s,
   38.16                                        unsigned long addr,
   38.17                                        unsigned long length,
   38.18 @@ -200,6 +208,7 @@ static void vmx_vioapic_write_indirect(s
   38.19                      redir_content = ((redir_content >> 32) << 32) |
   38.20                                      (val & 0xffffffff);
   38.21                  s->redirtbl[redir_index].value = redir_content;
   38.22 +                vmx_vioapic_update_imr(s, redir_index);
   38.23              } else  {
   38.24                  printk("vmx_vioapic_write_indirect "
   38.25                    "error register %x\n", s->ioregsel);
   38.26 @@ -264,8 +273,10 @@ static void vmx_vioapic_reset(vmx_vioapi
   38.27  
   38.28      memset(s, 0, sizeof(vmx_vioapic_t));
   38.29  
   38.30 -    for (i = 0; i < IOAPIC_NUM_PINS; i++)
   38.31 +    for (i = 0; i < IOAPIC_NUM_PINS; i++) {
   38.32          s->redirtbl[i].RedirForm.mask = 0x1;
   38.33 +        vmx_vioapic_update_imr(s, i);
   38.34 +    }
   38.35  }
   38.36  
   38.37  static void ioapic_update_config(vmx_vioapic_t *s,
   38.38 @@ -422,7 +433,13 @@ static void ioapic_deliver(vmx_vioapic_t
   38.39  
   38.40          target = apic_round_robin(
   38.41                  s->domain, dest_mode, vector, deliver_bitmask);
   38.42 -        ioapic_inj_irq(s, target, vector, trig_mode, delivery_mode);
   38.43 +        if (target)
   38.44 +            ioapic_inj_irq(s, target, vector, trig_mode, delivery_mode);
   38.45 +        else{
   38.46 +            VMX_DBG_LOG(DBG_LEVEL_IOAPIC, "ioapic deliver "
   38.47 +              "null round robin mask %x vector %x delivery_mode %x\n",
   38.48 +              deliver_bitmask, vector, deliver_bitmask);
   38.49 +        }
   38.50          break;
   38.51      }
   38.52  
   38.53 @@ -457,7 +474,7 @@ static int ioapic_get_highest_irq(vmx_vi
   38.54  
   38.55      ASSERT(s);
   38.56  
   38.57 -    irqs = s->irr & ~s->isr;
   38.58 +    irqs = s->irr & ~s->isr & ~s->imr;
   38.59      return __fls(irqs);
   38.60  }
   38.61  
   38.62 @@ -471,7 +488,7 @@ static void service_ioapic(vmx_vioapic_t
   38.63          VMX_DBG_LOG(DBG_LEVEL_IOAPIC, "service_ioapic "
   38.64            "highest irqno %x\n", irqno);
   38.65  
   38.66 -        if (!s->redirtbl[irqno].RedirForm.mask) {
   38.67 +        if (!test_bit(irqno, &s->imr)) {
   38.68              ioapic_deliver(s, irqno);
   38.69          }
   38.70  
   38.71 @@ -490,7 +507,7 @@ void vmx_vioapic_do_irqs(struct domain *
   38.72      if (!vmx_apic_support(d))
   38.73          return;
   38.74  
   38.75 -    s->irr |= irqs;
   38.76 +    s->irr |= irqs & ~s->imr;
   38.77      service_ioapic(s);
   38.78  }
   38.79  
   38.80 @@ -584,7 +601,9 @@ int vmx_vioapic_add_lapic(struct vlapic 
   38.81          domain_crash_synchronous();
   38.82      }
   38.83  
   38.84 -    s->lapic_info[s->lapic_count ++] = vlapic;
   38.85 +    /* update count later for race condition on interrupt */
   38.86 +    s->lapic_info[s->lapic_count] = vlapic;
   38.87 +    s->lapic_count ++;
   38.88  
   38.89      return s->lapic_count;
   38.90  }
    39.1 --- a/xen/arch/x86/domain.c	Thu Nov 10 11:43:24 2005 -0500
    39.2 +++ b/xen/arch/x86/domain.c	Thu Nov 10 18:25:27 2005 +0100
    39.3 @@ -407,6 +407,7 @@ int arch_set_info_guest(
    39.4          /* VMX uses the initially provided page tables as the P2M map. */
    39.5          if ( !pagetable_get_paddr(d->arch.phys_table) )
    39.6              d->arch.phys_table = v->arch.guest_table;
    39.7 +        v->arch.guest_table = mk_pagetable(0);
    39.8  
    39.9          /* Initialize monitor page table */
   39.10          v->arch.monitor_table = mk_pagetable(0);
   39.11 @@ -646,7 +647,7 @@ long do_switch_to_user(void)
   39.12  
   39.13      regs->rip    = stu.rip;
   39.14      regs->cs     = stu.cs | 3; /* force guest privilege */
   39.15 -    regs->rflags = stu.rflags;
   39.16 +    regs->rflags = (stu.rflags & ~(EF_IOPL|EF_VM)) | EF_IE;
   39.17      regs->rsp    = stu.rsp;
   39.18      regs->ss     = stu.ss | 3; /* force guest privilege */
   39.19  
    40.1 --- a/xen/arch/x86/setup.c	Thu Nov 10 11:43:24 2005 -0500
    40.2 +++ b/xen/arch/x86/setup.c	Thu Nov 10 18:25:27 2005 +0100
    40.3 @@ -430,6 +430,10 @@ void __init __start_xen(multiboot_info_t
    40.4      /* Sanity check for unwanted bloat of dom0_op_t structure. */
    40.5      BUG_ON(sizeof(((dom0_op_t *)0)->u) != sizeof(((dom0_op_t *)0)->u.pad));
    40.6  
    40.7 +    BUG_ON(sizeof(start_info_t) > PAGE_SIZE);
    40.8 +    BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
    40.9 +    BUG_ON(sizeof(vcpu_info_t) != (sizeof(unsigned long) * 4));
   40.10 +
   40.11      init_frametable();
   40.12  
   40.13      end_boot_allocator();
    41.1 --- a/xen/arch/x86/shadow32.c	Thu Nov 10 11:43:24 2005 -0500
    41.2 +++ b/xen/arch/x86/shadow32.c	Thu Nov 10 18:25:27 2005 +0100
    41.3 @@ -997,7 +997,8 @@ int __shadow_mode_enable(struct domain *
    41.4      if ( new_modes & SHM_log_dirty )
    41.5      {
    41.6          ASSERT( !d->arch.shadow_dirty_bitmap );
    41.7 -        d->arch.shadow_dirty_bitmap_size = (d->max_pages + 63) & ~63;
    41.8 +        d->arch.shadow_dirty_bitmap_size = 
    41.9 +            (d->shared_info->arch.max_pfn +  63) & ~63;
   41.10          d->arch.shadow_dirty_bitmap = 
   41.11              xmalloc_array(unsigned long, d->arch.shadow_dirty_bitmap_size /
   41.12                                           (8 * sizeof(unsigned long)));
   41.13 @@ -1287,34 +1288,28 @@ static int shadow_mode_table_op(
   41.14          d->arch.shadow_dirty_net_count   = 0;
   41.15          d->arch.shadow_dirty_block_count = 0;
   41.16   
   41.17 -        if ( (d->max_pages > sc->pages) || 
   41.18 -             (sc->dirty_bitmap == NULL) || 
   41.19 +        if ( (sc->dirty_bitmap == NULL) || 
   41.20               (d->arch.shadow_dirty_bitmap == NULL) )
   41.21          {
   41.22              rc = -EINVAL;
   41.23              break;
   41.24          }
   41.25 - 
   41.26 -        sc->pages = d->max_pages;
   41.27 +
   41.28 +        if(sc->pages > d->arch.shadow_dirty_bitmap_size)
   41.29 +            sc->pages = d->arch.shadow_dirty_bitmap_size; 
   41.30  
   41.31  #define chunk (8*1024) /* Transfer and clear in 1kB chunks for L1 cache. */
   41.32 -        for ( i = 0; i < d->max_pages; i += chunk )
   41.33 +        for ( i = 0; i < sc->pages; i += chunk )
   41.34          {
   41.35 -            int bytes = ((((d->max_pages - i) > chunk) ?
   41.36 -                          chunk : (d->max_pages - i)) + 7) / 8;
   41.37 +            int bytes = ((((sc->pages - i) > chunk) ?
   41.38 +                          chunk : (sc->pages - i)) + 7) / 8;
   41.39       
   41.40              if (copy_to_user(
   41.41                      sc->dirty_bitmap + (i/(8*sizeof(unsigned long))),
   41.42                      d->arch.shadow_dirty_bitmap +(i/(8*sizeof(unsigned long))),
   41.43                      bytes))
   41.44              {
   41.45 -                // copy_to_user can fail when copying to guest app memory.
   41.46 -                // app should zero buffer after mallocing, and pin it
   41.47                  rc = -EINVAL;
   41.48 -                memset(
   41.49 -                    d->arch.shadow_dirty_bitmap + 
   41.50 -                    (i/(8*sizeof(unsigned long))),
   41.51 -                    0, (d->max_pages/8) - (i/(8*sizeof(unsigned long))));
   41.52                  break;
   41.53              }
   41.54  
   41.55 @@ -1331,17 +1326,19 @@ static int shadow_mode_table_op(
   41.56          sc->stats.dirty_net_count   = d->arch.shadow_dirty_net_count;
   41.57          sc->stats.dirty_block_count = d->arch.shadow_dirty_block_count;
   41.58   
   41.59 -        if ( (d->max_pages > sc->pages) || 
   41.60 -             (sc->dirty_bitmap == NULL) || 
   41.61 +
   41.62 +        if ( (sc->dirty_bitmap == NULL) || 
   41.63               (d->arch.shadow_dirty_bitmap == NULL) )
   41.64          {
   41.65              rc = -EINVAL;
   41.66              break;
   41.67          }
   41.68   
   41.69 -        sc->pages = d->max_pages;
   41.70 -        if (copy_to_user(
   41.71 -            sc->dirty_bitmap, d->arch.shadow_dirty_bitmap, (d->max_pages+7)/8))
   41.72 +        if(sc->pages > d->arch.shadow_dirty_bitmap_size)
   41.73 +            sc->pages = d->arch.shadow_dirty_bitmap_size; 
   41.74 +
   41.75 +        if (copy_to_user(sc->dirty_bitmap, 
   41.76 +                         d->arch.shadow_dirty_bitmap, (sc->pages+7)/8))
   41.77          {
   41.78              rc = -EINVAL;
   41.79              break;
    42.1 --- a/xen/arch/x86/shadow_public.c	Thu Nov 10 11:43:24 2005 -0500
    42.2 +++ b/xen/arch/x86/shadow_public.c	Thu Nov 10 18:25:27 2005 +0100
    42.3 @@ -1009,7 +1009,8 @@ int __shadow_mode_enable(struct domain *
    42.4      if ( new_modes & SHM_log_dirty )
    42.5      {
    42.6          ASSERT( !d->arch.shadow_dirty_bitmap );
    42.7 -        d->arch.shadow_dirty_bitmap_size = (d->max_pages + 63) & ~63;
    42.8 +        d->arch.shadow_dirty_bitmap_size = 
    42.9 +            (d->shared_info->arch.max_pfn +  63) & ~63;
   42.10          d->arch.shadow_dirty_bitmap = 
   42.11              xmalloc_array(unsigned long, d->arch.shadow_dirty_bitmap_size /
   42.12                            (8 * sizeof(unsigned long)));
   42.13 @@ -1163,34 +1164,29 @@ static int shadow_mode_table_op(
   42.14          d->arch.shadow_dirty_net_count   = 0;
   42.15          d->arch.shadow_dirty_block_count = 0;
   42.16   
   42.17 -        if ( (d->max_pages > sc->pages) || 
   42.18 -             (sc->dirty_bitmap == NULL) || 
   42.19 +
   42.20 +        if ( (sc->dirty_bitmap == NULL) || 
   42.21               (d->arch.shadow_dirty_bitmap == NULL) )
   42.22          {
   42.23              rc = -EINVAL;
   42.24              break;
   42.25          }
   42.26 - 
   42.27 -        sc->pages = d->max_pages;
   42.28 +
   42.29 +        if(sc->pages > d->arch.shadow_dirty_bitmap_size)
   42.30 +            sc->pages = d->arch.shadow_dirty_bitmap_size; 
   42.31  
   42.32  #define chunk (8*1024) /* Transfer and clear in 1kB chunks for L1 cache. */
   42.33 -        for ( i = 0; i < d->max_pages; i += chunk )
   42.34 +        for ( i = 0; i < sc->pages; i += chunk )
   42.35          {
   42.36 -            int bytes = ((((d->max_pages - i) > chunk) ?
   42.37 -                          chunk : (d->max_pages - i)) + 7) / 8;
   42.38 +            int bytes = ((((sc->pages - i) > chunk) ?
   42.39 +                          chunk : (sc->pages - i)) + 7) / 8;
   42.40  
   42.41              if (copy_to_user(
   42.42                  sc->dirty_bitmap + (i/(8*sizeof(unsigned long))),
   42.43                  d->arch.shadow_dirty_bitmap +(i/(8*sizeof(unsigned long))),
   42.44                  bytes))
   42.45              {
   42.46 -                // copy_to_user can fail when copying to guest app memory.
   42.47 -                // app should zero buffer after mallocing, and pin it
   42.48                  rc = -EINVAL;
   42.49 -                memset(
   42.50 -                    d->arch.shadow_dirty_bitmap + 
   42.51 -                    (i/(8*sizeof(unsigned long))),
   42.52 -                    0, (d->max_pages/8) - (i/(8*sizeof(unsigned long))));
   42.53                  break;
   42.54              }
   42.55              memset(
   42.56 @@ -1206,17 +1202,18 @@ static int shadow_mode_table_op(
   42.57          sc->stats.dirty_net_count   = d->arch.shadow_dirty_net_count;
   42.58          sc->stats.dirty_block_count = d->arch.shadow_dirty_block_count;
   42.59   
   42.60 -        if ( (d->max_pages > sc->pages) || 
   42.61 -             (sc->dirty_bitmap == NULL) || 
   42.62 +        if ( (sc->dirty_bitmap == NULL) || 
   42.63               (d->arch.shadow_dirty_bitmap == NULL) )
   42.64          {
   42.65              rc = -EINVAL;
   42.66              break;
   42.67          }
   42.68   
   42.69 -        sc->pages = d->max_pages;
   42.70 -        if (copy_to_user(
   42.71 -            sc->dirty_bitmap, d->arch.shadow_dirty_bitmap, (d->max_pages+7)/8))
   42.72 +        if(sc->pages > d->arch.shadow_dirty_bitmap_size)
   42.73 +            sc->pages = d->arch.shadow_dirty_bitmap_size; 
   42.74 +
   42.75 +        if (copy_to_user(sc->dirty_bitmap, 
   42.76 +                         d->arch.shadow_dirty_bitmap, (sc->pages+7)/8))
   42.77          {
   42.78              rc = -EINVAL;
   42.79              break;
    43.1 --- a/xen/arch/x86/traps.c	Thu Nov 10 11:43:24 2005 -0500
    43.2 +++ b/xen/arch/x86/traps.c	Thu Nov 10 18:25:27 2005 +0100
    43.3 @@ -412,16 +412,16 @@ void propagate_page_fault(unsigned long 
    43.4      struct vcpu *v = current;
    43.5      struct trap_bounce *tb = &v->arch.trap_bounce;
    43.6  
    43.7 +    v->arch.guest_context.ctrlreg[2] = addr;
    43.8 +    v->vcpu_info->arch.cr2           = addr;
    43.9 +
   43.10      ti = &v->arch.guest_context.trap_ctxt[TRAP_page_fault];
   43.11 -    tb->flags = TBF_EXCEPTION | TBF_EXCEPTION_ERRCODE | TBF_EXCEPTION_CR2;
   43.12 -    tb->cr2        = addr;
   43.13 +    tb->flags = TBF_EXCEPTION | TBF_EXCEPTION_ERRCODE;
   43.14      tb->error_code = error_code;
   43.15      tb->cs         = ti->cs;
   43.16      tb->eip        = ti->address;
   43.17      if ( TI_GET_IF(ti) )
   43.18          tb->flags |= TBF_INTERRUPT;
   43.19 -
   43.20 -    v->arch.guest_context.ctrlreg[2] = addr;
   43.21  }
   43.22  
   43.23  static int handle_perdomain_mapping_fault(
   43.24 @@ -931,6 +931,7 @@ static int emulate_privileged_op(struct 
   43.25  
   43.26          case 2: /* Write CR2 */
   43.27              v->arch.guest_context.ctrlreg[2] = *reg;
   43.28 +            v->vcpu_info->arch.cr2           = *reg;
   43.29              break;
   43.30              
   43.31          case 3: /* Write CR3 */
    44.1 --- a/xen/arch/x86/vmx_vlapic.c	Thu Nov 10 11:43:24 2005 -0500
    44.2 +++ b/xen/arch/x86/vmx_vlapic.c	Thu Nov 10 18:25:27 2005 +0100
    44.3 @@ -119,22 +119,35 @@ uint32_t vlapic_update_ppr(struct vlapic
    44.4  }
    44.5  
    44.6  /* This only for fixed delivery mode */
    44.7 -int vlapic_match_dest(struct vlapic *target, struct vlapic *source,
    44.8 -                      int short_hand, int dest, int dest_mode,
    44.9 -                      int delivery_mode)
   44.10 +static int vlapic_match_dest(struct vcpu *v, struct vlapic *source,
   44.11 +                             int short_hand, int dest, int dest_mode,
   44.12 +                             int delivery_mode)
   44.13  {
   44.14      int result = 0;
   44.15 +    struct vlapic *target = VLAPIC(v);
   44.16  
   44.17      VMX_DBG_LOG(DBG_LEVEL_VLAPIC, "vlapic_match_dest: "
   44.18                  "target %p source %p dest %x dest_mode %x short_hand %x "
   44.19                  "delivery_mode %x",
   44.20                  target, source, dest, dest_mode, short_hand, delivery_mode);
   44.21  
   44.22 +    if ( unlikely(!target) &&
   44.23 +         ( (delivery_mode != VLAPIC_DELIV_MODE_INIT) &&
   44.24 +           (delivery_mode != VLAPIC_DELIV_MODE_STARTUP) &&
   44.25 +           (delivery_mode != VLAPIC_DELIV_MODE_NMI) )) {
   44.26 +        VMX_DBG_LOG(DBG_LEVEL_VLAPIC, "vlapic_match_dest "
   44.27 +                    "uninitialized target v %p delivery_mode %x dest %x\n",
   44.28 +                    v, delivery_mode, dest);
   44.29 +        return result;
   44.30 +    }
   44.31 +
   44.32      switch (short_hand) {
   44.33      case VLAPIC_NO_SHORTHAND:
   44.34          if (!dest_mode) {   /* Physical */
   44.35 -            result = (target->id == dest);
   44.36 +            result = ((target ? target->id : v->vcpu_id ) == dest);
   44.37          } else {            /* Logical */
   44.38 +            if (!target)
   44.39 +                break;
   44.40              if (((target->dest_format >> 28) & 0xf) == 0xf) {   /* Flat mode */
   44.41                  result = (target->logical_dest >> 24) & dest;
   44.42              } else {
   44.43 @@ -176,17 +189,18 @@ int vlapic_match_dest(struct vlapic *tar
   44.44   * Add a pending IRQ into lapic.
   44.45   * Return 1 if successfully added and 0 if discarded.
   44.46   */
   44.47 -int vlapic_accept_irq(struct vlapic *vlapic, int delivery_mode,
   44.48 -                      int vector, int level, int trig_mode)
   44.49 +static int vlapic_accept_irq(struct vcpu *v, int delivery_mode,
   44.50 +                             int vector, int level, int trig_mode)
   44.51  {
   44.52 -    int	result = 1;
   44.53 +    int	result = 0;
   44.54 +    struct vlapic *vlapic = VLAPIC(v);
   44.55  
   44.56      switch (delivery_mode) {
   44.57      case VLAPIC_DELIV_MODE_FIXED:
   44.58      case VLAPIC_DELIV_MODE_LPRI:
   44.59          /* FIXME add logic for vcpu on reset */
   44.60 -        if (!vlapic->vcpu || !vlapic_enabled(vlapic))
   44.61 -            return 0;
   44.62 +        if (unlikely(!vlapic || !vlapic_enabled(vlapic)))
   44.63 +            return result;
   44.64  
   44.65          if (test_and_set_bit(vector, &vlapic->irr[0])) {
   44.66              printk("<vlapic_accept_irq>"
   44.67 @@ -199,6 +213,7 @@ int vlapic_accept_irq(struct vlapic *vla
   44.68              }
   44.69          }
   44.70          evtchn_set_pending(vlapic->vcpu, iopacket_port(vlapic->domain));
   44.71 +        result = 1;
   44.72          break;
   44.73  
   44.74      case VLAPIC_DELIV_MODE_RESERVED:
   44.75 @@ -269,15 +284,12 @@ struct vlapic* apic_round_robin(struct d
   44.76  
   44.77      old = next = d->arch.vmx_platform.round_info[vector];
   44.78  
   44.79 -    next++;
   44.80 -    if (next == MAX_VIRT_CPUS || !d->vcpu[next])
   44.81 -        next = 0;
   44.82 -
   44.83      do {
   44.84          /* the vcpu array is arranged according to vcpu_id */
   44.85          if (test_bit(next, &bitmap)) {
   44.86              target = d->vcpu[next]->arch.arch_vmx.vlapic;
   44.87 -            if (!vlapic_enabled(target)) {
   44.88 +
   44.89 +            if (!target || !vlapic_enabled(target)) {
   44.90                  printk("warning: targe round robin local apic disabled\n");
   44.91                  /* XXX should we domain crash?? Or should we return NULL */
   44.92              }
   44.93 @@ -285,7 +297,9 @@ struct vlapic* apic_round_robin(struct d
   44.94          }
   44.95  
   44.96          next ++;
   44.97 -        if (next == MAX_VIRT_CPUS || !d->vcpu[next])
   44.98 +        if (!d->vcpu[next] ||
   44.99 +            !test_bit(_VCPUF_initialised, &d->vcpu[next]->vcpu_flags) ||
  44.100 +            next == MAX_VIRT_CPUS)
  44.101              next = 0;
  44.102      }while(next != old);
  44.103  
  44.104 @@ -319,7 +333,7 @@ int vlapic_check_vector(struct vlapic *v
  44.105  {
  44.106      if ((dm == VLAPIC_DELIV_MODE_FIXED) && (vector < 16)) {
  44.107          vlapic->err_status |= 0x40;
  44.108 -        vlapic_accept_irq(vlapic, VLAPIC_DELIV_MODE_FIXED,
  44.109 +        vlapic_accept_irq(vlapic->vcpu, VLAPIC_DELIV_MODE_FIXED,
  44.110            vlapic_lvt_vector(vlapic, VLAPIC_LVT_ERROR), 0, 0);
  44.111          printk("<vlapic_check_vector>: check fail\n");
  44.112          return 0;
  44.113 @@ -340,7 +354,6 @@ void vlapic_ipi(struct vlapic *vlapic)
  44.114  
  44.115      struct vlapic *target;
  44.116      struct vcpu *v = NULL;
  44.117 -    int result = 0;
  44.118      uint32_t lpr_map;
  44.119  
  44.120      VMX_DBG_LOG(DBG_LEVEL_VLAPIC, "vlapic_ipi: "
  44.121 @@ -352,32 +365,27 @@ void vlapic_ipi(struct vlapic *vlapic)
  44.122                  delivery_mode, vector);
  44.123  
  44.124      for_each_vcpu ( vlapic->domain, v ) {
  44.125 -        target = VLAPIC(v);
  44.126 -        if (vlapic_match_dest(target, vlapic, short_hand,
  44.127 +        if (vlapic_match_dest(v, vlapic, short_hand,
  44.128                                dest, dest_mode, delivery_mode)) {
  44.129              if (delivery_mode == VLAPIC_DELIV_MODE_LPRI) {
  44.130                  set_bit(v->vcpu_id, &lpr_map);
  44.131 -            }else
  44.132 -                result = vlapic_accept_irq(target, delivery_mode,
  44.133 -                  vector, level, trig_mode);
  44.134 +            } else
  44.135 +                vlapic_accept_irq(v, delivery_mode,
  44.136 +                                  vector, level, trig_mode);
  44.137          }
  44.138      }
  44.139  
  44.140      if (delivery_mode == VLAPIC_DELIV_MODE_LPRI) {
  44.141 -        extern struct vlapic*
  44.142 -          apic_round_robin(struct domain *d,
  44.143 -            uint8_t dest_mode, uint8_t vector, uint32_t bitmap);
  44.144 -
  44.145          v = vlapic->vcpu;
  44.146          target = apic_round_robin(v->domain, dest_mode, vector, lpr_map);
  44.147  
  44.148          if (target)
  44.149 -            vlapic_accept_irq(target, delivery_mode,
  44.150 -              vector, level, trig_mode);
  44.151 +            vlapic_accept_irq(target->vcpu, delivery_mode,
  44.152 +                              vector, level, trig_mode);
  44.153      }
  44.154  }
  44.155  
  44.156 -void vlapic_begin_timer(struct vlapic *vlapic)
  44.157 +static void vlapic_begin_timer(struct vlapic *vlapic)
  44.158  {
  44.159      s_time_t cur = NOW(), offset;
  44.160  
  44.161 @@ -737,12 +745,13 @@ static void vlapic_write(struct vcpu *v,
  44.162          vlapic->timer_current = val;
  44.163          vlapic->timer_current_update = NOW();
  44.164  
  44.165 +        vlapic_begin_timer(vlapic);
  44.166 +
  44.167          VMX_DBG_LOG(DBG_LEVEL_VLAPIC, "timer_init %x timer_current %x"
  44.168                      "timer_current_update %08x%08x",
  44.169                      vlapic->timer_initial, vlapic->timer_current,
  44.170                      (uint32_t)(vlapic->timer_current_update >> 32),
  44.171                      (uint32_t)vlapic->timer_current_update);
  44.172 -                    vlapic_begin_timer(vlapic);
  44.173          break;
  44.174  
  44.175      case APIC_TDCR:
  44.176 @@ -827,6 +836,7 @@ void vlapic_timer_fn(void *data)
  44.177          }
  44.178          else
  44.179              vlapic->intr_pending_count[vlapic_lvt_vector(vlapic, VLAPIC_LVT_TIMER)]++;
  44.180 +        evtchn_set_pending(vlapic->vcpu, iopacket_port(vlapic->domain));
  44.181      }
  44.182  
  44.183      vlapic->timer_current_update = NOW();
    45.1 --- a/xen/arch/x86/vmx_vmcs.c	Thu Nov 10 11:43:24 2005 -0500
    45.2 +++ b/xen/arch/x86/vmx_vmcs.c	Thu Nov 10 18:25:27 2005 +0100
    45.3 @@ -332,7 +332,7 @@ static void vmx_do_launch(struct vcpu *v
    45.4      error |= __vmwrite(GUEST_TR_BASE, 0);
    45.5      error |= __vmwrite(GUEST_TR_LIMIT, 0xff);
    45.6  
    45.7 -    __vmwrite(GUEST_CR3, pagetable_get_paddr(v->arch.guest_table));
    45.8 +    __vmwrite(GUEST_CR3, pagetable_get_paddr(v->domain->arch.phys_table));
    45.9      __vmwrite(HOST_CR3, pagetable_get_paddr(v->arch.monitor_table));
   45.10      __vmwrite(HOST_RSP, (unsigned long)get_stack_bottom());
   45.11  
    46.1 --- a/xen/arch/x86/x86_32/asm-offsets.c	Thu Nov 10 11:43:24 2005 -0500
    46.2 +++ b/xen/arch/x86/x86_32/asm-offsets.c	Thu Nov 10 18:25:27 2005 +0100
    46.3 @@ -75,7 +75,6 @@ void __dummy__(void)
    46.4      BLANK();
    46.5  
    46.6      OFFSET(TRAPBOUNCE_error_code, struct trap_bounce, error_code);
    46.7 -    OFFSET(TRAPBOUNCE_cr2, struct trap_bounce, cr2);
    46.8      OFFSET(TRAPBOUNCE_flags, struct trap_bounce, flags);
    46.9      OFFSET(TRAPBOUNCE_cs, struct trap_bounce, cs);
   46.10      OFFSET(TRAPBOUNCE_eip, struct trap_bounce, eip);
    47.1 --- a/xen/arch/x86/x86_32/entry.S	Thu Nov 10 11:43:24 2005 -0500
    47.2 +++ b/xen/arch/x86/x86_32/entry.S	Thu Nov 10 18:25:27 2005 +0100
    47.3 @@ -156,7 +156,7 @@ 1:
    47.4           * By this time, all the setups in the VMCS must be complete.
    47.5           */
    47.6          .if \launch
    47.7 -        /* VMLUANCH */
    47.8 +        /* VMLAUNCH */
    47.9          .byte 0x0f,0x01,0xc2
   47.10          pushf
   47.11          call vm_launch_fail
   47.12 @@ -394,37 +394,37 @@ FLT14:  movl %eax,%gs:(%esi)
   47.13          shll $16,%eax                    # Bits 16-23: saved_upcall_mask
   47.14          movw UREGS_cs+4(%esp),%ax        # Bits  0-15: CS
   47.15  FLT15:  movl %eax,%gs:4(%esi) 
   47.16 +        test $0x00FF0000,%eax            # Bits 16-23: saved_upcall_mask
   47.17 +        setz %ch                         # %ch == !saved_upcall_mask
   47.18          movl UREGS_eflags+4(%esp),%eax
   47.19 +        andl $~X86_EFLAGS_IF,%eax
   47.20 +        shlb $1,%ch                      # Bit 9 (EFLAGS.IF)
   47.21 +        orb  %ch,%ah                     # Fold EFLAGS.IF into %eax
   47.22  FLT16:  movl %eax,%gs:8(%esi)
   47.23          test $TBF_EXCEPTION_ERRCODE,%cl
   47.24          jz   1f
   47.25          subl $4,%esi                    # push error_code onto guest frame
   47.26          movl TRAPBOUNCE_error_code(%edx),%eax
   47.27  FLT17:  movl %eax,%gs:(%esi)
   47.28 -        testb $TBF_EXCEPTION_CR2,%cl
   47.29 -        jz   2f
   47.30 -        subl $4,%esi                    # push %cr2 onto guest frame
   47.31 -        movl TRAPBOUNCE_cr2(%edx),%eax
   47.32 -FLT18:  movl %eax,%gs:(%esi)
   47.33  1:      testb $TBF_FAILSAFE,%cl
   47.34          jz   2f
   47.35          subl $16,%esi                # add DS/ES/FS/GS to failsafe stack frame
   47.36          testl $X86_EFLAGS_VM,UREGS_eflags+4(%esp)
   47.37          jz   nvm86_2
   47.38          xorl %eax,%eax               # VM86: we write zero selector values
   47.39 -FLT19:  movl %eax,%gs:(%esi) 
   47.40 -FLT20:  movl %eax,%gs:4(%esi)
   47.41 -FLT21:  movl %eax,%gs:8(%esi) 
   47.42 -FLT22:  movl %eax,%gs:12(%esi)
   47.43 +FLT18:  movl %eax,%gs:(%esi) 
   47.44 +FLT19:  movl %eax,%gs:4(%esi)
   47.45 +FLT20:  movl %eax,%gs:8(%esi) 
   47.46 +FLT21:  movl %eax,%gs:12(%esi)
   47.47          jmp  2f
   47.48  nvm86_2:movl UREGS_ds+4(%esp),%eax   # non-VM86: write real selector values
   47.49 -FLT23:  movl %eax,%gs:(%esi) 
   47.50 +FLT22:  movl %eax,%gs:(%esi) 
   47.51          movl UREGS_es+4(%esp),%eax
   47.52 -FLT24:  movl %eax,%gs:4(%esi)
   47.53 +FLT23:  movl %eax,%gs:4(%esi)
   47.54          movl UREGS_fs+4(%esp),%eax
   47.55 -FLT25:  movl %eax,%gs:8(%esi) 
   47.56 +FLT24:  movl %eax,%gs:8(%esi) 
   47.57          movl UREGS_gs+4(%esp),%eax
   47.58 -FLT26:  movl %eax,%gs:12(%esi)
   47.59 +FLT25:  movl %eax,%gs:12(%esi)
   47.60  2:      testl $X86_EFLAGS_VM,UREGS_eflags+4(%esp)
   47.61          jz   nvm86_3
   47.62          xorl %eax,%eax      /* zero DS-GS, just as a real CPU would */
   47.63 @@ -456,7 +456,6 @@ nvm86_3:/* Rewrite our stack frame and r
   47.64          .long FLT20,domain_crash_synchronous , FLT21,domain_crash_synchronous
   47.65          .long FLT22,domain_crash_synchronous , FLT23,domain_crash_synchronous
   47.66          .long FLT24,domain_crash_synchronous , FLT25,domain_crash_synchronous
   47.67 -        .long FLT26,domain_crash_synchronous
   47.68  .previous
   47.69  
   47.70          ALIGN
    48.1 --- a/xen/arch/x86/x86_64/asm-offsets.c	Thu Nov 10 11:43:24 2005 -0500
    48.2 +++ b/xen/arch/x86/x86_64/asm-offsets.c	Thu Nov 10 18:25:27 2005 +0100
    48.3 @@ -75,7 +75,6 @@ void __dummy__(void)
    48.4      BLANK();
    48.5  
    48.6      OFFSET(TRAPBOUNCE_error_code, struct trap_bounce, error_code);
    48.7 -    OFFSET(TRAPBOUNCE_cr2, struct trap_bounce, cr2);
    48.8      OFFSET(TRAPBOUNCE_flags, struct trap_bounce, flags);
    48.9      OFFSET(TRAPBOUNCE_cs, struct trap_bounce, cs);
   48.10      OFFSET(TRAPBOUNCE_eip, struct trap_bounce, eip);
    49.1 --- a/xen/arch/x86/x86_64/entry.S	Thu Nov 10 11:43:24 2005 -0500
    49.2 +++ b/xen/arch/x86/x86_64/entry.S	Thu Nov 10 18:25:27 2005 +0100
    49.3 @@ -352,8 +352,6 @@ 1:      movb  TRAPBOUNCE_flags(%rdx),%cl
    49.4  FLT2:   movq  %rax,32(%rsi)             # SS
    49.5          movq  UREGS_rsp+8(%rsp),%rax
    49.6  FLT3:   movq  %rax,24(%rsi)             # RSP
    49.7 -        movq  UREGS_eflags+8(%rsp),%rax
    49.8 -FLT4:   movq  %rax,16(%rsi)             # RFLAGS
    49.9          movq  VCPU_vcpu_info(%rbx),%rax
   49.10          pushq VCPUINFO_upcall_mask(%rax)
   49.11          testb $TBF_INTERRUPT,%cl
   49.12 @@ -362,7 +360,15 @@ FLT4:   movq  %rax,16(%rsi)             
   49.13          popq  %rax
   49.14          shlq  $32,%rax                  # Bits 32-39: saved_upcall_mask
   49.15          movw  UREGS_cs+8(%rsp),%ax      # Bits  0-15: CS
   49.16 -FLT5:   movq  %rax,8(%rsi)              # CS/saved_upcall_mask
   49.17 +FLT4:   movq  %rax,8(%rsi)              # CS / saved_upcall_mask
   49.18 +        shrq  $32,%rax
   49.19 +        testb $0xFF,%al                 # Bits 0-7: saved_upcall_mask
   49.20 +        setz  %ch                       # %ch == !saved_upcall_mask
   49.21 +        movq  UREGS_eflags+8(%rsp),%rax
   49.22 +        andq  $~X86_EFLAGS_IF,%rax
   49.23 +        shlb  $1,%ch                    # Bit 9 (EFLAGS.IF)
   49.24 +        orb   %ch,%ah                   # Fold EFLAGS.IF into %eax
   49.25 +FLT5:   movq  %rax,16(%rsi)             # RFLAGS
   49.26          movq  UREGS_rip+8(%rsp),%rax
   49.27  FLT6:   movq  %rax,(%rsi)               # RIP
   49.28          testb $TBF_EXCEPTION_ERRCODE,%cl
   49.29 @@ -370,27 +376,22 @@ FLT6:   movq  %rax,(%rsi)               
   49.30          subq  $8,%rsi
   49.31          movl  TRAPBOUNCE_error_code(%rdx),%eax
   49.32  FLT7:   movq  %rax,(%rsi)               # ERROR CODE
   49.33 -        testb $TBF_EXCEPTION_CR2,%cl
   49.34 -        jz    2f
   49.35 -        subq  $8,%rsi
   49.36 -        movq  TRAPBOUNCE_cr2(%rdx),%rax
   49.37 -FLT8:   movq  %rax,(%rsi)               # CR2
   49.38  1:      testb $TBF_FAILSAFE,%cl
   49.39          jz    2f
   49.40          subq  $32,%rsi
   49.41          movl  %gs,%eax
   49.42 -FLT9:   movq  %rax,24(%rsi)             # GS
   49.43 +FLT8:   movq  %rax,24(%rsi)             # GS
   49.44          movl  %fs,%eax
   49.45 -FLT10:  movq  %rax,16(%rsi)             # FS
   49.46 +FLT9:   movq  %rax,16(%rsi)             # FS
   49.47          movl  %es,%eax
   49.48 -FLT11:  movq  %rax,8(%rsi)              # ES
   49.49 +FLT10:  movq  %rax,8(%rsi)              # ES
   49.50          movl  %ds,%eax
   49.51 -FLT12:  movq  %rax,(%rsi)               # DS
   49.52 +FLT11:  movq  %rax,(%rsi)               # DS
   49.53  2:      subq  $16,%rsi
   49.54          movq  UREGS_r11+8(%rsp),%rax
   49.55 -FLT13:  movq  %rax,8(%rsi)              # R11
   49.56 +FLT12:  movq  %rax,8(%rsi)              # R11
   49.57          movq  UREGS_rcx+8(%rsp),%rax
   49.58 -FLT14:  movq  %rax,(%rsi)               # RCX
   49.59 +FLT13:  movq  %rax,(%rsi)               # RCX
   49.60          /* Rewrite our stack frame and return to guest-OS mode. */
   49.61          /* IA32 Ref. Vol. 3: TF, VM, RF and NT flags are cleared on trap. */
   49.62          movl  $TRAP_syscall,UREGS_entry_vector+8(%rsp)
   49.63 @@ -411,7 +412,6 @@ FLT14:  movq  %rax,(%rsi)               
   49.64          .quad  FLT8,domain_crash_synchronous ,  FLT9,domain_crash_synchronous
   49.65          .quad FLT10,domain_crash_synchronous , FLT11,domain_crash_synchronous
   49.66          .quad FLT12,domain_crash_synchronous , FLT13,domain_crash_synchronous
   49.67 -        .quad FLT14,domain_crash_synchronous
   49.68  .previous
   49.69  
   49.70          ALIGN
    50.1 --- a/xen/include/asm-x86/domain.h	Thu Nov 10 11:43:24 2005 -0500
    50.2 +++ b/xen/include/asm-x86/domain.h	Thu Nov 10 18:25:27 2005 +0100
    50.3 @@ -8,7 +8,6 @@
    50.4  
    50.5  struct trap_bounce {
    50.6      unsigned long  error_code;
    50.7 -    unsigned long  cr2;
    50.8      unsigned short flags; /* TBF_ */
    50.9      unsigned short cs;
   50.10      unsigned long  eip;
    51.1 --- a/xen/include/asm-x86/processor.h	Thu Nov 10 11:43:24 2005 -0500
    51.2 +++ b/xen/include/asm-x86/processor.h	Thu Nov 10 18:25:27 2005 +0100
    51.3 @@ -121,7 +121,6 @@
    51.4  /* 'trap_bounce' flags values */
    51.5  #define TBF_EXCEPTION          1
    51.6  #define TBF_EXCEPTION_ERRCODE  2
    51.7 -#define TBF_EXCEPTION_CR2      4
    51.8  #define TBF_INTERRUPT          8
    51.9  #define TBF_FAILSAFE          16
   51.10  
    52.1 --- a/xen/include/asm-x86/vmx_vioapic.h	Thu Nov 10 11:43:24 2005 -0500
    52.2 +++ b/xen/include/asm-x86/vmx_vioapic.h	Thu Nov 10 18:25:27 2005 +0100
    52.3 @@ -92,9 +92,10 @@ typedef union RedirStatus
    52.4  #define MAX_LAPIC_NUM        32
    52.5  
    52.6  typedef struct vmx_vioapic {
    52.7 -    uint32_t ioregsel;
    52.8      uint32_t irr;
    52.9      uint32_t isr;           /* This is used for level trigger */
   52.10 +    uint32_t imr;
   52.11 +    uint32_t ioregsel;
   52.12      uint32_t flags;
   52.13      uint32_t lapic_count;
   52.14      uint32_t id;
    53.1 --- a/xen/include/public/arch-ia64.h	Thu Nov 10 11:43:24 2005 -0500
    53.2 +++ b/xen/include/public/arch-ia64.h	Thu Nov 10 18:25:27 2005 +0100
    53.3 @@ -271,12 +271,10 @@ typedef struct {
    53.4  
    53.5  typedef mapped_regs_t vpd_t;
    53.6  
    53.7 -#define __ARCH_HAS_VCPU_INFO
    53.8 -
    53.9  typedef struct {
   53.10      unsigned int flags;
   53.11      unsigned long start_info_pfn;
   53.12 -} arch_shared_info_t;  // DON'T PACK 
   53.13 +} arch_shared_info_t;
   53.14  
   53.15  typedef struct vcpu_guest_context {
   53.16  #define VGCF_FPU_VALID (1<<0)
    54.1 --- a/xen/include/public/arch-x86_32.h	Thu Nov 10 11:43:24 2005 -0500
    54.2 +++ b/xen/include/public/arch-x86_32.h	Thu Nov 10 18:25:27 2005 +0100
    54.3 @@ -90,7 +90,7 @@ typedef struct cpu_user_regs {
    54.4      uint16_t cs;
    54.5      uint8_t  saved_upcall_mask;
    54.6      uint8_t  _pad0;
    54.7 -    uint32_t eflags;
    54.8 +    uint32_t eflags;        /* eflags.IF == !saved_upcall_mask */
    54.9      uint32_t esp;
   54.10      uint16_t ss, _pad1;
   54.11      uint16_t es, _pad2;
   54.12 @@ -132,6 +132,11 @@ typedef struct arch_shared_info {
   54.13      unsigned long pfn_to_mfn_frame_list_list; 
   54.14  } arch_shared_info_t;
   54.15  
   54.16 +typedef struct {
   54.17 +    unsigned long cr2;
   54.18 +    unsigned long pad; /* sizeof(vcpu_info_t) == 16 */
   54.19 +} arch_vcpu_info_t;
   54.20 +
   54.21  #endif
   54.22  
   54.23  #endif
    55.1 --- a/xen/include/public/arch-x86_64.h	Thu Nov 10 11:43:24 2005 -0500
    55.2 +++ b/xen/include/public/arch-x86_64.h	Thu Nov 10 18:25:27 2005 +0100
    55.3 @@ -154,7 +154,7 @@ typedef struct cpu_user_regs {
    55.4      uint16_t cs, _pad0[1];
    55.5      uint8_t  saved_upcall_mask;
    55.6      uint8_t  _pad1[3];
    55.7 -    __DECL_REG(flags);
    55.8 +    __DECL_REG(flags);      /* rflags.IF == !saved_upcall_mask */
    55.9      __DECL_REG(sp);
   55.10      uint16_t ss, _pad2[3];
   55.11      uint16_t es, _pad3[3];
   55.12 @@ -201,6 +201,11 @@ typedef struct arch_shared_info {
   55.13      unsigned long pfn_to_mfn_frame_list_list; 
   55.14  } arch_shared_info_t;
   55.15  
   55.16 +typedef struct {
   55.17 +    unsigned long cr2;
   55.18 +    unsigned long pad; /* sizeof(vcpu_info_t) == 32 */
   55.19 +} arch_vcpu_info_t;
   55.20 +
   55.21  #endif /* !__ASSEMBLY__ */
   55.22  
   55.23  #endif
    56.1 --- a/xen/include/public/dom0_ops.h	Thu Nov 10 11:43:24 2005 -0500
    56.2 +++ b/xen/include/public/dom0_ops.h	Thu Nov 10 18:25:27 2005 +0100
    56.3 @@ -19,7 +19,7 @@
    56.4   * This makes sure that old versions of dom0 tools will stop working in a
    56.5   * well-defined way (rather than crashing the machine, for instance).
    56.6   */
    56.7 -#define DOM0_INTERFACE_VERSION   0xAAAA1011
    56.8 +#define DOM0_INTERFACE_VERSION   0xAAAA1012
    56.9  
   56.10  /************************************************************************/
   56.11  
    57.1 --- a/xen/include/public/xen.h	Thu Nov 10 11:43:24 2005 -0500
    57.2 +++ b/xen/include/public/xen.h	Thu Nov 10 18:25:27 2005 +0100
    57.3 @@ -299,9 +299,7 @@ typedef struct vcpu_info {
    57.4      uint8_t evtchn_upcall_pending;
    57.5      uint8_t evtchn_upcall_mask;
    57.6      unsigned long evtchn_pending_sel;
    57.7 -#ifdef __ARCH_HAS_VCPU_INFO
    57.8      arch_vcpu_info_t arch;
    57.9 -#endif
   57.10  } vcpu_info_t;
   57.11  
   57.12  typedef struct vcpu_time_info {