From: "Jan Beulich" Subject: [PATCH 3/6] x86: move pv-only members of struct vcpu to struct pv_vcpu Date: Tue, 05 Apr 2011 09:21:03 +0100 Message-ID: <4D9AED0F0200007800039F32@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part90BC4AFF.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part90BC4AFF.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline ... thus further shrinking overall size of struct arch_vcpu. This has a minor effect on XEN_DOMCTL_{get,set}_ext_vcpucontext - for HVM guests, some meaningless fields will no longer get stored or retrieved: reads will now return zero, and writes are required to be (mostly) zero (the same as was already done on x86-32). Signed-off-by: Jan Beulich --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -342,8 +342,6 @@ int vcpu_initialise(struct vcpu *v) struct domain *d =3D v->domain; int rc; =20 - v->arch.vcpu_info_mfn =3D INVALID_MFN; - v->arch.flags =3D TF_kernel_mode; =20 #if defined(__i386__) @@ -372,8 +370,6 @@ int vcpu_initialise(struct vcpu *v) =20 v->arch.perdomain_ptes =3D perdomain_ptes(d, v); =20 - spin_lock_init(&v->arch.shadow_ldt_lock); - if ( (rc =3D xsave_alloc_save_area(v)) !=3D 0 ) return rc; if ( v->arch.xsave_area ) @@ -395,6 +391,10 @@ int vcpu_initialise(struct vcpu *v) goto done; } =20 + v->arch.pv_vcpu.vcpu_info_mfn =3D INVALID_MFN; + + spin_lock_init(&v->arch.pv_vcpu.shadow_ldt_lock); + if ( !is_idle_domain(d) ) { if ( standalone_trap_ctxt(v) ) @@ -868,7 +868,7 @@ int arch_set_info_guest( init_int80_direct_trap(v); =20 /* IOPL privileges are virtualised. */ - v->arch.iopl =3D (v->arch.user_regs.eflags >> 12) & 3; + v->arch.pv_vcpu.iopl =3D (v->arch.user_regs.eflags >> 12) & 3; v->arch.user_regs.eflags &=3D ~X86_EFLAGS_IOPL; =20 /* Ensure real hardware interrupts are enabled. */ @@ -1016,14 +1016,14 @@ unmap_vcpu_info(struct vcpu *v) { unsigned long mfn; =20 - if ( v->arch.vcpu_info_mfn =3D=3D INVALID_MFN ) + if ( v->arch.pv_vcpu.vcpu_info_mfn =3D=3D INVALID_MFN ) return; =20 - mfn =3D v->arch.vcpu_info_mfn; + mfn =3D v->arch.pv_vcpu.vcpu_info_mfn; unmap_domain_page_global(v->vcpu_info); =20 v->vcpu_info =3D &dummy_vcpu_info; - v->arch.vcpu_info_mfn =3D INVALID_MFN; + v->arch.pv_vcpu.vcpu_info_mfn =3D INVALID_MFN; =20 put_page_and_type(mfn_to_page(mfn)); } @@ -1045,7 +1045,7 @@ map_vcpu_info(struct vcpu *v, unsigned l if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) ) return -EINVAL; =20 - if ( v->arch.vcpu_info_mfn !=3D INVALID_MFN ) + if ( v->arch.pv_vcpu.vcpu_info_mfn !=3D INVALID_MFN ) return -EINVAL; =20 /* Run this command on yourself or on other offline VCPUS. */ @@ -1077,7 +1077,7 @@ map_vcpu_info(struct vcpu *v, unsigned l } =20 v->vcpu_info =3D new_info; - v->arch.vcpu_info_mfn =3D mfn; + v->arch.pv_vcpu.vcpu_info_mfn =3D mfn; =20 /* Set new vcpu_info pointer /before/ setting pending flags. */ wmb(); --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -1123,20 +1123,31 @@ long arch_do_domctl( { evc->size =3D sizeof(*evc); #ifdef __x86_64__ - evc->sysenter_callback_cs =3D v->arch.sysenter_callback_c= s; - evc->sysenter_callback_eip =3D v->arch.sysenter_callback_e= ip; - evc->sysenter_disables_events =3D v->arch.sysenter_disables_e= vents; - evc->syscall32_callback_cs =3D v->arch.syscall32_callback_= cs; - evc->syscall32_callback_eip =3D v->arch.syscall32_callback_= eip; - evc->syscall32_disables_events =3D v->arch.syscall32_disables_= events; -#else - evc->sysenter_callback_cs =3D 0; - evc->sysenter_callback_eip =3D 0; - evc->sysenter_disables_events =3D 0; - evc->syscall32_callback_cs =3D 0; - evc->syscall32_callback_eip =3D 0; - evc->syscall32_disables_events =3D 0; + if ( !is_hvm_domain(d) ) + { + evc->sysenter_callback_cs =3D + v->arch.pv_vcpu.sysenter_callback_cs; + evc->sysenter_callback_eip =3D + v->arch.pv_vcpu.sysenter_callback_eip; + evc->sysenter_disables_events =3D + v->arch.pv_vcpu.sysenter_disables_events; + evc->syscall32_callback_cs =3D + v->arch.pv_vcpu.syscall32_callback_cs; + evc->syscall32_callback_eip =3D + v->arch.pv_vcpu.syscall32_callback_eip; + evc->syscall32_disables_events =3D + v->arch.pv_vcpu.syscall32_disables_events; + } + else #endif + { + evc->sysenter_callback_cs =3D 0; + evc->sysenter_callback_eip =3D 0; + evc->sysenter_disables_events =3D 0; + evc->syscall32_callback_cs =3D 0; + evc->syscall32_callback_eip =3D 0; + evc->syscall32_disables_events =3D 0; + } } else { @@ -1144,22 +1155,31 @@ long arch_do_domctl( if ( evc->size !=3D sizeof(*evc) ) goto ext_vcpucontext_out; #ifdef __x86_64__ - fixup_guest_code_selector(d, evc->sysenter_callback_cs); - v->arch.sysenter_callback_cs =3D evc->sysenter_callback_c= s; - v->arch.sysenter_callback_eip =3D evc->sysenter_callback_e= ip; - v->arch.sysenter_disables_events =3D evc->sysenter_disables_e= vents; - fixup_guest_code_selector(d, evc->syscall32_callback_cs); - v->arch.syscall32_callback_cs =3D evc->syscall32_callback_= cs; - v->arch.syscall32_callback_eip =3D evc->syscall32_callback_= eip; - v->arch.syscall32_disables_events =3D evc->syscall32_disables_= events; -#else + if ( !is_hvm_domain(d) ) + { + fixup_guest_code_selector(d, evc->sysenter_callback_cs); + v->arch.pv_vcpu.sysenter_callback_cs =3D + evc->sysenter_callback_cs; + v->arch.pv_vcpu.sysenter_callback_eip =3D + evc->sysenter_callback_eip; + v->arch.pv_vcpu.sysenter_disables_events =3D + evc->sysenter_disables_events; + fixup_guest_code_selector(d, evc->syscall32_callback_cs); + v->arch.pv_vcpu.syscall32_callback_cs =3D + evc->syscall32_callback_cs; + v->arch.pv_vcpu.syscall32_callback_eip =3D + evc->syscall32_callback_eip; + v->arch.pv_vcpu.syscall32_disables_events =3D + evc->syscall32_disables_events; + } + else +#endif /* We do not support syscall/syscall32/sysenter on 32-bit = Xen. */ if ( (evc->sysenter_callback_cs & ~3) || evc->sysenter_callback_eip || (evc->syscall32_callback_cs & ~3) || evc->syscall32_callback_eip ) goto ext_vcpucontext_out; -#endif } =20 ret =3D 0; @@ -1698,7 +1718,7 @@ void arch_get_info_guest(struct vcpu *v, =20 /* IOPL privileges are virtualised: merge back into returned = eflags. */ BUG_ON((c(user_regs.eflags) & X86_EFLAGS_IOPL) !=3D 0); - c(user_regs.eflags |=3D v->arch.iopl << 12); + c(user_regs.eflags |=3D v->arch.pv_vcpu.iopl << 12); =20 if ( !is_pv_32on64_domain(v->domain) ) { --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -592,12 +592,12 @@ static void invalidate_shadow_ldt(struct =20 BUG_ON(unlikely(in_irq())); =20 - spin_lock(&v->arch.shadow_ldt_lock); + spin_lock(&v->arch.pv_vcpu.shadow_ldt_lock); =20 - if ( v->arch.shadow_ldt_mapcnt =3D=3D 0 ) + if ( v->arch.pv_vcpu.shadow_ldt_mapcnt =3D=3D 0 ) goto out; =20 - v->arch.shadow_ldt_mapcnt =3D 0; + v->arch.pv_vcpu.shadow_ldt_mapcnt =3D 0; =20 for ( i =3D 16; i < 32; i++ ) { @@ -615,7 +615,7 @@ static void invalidate_shadow_ldt(struct flush_tlb_mask(v->vcpu_dirty_cpumask); =20 out: - spin_unlock(&v->arch.shadow_ldt_lock); + spin_unlock(&v->arch.pv_vcpu.shadow_ldt_lock); } =20 =20 @@ -666,10 +666,10 @@ int map_ldt_shadow_page(unsigned int off =20 nl1e =3D l1e_from_pfn(mfn, l1e_get_flags(l1e) | _PAGE_RW); =20 - spin_lock(&v->arch.shadow_ldt_lock); + spin_lock(&v->arch.pv_vcpu.shadow_ldt_lock); l1e_write(&v->arch.perdomain_ptes[off + 16], nl1e); - v->arch.shadow_ldt_mapcnt++; - spin_unlock(&v->arch.shadow_ldt_lock); + v->arch.pv_vcpu.shadow_ldt_mapcnt++; + spin_unlock(&v->arch.pv_vcpu.shadow_ldt_lock); =20 return 1; } --- a/xen/arch/x86/physdev.c +++ b/xen/arch/x86/physdev.c @@ -440,7 +440,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H if ( set_iopl.iopl > 3 ) break; ret =3D 0; - v->arch.iopl =3D set_iopl.iopl; + v->arch.pv_vcpu.iopl =3D set_iopl.iopl; break; } =20 @@ -455,11 +455,11 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H break; ret =3D 0; #ifndef COMPAT - v->arch.iobmp =3D set_iobitmap.bitmap; + v->arch.pv_vcpu.iobmp =3D set_iobitmap.bitmap; #else - guest_from_compat_handle(v->arch.iobmp, set_iobitmap.bitmap); + guest_from_compat_handle(v->arch.pv_vcpu.iobmp, set_iobitmap.bitma= p); #endif - v->arch.iobmp_limit =3D set_iobitmap.nr_ports; + v->arch.pv_vcpu.iobmp_limit =3D set_iobitmap.nr_ports; break; } =20 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -429,7 +429,7 @@ static void do_guest_trap( =20 trace_pv_trap(trapnr, regs->eip, use_error_code, regs->error_code); =20 - tb =3D &v->arch.trap_bounce; + tb =3D &v->arch.pv_vcpu.trap_bounce; ti =3D &v->arch.pv_vcpu.trap_ctxt[trapnr]; =20 tb->flags =3D TBF_EXCEPTION; @@ -507,7 +507,7 @@ static unsigned int check_guest_io_break asmlinkage int set_guest_machinecheck_trapbounce(void) { struct vcpu *v =3D current; - struct trap_bounce *tb =3D &v->arch.trap_bounce; + struct trap_bounce *tb =3D &v->arch.pv_vcpu.trap_bounce; =20 do_guest_trap(TRAP_machine_check, guest_cpu_user_regs(), 0); tb->flags &=3D ~TBF_EXCEPTION; /* not needed for MCE delivery path */ @@ -521,7 +521,7 @@ asmlinkage int set_guest_machinecheck_tr asmlinkage int set_guest_nmi_trapbounce(void) { struct vcpu *v =3D current; - struct trap_bounce *tb =3D &v->arch.trap_bounce; + struct trap_bounce *tb =3D &v->arch.pv_vcpu.trap_bounce; do_guest_trap(TRAP_nmi, guest_cpu_user_regs(), 0); tb->flags &=3D ~TBF_EXCEPTION; /* not needed for NMI delivery path */ return !null_trap_bounce(v, tb); @@ -1007,7 +1007,7 @@ void propagate_page_fault(unsigned long=20 { struct trap_info *ti; struct vcpu *v =3D current; - struct trap_bounce *tb =3D &v->arch.trap_bounce; + struct trap_bounce *tb =3D &v->arch.pv_vcpu.trap_bounce; =20 v->arch.pv_vcpu.ctrlreg[2] =3D addr; arch_set_cr2(v, addr); @@ -1504,10 +1504,10 @@ static int guest_io_okay( #endif =20 if ( !vm86_mode(regs) && - (v->arch.iopl >=3D (guest_kernel_mode(v, regs) ? 1 : 3)) ) + (v->arch.pv_vcpu.iopl >=3D (guest_kernel_mode(v, regs) ? 1 : 3)) = ) return 1; =20 - if ( v->arch.iobmp_limit > (port + bytes) ) + if ( v->arch.pv_vcpu.iobmp_limit > (port + bytes) ) { union { uint8_t bytes[2]; uint16_t mask; } x; =20 @@ -1516,7 +1516,7 @@ static int guest_io_okay( * read as 0xff (no access allowed). */ TOGGLE_MODE(); - switch ( __copy_from_guest_offset(x.bytes, v->arch.iobmp, + switch ( __copy_from_guest_offset(x.bytes, v->arch.pv_vcpu.iobmp, port>>3, 2) ) { default: x.bytes[0] =3D ~0; @@ -2020,7 +2020,7 @@ static int emulate_privileged_op(struct=20 =20 case 0xfa: /* CLI */ case 0xfb: /* STI */ - if ( v->arch.iopl < (guest_kernel_mode(v, regs) ? 1 : 3) ) + if ( v->arch.pv_vcpu.iopl < (guest_kernel_mode(v, regs) ? 1 : 3) = ) goto fail; /* * This is just too dangerous to allow, in my opinion. Consider = if the --- a/xen/arch/x86/x86_32/asm-offsets.c +++ b/xen/arch/x86/x86_32/asm-offsets.c @@ -53,7 +53,7 @@ void __dummy__(void) =20 OFFSET(VCPU_processor, struct vcpu, processor); OFFSET(VCPU_vcpu_info, struct vcpu, vcpu_info); - OFFSET(VCPU_trap_bounce, struct vcpu, arch.trap_bounce); + OFFSET(VCPU_trap_bounce, struct vcpu, arch.pv_vcpu.trap_bounce); OFFSET(VCPU_thread_flags, struct vcpu, arch.flags); OFFSET(VCPU_event_sel, struct vcpu, arch.pv_vcpu.event_callback_cs); OFFSET(VCPU_event_addr, struct vcpu, arch.pv_vcpu.event_callback_eip);= --- a/xen/arch/x86/x86_32/seg_fixup.c +++ b/xen/arch/x86/x86_32/seg_fixup.c @@ -546,7 +546,7 @@ int gpf_emulate_4gb(struct cpu_user_regs if ( VM_ASSIST(curr->domain, VMASST_TYPE_4gb_segments_notify) ) { struct trap_info *ti =3D &curr->arch.pv_vcpu.trap_ctxt[15]; - struct trap_bounce *tb =3D &curr->arch.trap_bounce; + struct trap_bounce *tb =3D &curr->arch.pv_vcpu.trap_bounce; =20 tb->flags =3D TBF_EXCEPTION | TBF_EXCEPTION_ERRCODE; tb->error_code =3D pb - eip; --- a/xen/arch/x86/x86_32/traps.c +++ b/xen/arch/x86/x86_32/traps.c @@ -387,12 +387,12 @@ void init_int80_direct_trap(struct vcpu=20 if ( TI_GET_IF(ti) || !guest_gate_selector_okay(v->domain, ti->cs) || supervisor_mode_kernel ) { - v->arch.int80_desc.a =3D v->arch.int80_desc.b =3D 0; + v->arch.pv_vcpu.int80_desc.a =3D v->arch.pv_vcpu.int80_desc.b =3D = 0; return; } =20 - v->arch.int80_desc.a =3D (ti->cs << 16) | (ti->address & 0xffff); - v->arch.int80_desc.b =3D + v->arch.pv_vcpu.int80_desc.a =3D (ti->cs << 16) | (ti->address & = 0xffff); + v->arch.pv_vcpu.int80_desc.b =3D (ti->address & 0xffff0000) | 0x8f00 | ((TI_GET_DPL(ti) & 3) << = 13); =20 if ( v =3D=3D current ) --- a/xen/arch/x86/x86_64/asm-offsets.c +++ b/xen/arch/x86/x86_64/asm-offsets.c @@ -65,8 +65,8 @@ void __dummy__(void) OFFSET(VCPU_processor, struct vcpu, processor); OFFSET(VCPU_domain, struct vcpu, domain); OFFSET(VCPU_vcpu_info, struct vcpu, vcpu_info); - OFFSET(VCPU_trap_bounce, struct vcpu, arch.trap_bounce); - OFFSET(VCPU_int80_bounce, struct vcpu, arch.int80_bounce); + OFFSET(VCPU_trap_bounce, struct vcpu, arch.pv_vcpu.trap_bounce); + OFFSET(VCPU_int80_bounce, struct vcpu, arch.pv_vcpu.int80_bounce); OFFSET(VCPU_thread_flags, struct vcpu, arch.flags); OFFSET(VCPU_event_addr, struct vcpu, arch.pv_vcpu.event_callback_eip);= OFFSET(VCPU_event_sel, struct vcpu, arch.pv_vcpu.event_callback_cs); @@ -76,14 +76,18 @@ void __dummy__(void) arch.pv_vcpu.failsafe_callback_cs); OFFSET(VCPU_syscall_addr, struct vcpu, arch.pv_vcpu.syscall_callback_eip); - OFFSET(VCPU_syscall32_addr, struct vcpu, arch.syscall32_callback_eip);= - OFFSET(VCPU_syscall32_sel, struct vcpu, arch.syscall32_callback_cs); + OFFSET(VCPU_syscall32_addr, struct vcpu, + arch.pv_vcpu.syscall32_callback_eip); + OFFSET(VCPU_syscall32_sel, struct vcpu, + arch.pv_vcpu.syscall32_callback_cs); OFFSET(VCPU_syscall32_disables_events, struct vcpu, - arch.syscall32_disables_events); - OFFSET(VCPU_sysenter_addr, struct vcpu, arch.sysenter_callback_eip); - OFFSET(VCPU_sysenter_sel, struct vcpu, arch.sysenter_callback_cs); + arch.pv_vcpu.syscall32_disables_events); + OFFSET(VCPU_sysenter_addr, struct vcpu, + arch.pv_vcpu.sysenter_callback_eip); + OFFSET(VCPU_sysenter_sel, struct vcpu, + arch.pv_vcpu.sysenter_callback_cs); OFFSET(VCPU_sysenter_disables_events, struct vcpu, - arch.sysenter_disables_events); + arch.pv_vcpu.sysenter_disables_events); OFFSET(VCPU_trap_ctxt, struct vcpu, arch.pv_vcpu.trap_ctxt); OFFSET(VCPU_kernel_sp, struct vcpu, arch.pv_vcpu.kernel_sp); OFFSET(VCPU_kernel_ss, struct vcpu, arch.pv_vcpu.kernel_ss); --- a/xen/arch/x86/x86_64/compat/traps.c +++ b/xen/arch/x86/x86_64/compat/traps.c @@ -190,16 +190,16 @@ static long compat_register_guest_callba break; =20 case CALLBACKTYPE_syscall32: - v->arch.syscall32_callback_cs =3D reg->address.cs; - v->arch.syscall32_callback_eip =3D reg->address.eip; - v->arch.syscall32_disables_events =3D + v->arch.pv_vcpu.syscall32_callback_cs =3D reg->address.cs; + v->arch.pv_vcpu.syscall32_callback_eip =3D reg->address.eip; + v->arch.pv_vcpu.syscall32_disables_events =3D (reg->flags & CALLBACKF_mask_events) !=3D 0; break; =20 case CALLBACKTYPE_sysenter: - v->arch.sysenter_callback_cs =3D reg->address.cs; - v->arch.sysenter_callback_eip =3D reg->address.eip; - v->arch.sysenter_disables_events =3D + v->arch.pv_vcpu.sysenter_callback_cs =3D reg->address.cs; + v->arch.pv_vcpu.sysenter_callback_eip =3D reg->address.eip; + v->arch.pv_vcpu.sysenter_disables_events =3D (reg->flags & CALLBACKF_mask_events) !=3D 0; break; =20 --- a/xen/arch/x86/x86_64/traps.c +++ b/xen/arch/x86/x86_64/traps.c @@ -422,7 +422,7 @@ void __devinit subarch_percpu_traps_init void init_int80_direct_trap(struct vcpu *v) { struct trap_info *ti =3D &v->arch.pv_vcpu.trap_ctxt[0x80]; - struct trap_bounce *tb =3D &v->arch.int80_bounce; + struct trap_bounce *tb =3D &v->arch.pv_vcpu.int80_bounce; =20 tb->flags =3D TBF_EXCEPTION; tb->cs =3D ti->cs; @@ -467,14 +467,14 @@ static long register_guest_callback(stru break; =20 case CALLBACKTYPE_syscall32: - v->arch.syscall32_callback_eip =3D reg->address; - v->arch.syscall32_disables_events =3D + v->arch.pv_vcpu.syscall32_callback_eip =3D reg->address; + v->arch.pv_vcpu.syscall32_disables_events =3D !!(reg->flags & CALLBACKF_mask_events); break; =20 case CALLBACKTYPE_sysenter: - v->arch.sysenter_callback_eip =3D reg->address; - v->arch.sysenter_disables_events =3D + v->arch.pv_vcpu.sysenter_callback_eip =3D reg->address; + v->arch.pv_vcpu.sysenter_disables_events =3D !!(reg->flags & CALLBACKF_mask_events); break; =20 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -378,11 +378,38 @@ struct pv_vcpu unsigned long vm_assist; =20 #ifdef CONFIG_X86_64 + unsigned long syscall32_callback_eip; + unsigned long sysenter_callback_eip; + unsigned short syscall32_callback_cs; + unsigned short sysenter_callback_cs; + bool_t syscall32_disables_events; + bool_t sysenter_disables_events; + /* Segment base addresses. */ unsigned long fs_base; unsigned long gs_base_kernel; unsigned long gs_base_user; #endif + + /* Bounce information for propagating an exception to guest OS. */ + struct trap_bounce trap_bounce; +#ifdef CONFIG_X86_64 + struct trap_bounce int80_bounce; +#else + struct desc_struct int80_desc; +#endif + + /* I/O-port access bitmap. */ + XEN_GUEST_HANDLE(uint8) iobmp; /* Guest kernel vaddr of the bitmap. = */ + unsigned int iobmp_limit; /* Number of ports represented in the = bitmap. */ + unsigned int iopl; /* Current IOPL for this VCPU. */ + + /* Current LDT details. */ + unsigned long shadow_ldt_mapcnt; + spinlock_t shadow_ldt_lock; + + /* Guest-specified relocation of vcpu_info. */ + unsigned long vcpu_info_mfn; }; =20 struct arch_vcpu @@ -408,27 +435,6 @@ struct arch_vcpu void (*ctxt_switch_from) (struct vcpu *); void (*ctxt_switch_to) (struct vcpu *); =20 - /* Bounce information for propagating an exception to guest OS. */ - struct trap_bounce trap_bounce; - - /* I/O-port access bitmap. */ - XEN_GUEST_HANDLE(uint8) iobmp; /* Guest kernel vaddr of the bitmap. = */ - int iobmp_limit; /* Number of ports represented in the bitmap. */ - int iopl; /* Current IOPL for this VCPU. */ - -#ifdef CONFIG_X86_32 - struct desc_struct int80_desc; -#endif -#ifdef CONFIG_X86_64 - struct trap_bounce int80_bounce; - unsigned long syscall32_callback_eip; - unsigned long sysenter_callback_eip; - unsigned short syscall32_callback_cs; - unsigned short sysenter_callback_cs; - bool_t syscall32_disables_events; - bool_t sysenter_disables_events; -#endif - /* Virtual Machine Extensions */ union { struct pv_vcpu pv_vcpu; @@ -468,15 +474,8 @@ struct arch_vcpu */ uint64_t xcr0_accum; =20 - /* Current LDT details. */ - unsigned long shadow_ldt_mapcnt; - spinlock_t shadow_ldt_lock; - struct paging_vcpu paging; =20 - /* Guest-specified relocation of vcpu_info. */ - unsigned long vcpu_info_mfn; - #ifdef CONFIG_X86_32 /* map_domain_page() mapping cache. */ struct mapcache_vcpu mapcache; --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -474,7 +474,7 @@ extern void init_int80_direct_trap(struc =20 #define set_int80_direct_trap(_ed) \ (memcpy(idt_tables[(_ed)->processor] + 0x80, \ - &((_ed)->arch.int80_desc), 8)) + &((_ed)->arch.pv_vcpu.int80_desc), 8)) =20 #else =20 --=__Part90BC4AFF.0__= Content-Type: text/plain; name="x86-vcpu-struct-pv-move.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-vcpu-struct-pv-move.patch" ... thus further shrinking overall size of struct arch_vcpu.=0A=0AThis has = a minor effect on XEN_DOMCTL_{get,set}_ext_vcpucontext - for=0AHVM guests, = some meaningless fields will no longer get stored or=0Aretrieved: reads = will now return zero, and writes are required to be=0A(mostly) zero (the = same as was already done on x86-32).=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- a/xen/arch/x86/domain.c=0A+++ b/xen/arch/x86= /domain.c=0A@@ -342,8 +342,6 @@ int vcpu_initialise(struct vcpu *v)=0A = struct domain *d =3D v->domain;=0A int rc;=0A =0A- v->arch.vcpu_info= _mfn =3D INVALID_MFN;=0A-=0A v->arch.flags =3D TF_kernel_mode;=0A =0A = #if defined(__i386__)=0A@@ -372,8 +370,6 @@ int vcpu_initialise(struct = vcpu *v)=0A =0A v->arch.perdomain_ptes =3D perdomain_ptes(d, v);=0A = =0A- spin_lock_init(&v->arch.shadow_ldt_lock);=0A-=0A if ( (rc =3D = xsave_alloc_save_area(v)) !=3D 0 )=0A return rc;=0A if ( = v->arch.xsave_area )=0A@@ -395,6 +391,10 @@ int vcpu_initialise(struct = vcpu *v)=0A goto done;=0A }=0A =0A+ v->arch.pv_vcpu.vcpu_inf= o_mfn =3D INVALID_MFN;=0A+=0A+ spin_lock_init(&v->arch.pv_vcpu.shadow_ld= t_lock);=0A+=0A if ( !is_idle_domain(d) )=0A {=0A if ( = standalone_trap_ctxt(v) )=0A@@ -868,7 +868,7 @@ int arch_set_info_guest(=0A= init_int80_direct_trap(v);=0A =0A /* IOPL privileges are = virtualised. */=0A- v->arch.iopl =3D (v->arch.user_regs.eflags >> 12) & = 3;=0A+ v->arch.pv_vcpu.iopl =3D (v->arch.user_regs.eflags >> 12) & = 3;=0A v->arch.user_regs.eflags &=3D ~X86_EFLAGS_IOPL;=0A =0A /* = Ensure real hardware interrupts are enabled. */=0A@@ -1016,14 +1016,14 @@ = unmap_vcpu_info(struct vcpu *v)=0A {=0A unsigned long mfn;=0A =0A- = if ( v->arch.vcpu_info_mfn =3D=3D INVALID_MFN )=0A+ if ( v->arch.pv_vcpu= .vcpu_info_mfn =3D=3D INVALID_MFN )=0A return;=0A =0A- mfn =3D = v->arch.vcpu_info_mfn;=0A+ mfn =3D v->arch.pv_vcpu.vcpu_info_mfn;=0A = unmap_domain_page_global(v->vcpu_info);=0A =0A v->vcpu_info =3D = &dummy_vcpu_info;=0A- v->arch.vcpu_info_mfn =3D INVALID_MFN;=0A+ = v->arch.pv_vcpu.vcpu_info_mfn =3D INVALID_MFN;=0A =0A put_page_and_type= (mfn_to_page(mfn));=0A }=0A@@ -1045,7 +1045,7 @@ map_vcpu_info(struct vcpu = *v, unsigned l=0A if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )=0A = return -EINVAL;=0A =0A- if ( v->arch.vcpu_info_mfn !=3D = INVALID_MFN )=0A+ if ( v->arch.pv_vcpu.vcpu_info_mfn !=3D INVALID_MFN = )=0A return -EINVAL;=0A =0A /* Run this command on yourself or = on other offline VCPUS. */=0A@@ -1077,7 +1077,7 @@ map_vcpu_info(struct = vcpu *v, unsigned l=0A }=0A =0A v->vcpu_info =3D new_info;=0A- = v->arch.vcpu_info_mfn =3D mfn;=0A+ v->arch.pv_vcpu.vcpu_info_mfn =3D = mfn;=0A =0A /* Set new vcpu_info pointer /before/ setting pending = flags. */=0A wmb();=0A--- a/xen/arch/x86/domctl.c=0A+++ b/xen/arch/x86/= domctl.c=0A@@ -1123,20 +1123,31 @@ long arch_do_domctl(=0A {=0A = evc->size =3D sizeof(*evc);=0A #ifdef __x86_64__=0A- = evc->sysenter_callback_cs =3D v->arch.sysenter_callback_cs;=0A- = evc->sysenter_callback_eip =3D v->arch.sysenter_callback_eip;=0A- = evc->sysenter_disables_events =3D v->arch.sysenter_disables_eve= nts;=0A- evc->syscall32_callback_cs =3D v->arch.syscall32_ca= llback_cs;=0A- evc->syscall32_callback_eip =3D v->arch.syscal= l32_callback_eip;=0A- evc->syscall32_disables_events =3D = v->arch.syscall32_disables_events;=0A-#else=0A- evc->sysenter_ca= llback_cs =3D 0;=0A- evc->sysenter_callback_eip =3D = 0;=0A- evc->sysenter_disables_events =3D 0;=0A- = evc->syscall32_callback_cs =3D 0;=0A- evc->syscall32_callbac= k_eip =3D 0;=0A- evc->syscall32_disables_events =3D 0;=0A+ = if ( !is_hvm_domain(d) )=0A+ {=0A+ = evc->sysenter_callback_cs =3D=0A+ v->arch.pv_vcpu.s= ysenter_callback_cs;=0A+ evc->sysenter_callback_eip = =3D=0A+ v->arch.pv_vcpu.sysenter_callback_eip;=0A+ = evc->sysenter_disables_events =3D=0A+ = v->arch.pv_vcpu.sysenter_disables_events;=0A+ evc->syscall32= _callback_cs =3D=0A+ v->arch.pv_vcpu.syscall32_callb= ack_cs;=0A+ evc->syscall32_callback_eip =3D=0A+ = v->arch.pv_vcpu.syscall32_callback_eip;=0A+ = evc->syscall32_disables_events =3D=0A+ v->arch.pv_vcpu.s= yscall32_disables_events;=0A+ }=0A+ else=0A = #endif=0A+ {=0A+ evc->sysenter_callback_cs = =3D 0;=0A+ evc->sysenter_callback_eip =3D 0;=0A+ = evc->sysenter_disables_events =3D 0;=0A+ evc->sysca= ll32_callback_cs =3D 0;=0A+ evc->syscall32_callback_eip = =3D 0;=0A+ evc->syscall32_disables_events =3D 0;=0A+ = }=0A }=0A else=0A {=0A@@ -1144,22 +1155,31 = @@ long arch_do_domctl(=0A if ( evc->size !=3D sizeof(*evc) = )=0A goto ext_vcpucontext_out;=0A #ifdef __x86_64__=0A- = fixup_guest_code_selector(d, evc->sysenter_callback_cs);=0A- = v->arch.sysenter_callback_cs =3D evc->sysenter_callback_cs;=0A- = v->arch.sysenter_callback_eip =3D evc->sysenter_callback_eip;= =0A- v->arch.sysenter_disables_events =3D evc->sysenter_disable= s_events;=0A- fixup_guest_code_selector(d, evc->syscall32_callba= ck_cs);=0A- v->arch.syscall32_callback_cs =3D evc->syscall32= _callback_cs;=0A- v->arch.syscall32_callback_eip =3D = evc->syscall32_callback_eip;=0A- v->arch.syscall32_disables_even= ts =3D evc->syscall32_disables_events;=0A-#else=0A+ if ( = !is_hvm_domain(d) )=0A+ {=0A+ fixup_guest_code_se= lector(d, evc->sysenter_callback_cs);=0A+ v->arch.pv_vcpu.sy= senter_callback_cs =3D=0A+ evc->sysenter_callback_c= s;=0A+ v->arch.pv_vcpu.sysenter_callback_eip =3D=0A+ = evc->sysenter_callback_eip;=0A+ v->arch.pv_v= cpu.sysenter_disables_events =3D=0A+ evc->sysenter_disa= bles_events;=0A+ fixup_guest_code_selector(d, evc->syscall32= _callback_cs);=0A+ v->arch.pv_vcpu.syscall32_callback_cs = =3D=0A+ evc->syscall32_callback_cs;=0A+ = v->arch.pv_vcpu.syscall32_callback_eip =3D=0A+ = evc->syscall32_callback_eip;=0A+ v->arch.pv_vcpu.syscall32_d= isables_events =3D=0A+ evc->syscall32_disables_events;= =0A+ }=0A+ else=0A+#endif=0A /* We do = not support syscall/syscall32/sysenter on 32-bit Xen. */=0A if = ( (evc->sysenter_callback_cs & ~3) ||=0A evc->sysenter_cal= lback_eip ||=0A (evc->syscall32_callback_cs & ~3) ||=0A = evc->syscall32_callback_eip )=0A goto = ext_vcpucontext_out;=0A-#endif=0A }=0A =0A ret =3D 0;=0A@@ = -1698,7 +1718,7 @@ void arch_get_info_guest(struct vcpu *v,=0A =0A = /* IOPL privileges are virtualised: merge back into returned eflags. */=0A = BUG_ON((c(user_regs.eflags) & X86_EFLAGS_IOPL) !=3D 0);=0A- = c(user_regs.eflags |=3D v->arch.iopl << 12);=0A+ c(user_regs.eflags = |=3D v->arch.pv_vcpu.iopl << 12);=0A =0A if ( !is_pv_32on64_domain(= v->domain) )=0A {=0A--- a/xen/arch/x86/mm.c=0A+++ b/xen/arch/x86/mm= .c=0A@@ -592,12 +592,12 @@ static void invalidate_shadow_ldt(struct=0A =0A = BUG_ON(unlikely(in_irq()));=0A =0A- spin_lock(&v->arch.shadow_ldt_lo= ck);=0A+ spin_lock(&v->arch.pv_vcpu.shadow_ldt_lock);=0A =0A- if ( = v->arch.shadow_ldt_mapcnt =3D=3D 0 )=0A+ if ( v->arch.pv_vcpu.shadow_ldt= _mapcnt =3D=3D 0 )=0A goto out;=0A =0A- v->arch.shadow_ldt_mapcn= t =3D 0;=0A+ v->arch.pv_vcpu.shadow_ldt_mapcnt =3D 0;=0A =0A for ( = i =3D 16; i < 32; i++ )=0A {=0A@@ -615,7 +615,7 @@ static void = invalidate_shadow_ldt(struct=0A flush_tlb_mask(v->vcpu_dirty_cpumas= k);=0A =0A out:=0A- spin_unlock(&v->arch.shadow_ldt_lock);=0A+ = spin_unlock(&v->arch.pv_vcpu.shadow_ldt_lock);=0A }=0A =0A =0A@@ -666,10 = +666,10 @@ int map_ldt_shadow_page(unsigned int off=0A =0A nl1e =3D = l1e_from_pfn(mfn, l1e_get_flags(l1e) | _PAGE_RW);=0A =0A- spin_lock(&v->= arch.shadow_ldt_lock);=0A+ spin_lock(&v->arch.pv_vcpu.shadow_ldt_lock);= =0A l1e_write(&v->arch.perdomain_ptes[off + 16], nl1e);=0A- = v->arch.shadow_ldt_mapcnt++;=0A- spin_unlock(&v->arch.shadow_ldt_lock);= =0A+ v->arch.pv_vcpu.shadow_ldt_mapcnt++;=0A+ spin_unlock(&v->arch.pv= _vcpu.shadow_ldt_lock);=0A =0A return 1;=0A }=0A--- a/xen/arch/x86/phys= dev.c=0A+++ b/xen/arch/x86/physdev.c=0A@@ -440,7 +440,7 @@ ret_t do_physdev= _op(int cmd, XEN_GUEST_H=0A if ( set_iopl.iopl > 3 )=0A = break;=0A ret =3D 0;=0A- v->arch.iopl =3D set_iopl.iopl;=0A= + v->arch.pv_vcpu.iopl =3D set_iopl.iopl;=0A break;=0A = }=0A =0A@@ -455,11 +455,11 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H=0A = break;=0A ret =3D 0;=0A #ifndef COMPAT=0A- = v->arch.iobmp =3D set_iobitmap.bitmap;=0A+ v->arch.pv_vcpu.iob= mp =3D set_iobitmap.bitmap;=0A #else=0A- guest_from_compat_handle(v-= >arch.iobmp, set_iobitmap.bitmap);=0A+ guest_from_compat_handle(v->a= rch.pv_vcpu.iobmp, set_iobitmap.bitmap);=0A #endif=0A- v->arch.iobmp= _limit =3D set_iobitmap.nr_ports;=0A+ v->arch.pv_vcpu.iobmp_limit = =3D set_iobitmap.nr_ports;=0A break;=0A }=0A =0A--- a/xen/arch/= x86/traps.c=0A+++ b/xen/arch/x86/traps.c=0A@@ -429,7 +429,7 @@ static void = do_guest_trap(=0A =0A trace_pv_trap(trapnr, regs->eip, use_error_code, = regs->error_code);=0A =0A- tb =3D &v->arch.trap_bounce;=0A+ tb =3D = &v->arch.pv_vcpu.trap_bounce;=0A ti =3D &v->arch.pv_vcpu.trap_ctxt[trap= nr];=0A =0A tb->flags =3D TBF_EXCEPTION;=0A@@ -507,7 +507,7 @@ static = unsigned int check_guest_io_break=0A asmlinkage int set_guest_machinecheck_= trapbounce(void)=0A {=0A struct vcpu *v =3D current;=0A- struct = trap_bounce *tb =3D &v->arch.trap_bounce;=0A+ struct trap_bounce *tb = =3D &v->arch.pv_vcpu.trap_bounce;=0A =0A do_guest_trap(TRAP_machine_ch= eck, guest_cpu_user_regs(), 0);=0A tb->flags &=3D ~TBF_EXCEPTION; /* = not needed for MCE delivery path */=0A@@ -521,7 +521,7 @@ asmlinkage int = set_guest_machinecheck_tr=0A asmlinkage int set_guest_nmi_trapbounce(void)= =0A {=0A struct vcpu *v =3D current;=0A- struct trap_bounce *tb =3D = &v->arch.trap_bounce;=0A+ struct trap_bounce *tb =3D &v->arch.pv_vcpu.tr= ap_bounce;=0A do_guest_trap(TRAP_nmi, guest_cpu_user_regs(), 0);=0A = tb->flags &=3D ~TBF_EXCEPTION; /* not needed for NMI delivery path */=0A = return !null_trap_bounce(v, tb);=0A@@ -1007,7 +1007,7 @@ void propagate_= page_fault(unsigned long =0A {=0A struct trap_info *ti;=0A struct = vcpu *v =3D current;=0A- struct trap_bounce *tb =3D &v->arch.trap_bounce= ;=0A+ struct trap_bounce *tb =3D &v->arch.pv_vcpu.trap_bounce;=0A =0A = v->arch.pv_vcpu.ctrlreg[2] =3D addr;=0A arch_set_cr2(v, addr);=0A@@ = -1504,10 +1504,10 @@ static int guest_io_okay(=0A #endif=0A =0A if ( = !vm86_mode(regs) &&=0A- (v->arch.iopl >=3D (guest_kernel_mode(v, = regs) ? 1 : 3)) )=0A+ (v->arch.pv_vcpu.iopl >=3D (guest_kernel_mode= (v, regs) ? 1 : 3)) )=0A return 1;=0A =0A- if ( v->arch.iobmp_li= mit > (port + bytes) )=0A+ if ( v->arch.pv_vcpu.iobmp_limit > (port + = bytes) )=0A {=0A union { uint8_t bytes[2]; uint16_t mask; } = x;=0A =0A@@ -1516,7 +1516,7 @@ static int guest_io_okay(=0A * = read as 0xff (no access allowed).=0A */=0A TOGGLE_MODE();= =0A- switch ( __copy_from_guest_offset(x.bytes, v->arch.iobmp,=0A+ = switch ( __copy_from_guest_offset(x.bytes, v->arch.pv_vcpu.iobmp,=0A = port>>3, 2) )=0A {=0A = default: x.bytes[0] =3D ~0;=0A@@ -2020,7 +2020,7 @@ static int = emulate_privileged_op(struct =0A =0A case 0xfa: /* CLI */=0A case = 0xfb: /* STI */=0A- if ( v->arch.iopl < (guest_kernel_mode(v, regs) = ? 1 : 3) )=0A+ if ( v->arch.pv_vcpu.iopl < (guest_kernel_mode(v, = regs) ? 1 : 3) )=0A goto fail;=0A /*=0A * = This is just too dangerous to allow, in my opinion. Consider if the=0A--- = a/xen/arch/x86/x86_32/asm-offsets.c=0A+++ b/xen/arch/x86/x86_32/asm-offsets= .c=0A@@ -53,7 +53,7 @@ void __dummy__(void)=0A =0A OFFSET(VCPU_processo= r, struct vcpu, processor);=0A OFFSET(VCPU_vcpu_info, struct vcpu, = vcpu_info);=0A- OFFSET(VCPU_trap_bounce, struct vcpu, arch.trap_bounce);= =0A+ OFFSET(VCPU_trap_bounce, struct vcpu, arch.pv_vcpu.trap_bounce);=0A= OFFSET(VCPU_thread_flags, struct vcpu, arch.flags);=0A OFFSET(VCPU= _event_sel, struct vcpu, arch.pv_vcpu.event_callback_cs);=0A OFFSET(VCP= U_event_addr, struct vcpu, arch.pv_vcpu.event_callback_eip);=0A--- = a/xen/arch/x86/x86_32/seg_fixup.c=0A+++ b/xen/arch/x86/x86_32/seg_fixup.c= =0A@@ -546,7 +546,7 @@ int gpf_emulate_4gb(struct cpu_user_regs=0A if = ( VM_ASSIST(curr->domain, VMASST_TYPE_4gb_segments_notify) )=0A {=0A = struct trap_info *ti =3D &curr->arch.pv_vcpu.trap_ctxt[15];=0A- = struct trap_bounce *tb =3D &curr->arch.trap_bounce;=0A+ = struct trap_bounce *tb =3D &curr->arch.pv_vcpu.trap_bounce;=0A =0A = tb->flags =3D TBF_EXCEPTION | TBF_EXCEPTION_ERRCODE;=0A = tb->error_code =3D pb - eip;=0A--- a/xen/arch/x86/x86_32/traps.c=0A+++ = b/xen/arch/x86/x86_32/traps.c=0A@@ -387,12 +387,12 @@ void init_int80_direc= t_trap(struct vcpu =0A if ( TI_GET_IF(ti) || !guest_gate_selector_okay(= v->domain, ti->cs) ||=0A supervisor_mode_kernel )=0A {=0A- = v->arch.int80_desc.a =3D v->arch.int80_desc.b =3D 0;=0A+ = v->arch.pv_vcpu.int80_desc.a =3D v->arch.pv_vcpu.int80_desc.b =3D 0;=0A = return;=0A }=0A =0A- v->arch.int80_desc.a =3D (ti->cs << 16) | = (ti->address & 0xffff);=0A- v->arch.int80_desc.b =3D=0A+ v->arch.pv_v= cpu.int80_desc.a =3D (ti->cs << 16) | (ti->address & 0xffff);=0A+ = v->arch.pv_vcpu.int80_desc.b =3D=0A (ti->address & 0xffff0000) | = 0x8f00 | ((TI_GET_DPL(ti) & 3) << 13);=0A =0A if ( v =3D=3D current = )=0A--- a/xen/arch/x86/x86_64/asm-offsets.c=0A+++ b/xen/arch/x86/x86_64/asm= -offsets.c=0A@@ -65,8 +65,8 @@ void __dummy__(void)=0A OFFSET(VCPU_proc= essor, struct vcpu, processor);=0A OFFSET(VCPU_domain, struct vcpu, = domain);=0A OFFSET(VCPU_vcpu_info, struct vcpu, vcpu_info);=0A- = OFFSET(VCPU_trap_bounce, struct vcpu, arch.trap_bounce);=0A- OFFSET(VCPU= _int80_bounce, struct vcpu, arch.int80_bounce);=0A+ OFFSET(VCPU_trap_bou= nce, struct vcpu, arch.pv_vcpu.trap_bounce);=0A+ OFFSET(VCPU_int80_bounc= e, struct vcpu, arch.pv_vcpu.int80_bounce);=0A OFFSET(VCPU_thread_flags= , struct vcpu, arch.flags);=0A OFFSET(VCPU_event_addr, struct vcpu, = arch.pv_vcpu.event_callback_eip);=0A OFFSET(VCPU_event_sel, struct = vcpu, arch.pv_vcpu.event_callback_cs);=0A@@ -76,14 +76,18 @@ void = __dummy__(void)=0A arch.pv_vcpu.failsafe_callback_cs);=0A = OFFSET(VCPU_syscall_addr, struct vcpu,=0A arch.pv_vcpu.syscall_c= allback_eip);=0A- OFFSET(VCPU_syscall32_addr, struct vcpu, arch.syscall3= 2_callback_eip);=0A- OFFSET(VCPU_syscall32_sel, struct vcpu, arch.syscal= l32_callback_cs);=0A+ OFFSET(VCPU_syscall32_addr, struct vcpu,=0A+ = arch.pv_vcpu.syscall32_callback_eip);=0A+ OFFSET(VCPU_syscall32_sel= , struct vcpu,=0A+ arch.pv_vcpu.syscall32_callback_cs);=0A = OFFSET(VCPU_syscall32_disables_events, struct vcpu,=0A- = arch.syscall32_disables_events);=0A- OFFSET(VCPU_sysenter_addr, struct = vcpu, arch.sysenter_callback_eip);=0A- OFFSET(VCPU_sysenter_sel, struct = vcpu, arch.sysenter_callback_cs);=0A+ arch.pv_vcpu.syscall32_disa= bles_events);=0A+ OFFSET(VCPU_sysenter_addr, struct vcpu,=0A+ = arch.pv_vcpu.sysenter_callback_eip);=0A+ OFFSET(VCPU_sysenter_sel, = struct vcpu,=0A+ arch.pv_vcpu.sysenter_callback_cs);=0A = OFFSET(VCPU_sysenter_disables_events, struct vcpu,=0A- arch.sysen= ter_disables_events);=0A+ arch.pv_vcpu.sysenter_disables_events);= =0A OFFSET(VCPU_trap_ctxt, struct vcpu, arch.pv_vcpu.trap_ctxt);=0A = OFFSET(VCPU_kernel_sp, struct vcpu, arch.pv_vcpu.kernel_sp);=0A = OFFSET(VCPU_kernel_ss, struct vcpu, arch.pv_vcpu.kernel_ss);=0A--- = a/xen/arch/x86/x86_64/compat/traps.c=0A+++ b/xen/arch/x86/x86_64/compat/tra= ps.c=0A@@ -190,16 +190,16 @@ static long compat_register_guest_callba=0A = break;=0A =0A case CALLBACKTYPE_syscall32:=0A- v->arch.sys= call32_callback_cs =3D reg->address.cs;=0A- v->arch.syscall32_ca= llback_eip =3D reg->address.eip;=0A- v->arch.syscall32_disables_e= vents =3D=0A+ v->arch.pv_vcpu.syscall32_callback_cs =3D = reg->address.cs;=0A+ v->arch.pv_vcpu.syscall32_callback_eip =3D = reg->address.eip;=0A+ v->arch.pv_vcpu.syscall32_disables_events = =3D=0A (reg->flags & CALLBACKF_mask_events) !=3D 0;=0A = break;=0A =0A case CALLBACKTYPE_sysenter:=0A- v->arch.sysenter_c= allback_cs =3D reg->address.cs;=0A- v->arch.sysenter_callback_ei= p =3D reg->address.eip;=0A- v->arch.sysenter_disables_events = =3D=0A+ v->arch.pv_vcpu.sysenter_callback_cs =3D reg->address.cs= ;=0A+ v->arch.pv_vcpu.sysenter_callback_eip =3D reg->address.eip;= =0A+ v->arch.pv_vcpu.sysenter_disables_events =3D=0A = (reg->flags & CALLBACKF_mask_events) !=3D 0;=0A break;=0A =0A--- = a/xen/arch/x86/x86_64/traps.c=0A+++ b/xen/arch/x86/x86_64/traps.c=0A@@ = -422,7 +422,7 @@ void __devinit subarch_percpu_traps_init=0A void = init_int80_direct_trap(struct vcpu *v)=0A {=0A struct trap_info *ti = =3D &v->arch.pv_vcpu.trap_ctxt[0x80];=0A- struct trap_bounce *tb =3D = &v->arch.int80_bounce;=0A+ struct trap_bounce *tb =3D &v->arch.pv_vcpu.i= nt80_bounce;=0A =0A tb->flags =3D TBF_EXCEPTION;=0A tb->cs =3D = ti->cs;=0A@@ -467,14 +467,14 @@ static long register_guest_callback(stru=0A= break;=0A =0A case CALLBACKTYPE_syscall32:=0A- = v->arch.syscall32_callback_eip =3D reg->address;=0A- v->arch.syscall= 32_disables_events =3D=0A+ v->arch.pv_vcpu.syscall32_callback_eip = =3D reg->address;=0A+ v->arch.pv_vcpu.syscall32_disables_events = =3D=0A !!(reg->flags & CALLBACKF_mask_events);=0A = break;=0A =0A case CALLBACKTYPE_sysenter:=0A- v->arch.sysenter_c= allback_eip =3D reg->address;=0A- v->arch.sysenter_disables_events = =3D=0A+ v->arch.pv_vcpu.sysenter_callback_eip =3D reg->address;=0A+ = v->arch.pv_vcpu.sysenter_disables_events =3D=0A = !!(reg->flags & CALLBACKF_mask_events);=0A break;=0A =0A--- = a/xen/include/asm-x86/domain.h=0A+++ b/xen/include/asm-x86/domain.h=0A@@ = -378,11 +378,38 @@ struct pv_vcpu=0A unsigned long vm_assist;=0A =0A = #ifdef CONFIG_X86_64=0A+ unsigned long syscall32_callback_eip;=0A+ = unsigned long sysenter_callback_eip;=0A+ unsigned short syscall32_callba= ck_cs;=0A+ unsigned short sysenter_callback_cs;=0A+ bool_t syscall32_= disables_events;=0A+ bool_t sysenter_disables_events;=0A+=0A /* = Segment base addresses. */=0A unsigned long fs_base;=0A unsigned = long gs_base_kernel;=0A unsigned long gs_base_user;=0A #endif=0A+=0A+ = /* Bounce information for propagating an exception to guest OS. */=0A+ = struct trap_bounce trap_bounce;=0A+#ifdef CONFIG_X86_64=0A+ struct = trap_bounce int80_bounce;=0A+#else=0A+ struct desc_struct int80_desc;=0A= +#endif=0A+=0A+ /* I/O-port access bitmap. */=0A+ XEN_GUEST_HANDLE(ui= nt8) iobmp; /* Guest kernel vaddr of the bitmap. */=0A+ unsigned int = iobmp_limit; /* Number of ports represented in the bitmap. */=0A+ = unsigned int iopl; /* Current IOPL for this VCPU. */=0A+=0A+ /* = Current LDT details. */=0A+ unsigned long shadow_ldt_mapcnt;=0A+ = spinlock_t shadow_ldt_lock;=0A+=0A+ /* Guest-specified relocation of = vcpu_info. */=0A+ unsigned long vcpu_info_mfn;=0A };=0A =0A struct = arch_vcpu=0A@@ -408,27 +435,6 @@ struct arch_vcpu=0A void (*ctxt_switch= _from) (struct vcpu *);=0A void (*ctxt_switch_to) (struct vcpu *);=0A = =0A- /* Bounce information for propagating an exception to guest OS. = */=0A- struct trap_bounce trap_bounce;=0A-=0A- /* I/O-port access = bitmap. */=0A- XEN_GUEST_HANDLE(uint8) iobmp; /* Guest kernel vaddr of = the bitmap. */=0A- int iobmp_limit; /* Number of ports represented in = the bitmap. */=0A- int iopl; /* Current IOPL for this VCPU. = */=0A-=0A-#ifdef CONFIG_X86_32=0A- struct desc_struct int80_desc;=0A-#en= dif=0A-#ifdef CONFIG_X86_64=0A- struct trap_bounce int80_bounce;=0A- = unsigned long syscall32_callback_eip;=0A- unsigned long = sysenter_callback_eip;=0A- unsigned short syscall32_callback_cs;=0A-= unsigned short sysenter_callback_cs;=0A- bool_t = syscall32_disables_events;=0A- bool_t sysenter_disables_even= ts;=0A-#endif=0A-=0A /* Virtual Machine Extensions */=0A union = {=0A struct pv_vcpu pv_vcpu;=0A@@ -468,15 +474,8 @@ struct = arch_vcpu=0A */=0A uint64_t xcr0_accum;=0A =0A- /* Current LDT = details. */=0A- unsigned long shadow_ldt_mapcnt;=0A- spinlock_t = shadow_ldt_lock;=0A-=0A struct paging_vcpu paging;=0A =0A- /* = Guest-specified relocation of vcpu_info. */=0A- unsigned long vcpu_info_= mfn;=0A-=0A #ifdef CONFIG_X86_32=0A /* map_domain_page() mapping = cache. */=0A struct mapcache_vcpu mapcache;=0A--- a/xen/include/asm-x86= /processor.h=0A+++ b/xen/include/asm-x86/processor.h=0A@@ -474,7 +474,7 @@ = extern void init_int80_direct_trap(struc=0A =0A #define set_int80_direct_tr= ap(_ed) \=0A (memcpy(idt_tables[(_ed)->processor] + = 0x80, \=0A- &((_ed)->arch.int80_desc), 8))=0A+ = &((_ed)->arch.pv_vcpu.int80_desc), 8))=0A =0A #else=0A =0A --=__Part90BC4AFF.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part90BC4AFF.0__=--