direct-io.hg

changeset 7714:5823dbfbb4cd

Move linear faulting address (%cr2) out of the page fault
stack frame and into vcpu_info_t (in shared_info_t). This
makes the guest #PF handler much more similar to native.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Nov 09 17:23:46 2005 +0100 (2005-11-09)
parents 136b2d20dc81
children 8f83f7ccf185
files linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S linux-2.6-xen-sparse/arch/xen/x86_64/kernel/traps.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/xen_entry.S linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c xen/arch/x86/setup.c xen/arch/x86/traps.c xen/arch/x86/x86_32/asm-offsets.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_64/asm-offsets.c xen/arch/x86/x86_64/entry.S xen/include/asm-x86/domain.h xen/include/asm-x86/processor.h xen/include/public/arch-ia64.h xen/include/public/arch-x86_32.h xen/include/public/arch-x86_64.h xen/include/public/dom0_ops.h xen/include/public/xen.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S	Wed Nov 09 16:08:37 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S	Wed Nov 09 17:23:46 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	Wed Nov 09 16:08:37 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c	Wed Nov 09 17:23:46 2005 +0100
     2.3 @@ -972,7 +972,7 @@ void __init trap_init_f00f_bug(void)
     2.4  
     2.5  
     2.6  /*
     2.7 - * NB. All these are "trap gates" (i.e. events_mask isn't cleared) except
     2.8 + * NB. All these are "trap gates" (i.e. events_mask isn't set) except
     2.9   * for those that specify <dpl>|4 in the second field.
    2.10   */
    2.11  static trap_info_t trap_table[] = {
    2.12 @@ -988,7 +988,7 @@ static trap_info_t trap_table[] = {
    2.13  	{ 11, 0, __KERNEL_CS, (unsigned long)segment_not_present	},
    2.14  	{ 12, 0, __KERNEL_CS, (unsigned long)stack_segment		},
    2.15  	{ 13, 0, __KERNEL_CS, (unsigned long)general_protection		},
    2.16 -	{ 14, 0, __KERNEL_CS, (unsigned long)page_fault			},
    2.17 +	{ 14, 0|4, __KERNEL_CS, (unsigned long)page_fault		},
    2.18  	{ 15, 0, __KERNEL_CS, (unsigned long)fixup_4gb_segment		},
    2.19  	{ 16, 0, __KERNEL_CS, (unsigned long)coprocessor_error		},
    2.20  	{ 17, 0, __KERNEL_CS, (unsigned long)alignment_check		},
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c	Wed Nov 09 16:08:37 2005 +0100
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c	Wed Nov 09 17:23:46 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,10 @@ 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 +
    3.30  	/* It's safe to allow irq's after cr2 has been saved */
    3.31 -	if (regs->eflags & (X86_EFLAGS_IF|VM_MASK))
    3.32 +	if ((uint8_t)(regs->xcs >> 16) == 0)
    3.33  		local_irq_enable();
    3.34 -#endif
    3.35  
    3.36  	tsk = current;
    3.37  
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S	Wed Nov 09 16:08:37 2005 +0100
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S	Wed Nov 09 17:23:46 2005 +0100
     4.3 @@ -874,42 +874,8 @@ 1:      RESTORE_ARGS
     4.4  	ret
     4.5  	CFI_ENDPROC
     4.6  
     4.7 -
     4.8 - /*
     4.9 - * Copy error_entry because of the different stack frame
    4.10 - */                        
    4.11  ENTRY(page_fault)
    4.12 -        movq (%rsp),%rcx
    4.13 -        movq 8(%rsp),%r11
    4.14 -        addq $0x10,%rsp         # now %rsp points to %cr2
    4.15 -        pushq %rax
    4.16 -        leaq do_page_fault(%rip),%rax
    4.17 -	cld	
    4.18 -	subq  $13*8,%rsp
    4.19 -	movq %rdx,12*8(%rsp)    # save %rdx
    4.20 -	movq 13*8(%rsp),%rdx	# load rax
    4.21 -	movq %rcx,11*8(%rsp)
    4.22 -	movq %rdx,10*8(%rsp)	# store rax
    4.23 -        movq %rsi,13*8(%rsp)    # now save %rsi
    4.24 -        movq 14*8(%rsp),%rdx    # load %cr2, 3rd argument
    4.25 -	movq %r8, 9*8(%rsp)
    4.26 -	movq %r9, 8*8(%rsp)
    4.27 -	movq %r10,7*8(%rsp)
    4.28 -	movq %r11,6*8(%rsp)
    4.29 -	movq %rbx,5*8(%rsp) 
    4.30 -	movq %rbp,4*8(%rsp) 
    4.31 -	movq %r12,3*8(%rsp) 
    4.32 -	movq %r13,2*8(%rsp) 
    4.33 -	movq %r14,1*8(%rsp) 
    4.34 -	movq %r15,(%rsp)
    4.35 -#if 0        
    4.36 -	cmpl $__KERNEL_CS,CS(%rsp)
    4.37 -	je  error_kernelspace
    4.38 -#endif
    4.39 -        /*
    4.40 -         * 1st and 2nd arguments are set by error_call_handler
    4.41 -         */
    4.42 -        jmp error_call_handler
    4.43 +	errorentry do_page_fault
    4.44  
    4.45  ENTRY(coprocessor_error)
    4.46  	zeroentry do_coprocessor_error
    4.47 @@ -948,24 +914,15 @@ ENTRY(nmi)
    4.48  paranoid_exit:
    4.49  	testl %ebx,%ebx				/* swapgs needed? */
    4.50  	jnz paranoid_restore
    4.51 +	testl $3,CS(%rsp)
    4.52 +	jnz   paranoid_userspace
    4.53  paranoid_swapgs:	
    4.54 -/*	swapgs */
    4.55 +	swapgs
    4.56  paranoid_restore:	
    4.57  	RESTORE_ALL 8
    4.58 -/*	iretq */
    4.59 +	iretq
    4.60  paranoid_userspace:	
    4.61  	GET_THREAD_INFO(%rcx)
    4.62 -#	movl threadinfo_flags(%rcx),%edx
    4.63 -#	testl $_TIF_NEED_RESCHED,%edx
    4.64 -#	jnz paranoid_resched
    4.65 -#	testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx
    4.66 -#	jnz paranoid_signal
    4.67 -#	jmp paranoid_swapgs
    4.68 -#paranoid_resched:		
    4.69 -#/*	sti */
    4.70 -#	call schedule
    4.71 -#	jmp paranoid_exit
    4.72 -#paranoid_signal:		
    4.73  	movl threadinfo_flags(%rcx),%ebx
    4.74  	andl $_TIF_WORK_MASK,%ebx
    4.75  	jz paranoid_swapgs
    4.76 @@ -975,13 +932,10 @@ paranoid_userspace:
    4.77  	testl $_TIF_NEED_RESCHED,%ebx
    4.78  	jnz paranoid_schedule
    4.79  	movl %ebx,%edx			/* arg3: thread flags */
    4.80 -/*	sti */
    4.81 -#	xorl %esi,%esi /* oldset */
    4.82 -#	movq %rsp,%rdi /* &pt_regs */
    4.83 +	sti
    4.84  	xorl %esi,%esi 			/* arg2: oldset */
    4.85  	movq %rsp,%rdi 			/* arg1: &pt_regs */
    4.86  	call do_notify_resume
    4.87 -#	jmp paranoid_exit
    4.88  	cli
    4.89  	jmp paranoid_userspace
    4.90  paranoid_schedule:
    4.91 @@ -1057,4 +1011,3 @@ ENTRY(machine_check)
    4.92  ENTRY(call_debug)
    4.93         zeroentry do_call_debug
    4.94  
    4.95 -
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/traps.c	Wed Nov 09 16:08:37 2005 +0100
     5.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/traps.c	Wed Nov 09 17:23:46 2005 +0100
     5.3 @@ -89,7 +89,7 @@ int register_die_notifier(struct notifie
     5.4  
     5.5  static inline void conditional_sti(struct pt_regs *regs)
     5.6  {
     5.7 -	if (regs->eflags & X86_EFLAGS_IF)
     5.8 +	if ((uint8_t)(regs->cs >> 32) == 0)
     5.9  		local_irq_enable();
    5.10  }
    5.11  
    5.12 @@ -905,30 +905,33 @@ void do_call_debug(struct pt_regs *regs)
    5.13  }
    5.14  
    5.15  
    5.16 +/*
    5.17 + * NB. All these are "interrupt gates" (i.e. events_mask is set) because we
    5.18 + * specify <dpl>|4 in the second field.
    5.19 + */
    5.20  static trap_info_t trap_table[] = {
    5.21 -        {  0, 0, (__KERNEL_CS|0x3), (unsigned long)divide_error               },
    5.22 -        {  1, 0, (__KERNEL_CS|0x3), (unsigned long)debug                      },
    5.23 -        {  3, 3, (__KERNEL_CS|0x3), (unsigned long)int3                       },
    5.24 -        {  4, 3, (__KERNEL_CS|0x3), (unsigned long)overflow                   },
    5.25 -        {  5, 3, (__KERNEL_CS|0x3), (unsigned long)bounds                     },
    5.26 -        {  6, 0, (__KERNEL_CS|0x3), (unsigned long)invalid_op                 },
    5.27 -        {  7, 0, (__KERNEL_CS|0x3), (unsigned long)device_not_available       },
    5.28 -        {  9, 0, (__KERNEL_CS|0x3), (unsigned long)coprocessor_segment_overrun},
    5.29 -        { 10, 0, (__KERNEL_CS|0x3), (unsigned long)invalid_TSS                },
    5.30 -        { 11, 0, (__KERNEL_CS|0x3), (unsigned long)segment_not_present        },
    5.31 -        { 12, 0, (__KERNEL_CS|0x3), (unsigned long)stack_segment              },
    5.32 -        { 13, 0, (__KERNEL_CS|0x3), (unsigned long)general_protection         },
    5.33 -        { 14, 0, (__KERNEL_CS|0x3), (unsigned long)page_fault                 },
    5.34 -        { 15, 0, (__KERNEL_CS|0x3), (unsigned long)spurious_interrupt_bug     },
    5.35 -        { 16, 0, (__KERNEL_CS|0x3), (unsigned long)coprocessor_error          },
    5.36 -        { 17, 0, (__KERNEL_CS|0x3), (unsigned long)alignment_check            },
    5.37 +        {  0, 0|4, (__KERNEL_CS|0x3), (unsigned long)divide_error               },
    5.38 +        {  1, 0|4, (__KERNEL_CS|0x3), (unsigned long)debug                      },
    5.39 +        {  3, 3|4, (__KERNEL_CS|0x3), (unsigned long)int3                       },
    5.40 +        {  4, 3|4, (__KERNEL_CS|0x3), (unsigned long)overflow                   },
    5.41 +        {  5, 3|4, (__KERNEL_CS|0x3), (unsigned long)bounds                     },
    5.42 +        {  6, 0|4, (__KERNEL_CS|0x3), (unsigned long)invalid_op                 },
    5.43 +        {  7, 0|4, (__KERNEL_CS|0x3), (unsigned long)device_not_available       },
    5.44 +        {  9, 0|4, (__KERNEL_CS|0x3), (unsigned long)coprocessor_segment_overrun},
    5.45 +        { 10, 0|4, (__KERNEL_CS|0x3), (unsigned long)invalid_TSS                },
    5.46 +        { 11, 0|4, (__KERNEL_CS|0x3), (unsigned long)segment_not_present        },
    5.47 +        { 12, 0|4, (__KERNEL_CS|0x3), (unsigned long)stack_segment              },
    5.48 +        { 13, 0|4, (__KERNEL_CS|0x3), (unsigned long)general_protection         },
    5.49 +        { 14, 0|4, (__KERNEL_CS|0x3), (unsigned long)page_fault                 },
    5.50 +        { 15, 0|4, (__KERNEL_CS|0x3), (unsigned long)spurious_interrupt_bug     },
    5.51 +        { 16, 0|4, (__KERNEL_CS|0x3), (unsigned long)coprocessor_error          },
    5.52 +        { 17, 0|4, (__KERNEL_CS|0x3), (unsigned long)alignment_check            },
    5.53  #ifdef CONFIG_X86_MCE
    5.54 -        { 18, 0, (__KERNEL_CS|0x3), (unsigned long)machine_check              },
    5.55 +        { 18, 0|4, (__KERNEL_CS|0x3), (unsigned long)machine_check              },
    5.56  #endif
    5.57 -        { 19, 0, (__KERNEL_CS|0x3), (unsigned long)simd_coprocessor_error     },
    5.58 -        { SYSCALL_VECTOR, 3, (__KERNEL_CS|0x3), (unsigned long)system_call   },
    5.59 +        { 19, 0|4, (__KERNEL_CS|0x3), (unsigned long)simd_coprocessor_error     },
    5.60  #ifdef CONFIG_IA32_EMULATION
    5.61 -	{ IA32_SYSCALL_VECTOR, 3, (__KERNEL_CS|0x3), (unsigned long)ia32_syscall},
    5.62 +	{ IA32_SYSCALL_VECTOR, 3|4, (__KERNEL_CS|0x3), (unsigned long)ia32_syscall},
    5.63  #endif
    5.64          {  0, 0,           0, 0                                              }
    5.65  };
     6.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/xen_entry.S	Wed Nov 09 16:08:37 2005 +0100
     6.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/xen_entry.S	Wed Nov 09 17:23:46 2005 +0100
     6.3 @@ -5,7 +5,7 @@
     6.4  #define evtchn_upcall_pending		0
     6.5  #define evtchn_upcall_mask		1
     6.6  
     6.7 -#define sizeof_vcpu_shift		4
     6.8 +#define sizeof_vcpu_shift		5
     6.9  
    6.10  #ifdef CONFIG_SMP
    6.11  //#define preempt_disable(reg)	incl threadinfo_preempt_count(reg)
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c	Wed Nov 09 16:08:37 2005 +0100
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c	Wed Nov 09 17:23:46 2005 +0100
     7.3 @@ -318,12 +318,12 @@ int exception_trace = 1;
     7.4   *	bit 2 == 0 means kernel, 1 means user-mode
     7.5   *      bit 3 == 1 means fault was an instruction fetch
     7.6   */
     7.7 -asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code,
     7.8 -       unsigned long address)
     7.9 +asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code)
    7.10  {
    7.11  	struct task_struct *tsk;
    7.12  	struct mm_struct *mm;
    7.13  	struct vm_area_struct * vma;
    7.14 +	unsigned long address;
    7.15  	const struct exception_table_entry *fixup;
    7.16  	int write;
    7.17  	siginfo_t info;
    7.18 @@ -342,11 +342,16 @@ asmlinkage void do_page_fault(struct pt_
    7.19  		}
    7.20  	}
    7.21  #endif
    7.22 +
    7.23 +	/* get the address */
    7.24 +	address = HYPERVISOR_shared_info->vcpu_data[
    7.25 +		smp_processor_id()].arch.cr2;
    7.26 +
    7.27  	if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
    7.28  					SIGSEGV) == NOTIFY_STOP)
    7.29  		return;
    7.30  
    7.31 -	if (likely(regs->eflags & X86_EFLAGS_IF))
    7.32 +	if (likely((uint8_t)(regs->cs >> 32) == 0))
    7.33  		local_irq_enable();
    7.34  
    7.35  	if (unlikely(page_fault_trace))
     8.1 --- a/xen/arch/x86/setup.c	Wed Nov 09 16:08:37 2005 +0100
     8.2 +++ b/xen/arch/x86/setup.c	Wed Nov 09 17:23:46 2005 +0100
     8.3 @@ -430,6 +430,10 @@ void __init __start_xen(multiboot_info_t
     8.4      /* Sanity check for unwanted bloat of dom0_op_t structure. */
     8.5      BUG_ON(sizeof(((dom0_op_t *)0)->u) != sizeof(((dom0_op_t *)0)->u.pad));
     8.6  
     8.7 +    BUG_ON(sizeof(start_info_t) > PAGE_SIZE);
     8.8 +    BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
     8.9 +    BUG_ON(sizeof(vcpu_info_t) != (sizeof(unsigned long) * 4));
    8.10 +
    8.11      init_frametable();
    8.12  
    8.13      end_boot_allocator();
     9.1 --- a/xen/arch/x86/traps.c	Wed Nov 09 16:08:37 2005 +0100
     9.2 +++ b/xen/arch/x86/traps.c	Wed Nov 09 17:23:46 2005 +0100
     9.3 @@ -412,16 +412,16 @@ void propagate_page_fault(unsigned long 
     9.4      struct vcpu *v = current;
     9.5      struct trap_bounce *tb = &v->arch.trap_bounce;
     9.6  
     9.7 +    v->arch.guest_context.ctrlreg[2] = addr;
     9.8 +    v->vcpu_info->arch.cr2           = addr;
     9.9 +
    9.10      ti = &v->arch.guest_context.trap_ctxt[TRAP_page_fault];
    9.11 -    tb->flags = TBF_EXCEPTION | TBF_EXCEPTION_ERRCODE | TBF_EXCEPTION_CR2;
    9.12 -    tb->cr2        = addr;
    9.13 +    tb->flags = TBF_EXCEPTION | TBF_EXCEPTION_ERRCODE;
    9.14      tb->error_code = error_code;
    9.15      tb->cs         = ti->cs;
    9.16      tb->eip        = ti->address;
    9.17      if ( TI_GET_IF(ti) )
    9.18          tb->flags |= TBF_INTERRUPT;
    9.19 -
    9.20 -    v->arch.guest_context.ctrlreg[2] = addr;
    9.21  }
    9.22  
    9.23  static int handle_perdomain_mapping_fault(
    9.24 @@ -931,6 +931,7 @@ static int emulate_privileged_op(struct 
    9.25  
    9.26          case 2: /* Write CR2 */
    9.27              v->arch.guest_context.ctrlreg[2] = *reg;
    9.28 +            v->vcpu_info->arch.cr2           = *reg;
    9.29              break;
    9.30              
    9.31          case 3: /* Write CR3 */
    10.1 --- a/xen/arch/x86/x86_32/asm-offsets.c	Wed Nov 09 16:08:37 2005 +0100
    10.2 +++ b/xen/arch/x86/x86_32/asm-offsets.c	Wed Nov 09 17:23:46 2005 +0100
    10.3 @@ -75,7 +75,6 @@ void __dummy__(void)
    10.4      BLANK();
    10.5  
    10.6      OFFSET(TRAPBOUNCE_error_code, struct trap_bounce, error_code);
    10.7 -    OFFSET(TRAPBOUNCE_cr2, struct trap_bounce, cr2);
    10.8      OFFSET(TRAPBOUNCE_flags, struct trap_bounce, flags);
    10.9      OFFSET(TRAPBOUNCE_cs, struct trap_bounce, cs);
   10.10      OFFSET(TRAPBOUNCE_eip, struct trap_bounce, eip);
    11.1 --- a/xen/arch/x86/x86_32/entry.S	Wed Nov 09 16:08:37 2005 +0100
    11.2 +++ b/xen/arch/x86/x86_32/entry.S	Wed Nov 09 17:23:46 2005 +0100
    11.3 @@ -401,30 +401,25 @@ FLT16:  movl %eax,%gs:8(%esi)
    11.4          subl $4,%esi                    # push error_code onto guest frame
    11.5          movl TRAPBOUNCE_error_code(%edx),%eax
    11.6  FLT17:  movl %eax,%gs:(%esi)
    11.7 -        testb $TBF_EXCEPTION_CR2,%cl
    11.8 -        jz   2f
    11.9 -        subl $4,%esi                    # push %cr2 onto guest frame
   11.10 -        movl TRAPBOUNCE_cr2(%edx),%eax
   11.11 -FLT18:  movl %eax,%gs:(%esi)
   11.12  1:      testb $TBF_FAILSAFE,%cl
   11.13          jz   2f
   11.14          subl $16,%esi                # add DS/ES/FS/GS to failsafe stack frame
   11.15          testl $X86_EFLAGS_VM,UREGS_eflags+4(%esp)
   11.16          jz   nvm86_2
   11.17          xorl %eax,%eax               # VM86: we write zero selector values
   11.18 -FLT19:  movl %eax,%gs:(%esi) 
   11.19 -FLT20:  movl %eax,%gs:4(%esi)
   11.20 -FLT21:  movl %eax,%gs:8(%esi) 
   11.21 -FLT22:  movl %eax,%gs:12(%esi)
   11.22 +FLT18:  movl %eax,%gs:(%esi) 
   11.23 +FLT19:  movl %eax,%gs:4(%esi)
   11.24 +FLT20:  movl %eax,%gs:8(%esi) 
   11.25 +FLT21:  movl %eax,%gs:12(%esi)
   11.26          jmp  2f
   11.27  nvm86_2:movl UREGS_ds+4(%esp),%eax   # non-VM86: write real selector values
   11.28 -FLT23:  movl %eax,%gs:(%esi) 
   11.29 +FLT22:  movl %eax,%gs:(%esi) 
   11.30          movl UREGS_es+4(%esp),%eax
   11.31 -FLT24:  movl %eax,%gs:4(%esi)
   11.32 +FLT23:  movl %eax,%gs:4(%esi)
   11.33          movl UREGS_fs+4(%esp),%eax
   11.34 -FLT25:  movl %eax,%gs:8(%esi) 
   11.35 +FLT24:  movl %eax,%gs:8(%esi) 
   11.36          movl UREGS_gs+4(%esp),%eax
   11.37 -FLT26:  movl %eax,%gs:12(%esi)
   11.38 +FLT25:  movl %eax,%gs:12(%esi)
   11.39  2:      testl $X86_EFLAGS_VM,UREGS_eflags+4(%esp)
   11.40          jz   nvm86_3
   11.41          xorl %eax,%eax      /* zero DS-GS, just as a real CPU would */
   11.42 @@ -456,7 +451,6 @@ nvm86_3:/* Rewrite our stack frame and r
   11.43          .long FLT20,domain_crash_synchronous , FLT21,domain_crash_synchronous
   11.44          .long FLT22,domain_crash_synchronous , FLT23,domain_crash_synchronous
   11.45          .long FLT24,domain_crash_synchronous , FLT25,domain_crash_synchronous
   11.46 -        .long FLT26,domain_crash_synchronous
   11.47  .previous
   11.48  
   11.49          ALIGN
    12.1 --- a/xen/arch/x86/x86_64/asm-offsets.c	Wed Nov 09 16:08:37 2005 +0100
    12.2 +++ b/xen/arch/x86/x86_64/asm-offsets.c	Wed Nov 09 17:23:46 2005 +0100
    12.3 @@ -75,7 +75,6 @@ void __dummy__(void)
    12.4      BLANK();
    12.5  
    12.6      OFFSET(TRAPBOUNCE_error_code, struct trap_bounce, error_code);
    12.7 -    OFFSET(TRAPBOUNCE_cr2, struct trap_bounce, cr2);
    12.8      OFFSET(TRAPBOUNCE_flags, struct trap_bounce, flags);
    12.9      OFFSET(TRAPBOUNCE_cs, struct trap_bounce, cs);
   12.10      OFFSET(TRAPBOUNCE_eip, struct trap_bounce, eip);
    13.1 --- a/xen/arch/x86/x86_64/entry.S	Wed Nov 09 16:08:37 2005 +0100
    13.2 +++ b/xen/arch/x86/x86_64/entry.S	Wed Nov 09 17:23:46 2005 +0100
    13.3 @@ -370,27 +370,22 @@ FLT6:   movq  %rax,(%rsi)               
    13.4          subq  $8,%rsi
    13.5          movl  TRAPBOUNCE_error_code(%rdx),%eax
    13.6  FLT7:   movq  %rax,(%rsi)               # ERROR CODE
    13.7 -        testb $TBF_EXCEPTION_CR2,%cl
    13.8 -        jz    2f
    13.9 -        subq  $8,%rsi
   13.10 -        movq  TRAPBOUNCE_cr2(%rdx),%rax
   13.11 -FLT8:   movq  %rax,(%rsi)               # CR2
   13.12  1:      testb $TBF_FAILSAFE,%cl
   13.13          jz    2f
   13.14          subq  $32,%rsi
   13.15          movl  %gs,%eax
   13.16 -FLT9:   movq  %rax,24(%rsi)             # GS
   13.17 +FLT8:   movq  %rax,24(%rsi)             # GS
   13.18          movl  %fs,%eax
   13.19 -FLT10:  movq  %rax,16(%rsi)             # FS
   13.20 +FLT9:   movq  %rax,16(%rsi)             # FS
   13.21          movl  %es,%eax
   13.22 -FLT11:  movq  %rax,8(%rsi)              # ES
   13.23 +FLT10:  movq  %rax,8(%rsi)              # ES
   13.24          movl  %ds,%eax
   13.25 -FLT12:  movq  %rax,(%rsi)               # DS
   13.26 +FLT11:  movq  %rax,(%rsi)               # DS
   13.27  2:      subq  $16,%rsi
   13.28          movq  UREGS_r11+8(%rsp),%rax
   13.29 -FLT13:  movq  %rax,8(%rsi)              # R11
   13.30 +FLT12:  movq  %rax,8(%rsi)              # R11
   13.31          movq  UREGS_rcx+8(%rsp),%rax
   13.32 -FLT14:  movq  %rax,(%rsi)               # RCX
   13.33 +FLT13:  movq  %rax,(%rsi)               # RCX
   13.34          /* Rewrite our stack frame and return to guest-OS mode. */
   13.35          /* IA32 Ref. Vol. 3: TF, VM, RF and NT flags are cleared on trap. */
   13.36          movl  $TRAP_syscall,UREGS_entry_vector+8(%rsp)
   13.37 @@ -411,7 +406,6 @@ FLT14:  movq  %rax,(%rsi)               
   13.38          .quad  FLT8,domain_crash_synchronous ,  FLT9,domain_crash_synchronous
   13.39          .quad FLT10,domain_crash_synchronous , FLT11,domain_crash_synchronous
   13.40          .quad FLT12,domain_crash_synchronous , FLT13,domain_crash_synchronous
   13.41 -        .quad FLT14,domain_crash_synchronous
   13.42  .previous
   13.43  
   13.44          ALIGN
    14.1 --- a/xen/include/asm-x86/domain.h	Wed Nov 09 16:08:37 2005 +0100
    14.2 +++ b/xen/include/asm-x86/domain.h	Wed Nov 09 17:23:46 2005 +0100
    14.3 @@ -8,7 +8,6 @@
    14.4  
    14.5  struct trap_bounce {
    14.6      unsigned long  error_code;
    14.7 -    unsigned long  cr2;
    14.8      unsigned short flags; /* TBF_ */
    14.9      unsigned short cs;
   14.10      unsigned long  eip;
    15.1 --- a/xen/include/asm-x86/processor.h	Wed Nov 09 16:08:37 2005 +0100
    15.2 +++ b/xen/include/asm-x86/processor.h	Wed Nov 09 17:23:46 2005 +0100
    15.3 @@ -121,7 +121,6 @@
    15.4  /* 'trap_bounce' flags values */
    15.5  #define TBF_EXCEPTION          1
    15.6  #define TBF_EXCEPTION_ERRCODE  2
    15.7 -#define TBF_EXCEPTION_CR2      4
    15.8  #define TBF_INTERRUPT          8
    15.9  #define TBF_FAILSAFE          16
   15.10  
    16.1 --- a/xen/include/public/arch-ia64.h	Wed Nov 09 16:08:37 2005 +0100
    16.2 +++ b/xen/include/public/arch-ia64.h	Wed Nov 09 17:23:46 2005 +0100
    16.3 @@ -271,12 +271,10 @@ typedef struct {
    16.4  
    16.5  typedef mapped_regs_t vpd_t;
    16.6  
    16.7 -#define __ARCH_HAS_VCPU_INFO
    16.8 -
    16.9  typedef struct {
   16.10      unsigned int flags;
   16.11      unsigned long start_info_pfn;
   16.12 -} arch_shared_info_t;  // DON'T PACK 
   16.13 +} arch_shared_info_t;
   16.14  
   16.15  typedef struct vcpu_guest_context {
   16.16  #define VGCF_FPU_VALID (1<<0)
    17.1 --- a/xen/include/public/arch-x86_32.h	Wed Nov 09 16:08:37 2005 +0100
    17.2 +++ b/xen/include/public/arch-x86_32.h	Wed Nov 09 17:23:46 2005 +0100
    17.3 @@ -132,6 +132,11 @@ typedef struct arch_shared_info {
    17.4      unsigned long pfn_to_mfn_frame_list_list; 
    17.5  } arch_shared_info_t;
    17.6  
    17.7 +typedef struct {
    17.8 +    unsigned long cr2;
    17.9 +    unsigned long pad; /* sizeof(vcpu_info_t) == 16 */
   17.10 +} arch_vcpu_info_t;
   17.11 +
   17.12  #endif
   17.13  
   17.14  #endif
    18.1 --- a/xen/include/public/arch-x86_64.h	Wed Nov 09 16:08:37 2005 +0100
    18.2 +++ b/xen/include/public/arch-x86_64.h	Wed Nov 09 17:23:46 2005 +0100
    18.3 @@ -201,6 +201,11 @@ typedef struct arch_shared_info {
    18.4      unsigned long pfn_to_mfn_frame_list_list; 
    18.5  } arch_shared_info_t;
    18.6  
    18.7 +typedef struct {
    18.8 +    unsigned long cr2;
    18.9 +    unsigned long pad; /* sizeof(vcpu_info_t) == 32 */
   18.10 +} arch_vcpu_info_t;
   18.11 +
   18.12  #endif /* !__ASSEMBLY__ */
   18.13  
   18.14  #endif
    19.1 --- a/xen/include/public/dom0_ops.h	Wed Nov 09 16:08:37 2005 +0100
    19.2 +++ b/xen/include/public/dom0_ops.h	Wed Nov 09 17:23:46 2005 +0100
    19.3 @@ -19,7 +19,7 @@
    19.4   * This makes sure that old versions of dom0 tools will stop working in a
    19.5   * well-defined way (rather than crashing the machine, for instance).
    19.6   */
    19.7 -#define DOM0_INTERFACE_VERSION   0xAAAA1011
    19.8 +#define DOM0_INTERFACE_VERSION   0xAAAA1012
    19.9  
   19.10  /************************************************************************/
   19.11  
    20.1 --- a/xen/include/public/xen.h	Wed Nov 09 16:08:37 2005 +0100
    20.2 +++ b/xen/include/public/xen.h	Wed Nov 09 17:23:46 2005 +0100
    20.3 @@ -299,9 +299,7 @@ typedef struct vcpu_info {
    20.4      uint8_t evtchn_upcall_pending;
    20.5      uint8_t evtchn_upcall_mask;
    20.6      unsigned long evtchn_pending_sel;
    20.7 -#ifdef __ARCH_HAS_VCPU_INFO
    20.8      arch_vcpu_info_t arch;
    20.9 -#endif
   20.10  } vcpu_info_t;
   20.11  
   20.12  typedef struct vcpu_time_info {