|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 03/24] PVH xen: turn gdb_frames/gdt_ents into union
On Wed, Jul 17, 2013 at 07:32:47PM -0700, Mukesh Rathor wrote:
> Changes in V2:
> - Add __XEN_INTERFACE_VERSION__
>
> Changes in V3:
> - Rename union to 'gdt' and rename field names.
>
> Signed-off-by: Mukesh Rathor <mukesh.rathor@xxxxxxxxxx>
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> ---
> tools/libxc/xc_domain_restore.c | 8 ++++----
> tools/libxc/xc_domain_save.c | 6 +++---
> xen/arch/x86/domain.c | 12 ++++++------
> xen/arch/x86/domctl.c | 12 ++++++------
> xen/include/public/arch-x86/xen.h | 14 ++++++++++++++
> 5 files changed, 33 insertions(+), 19 deletions(-)
>
> diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c
> index 63d36cd..47aaca0 100644
> --- a/tools/libxc/xc_domain_restore.c
> +++ b/tools/libxc/xc_domain_restore.c
> @@ -2055,15 +2055,15 @@ int xc_domain_restore(xc_interface *xch, int io_fd,
> uint32_t dom,
> munmap(start_info, PAGE_SIZE);
> }
> /* Uncanonicalise each GDT frame number. */
> - if ( GET_FIELD(ctxt, gdt_ents) > 8192 )
> + if ( GET_FIELD(ctxt, gdt.pv.num_ents) > 8192 )
> {
> ERROR("GDT entry count out of range");
> goto out;
> }
>
> - for ( j = 0; (512*j) < GET_FIELD(ctxt, gdt_ents); j++ )
> + for ( j = 0; (512*j) < GET_FIELD(ctxt, gdt.pv.num_ents); j++ )
> {
> - pfn = GET_FIELD(ctxt, gdt_frames[j]);
> + pfn = GET_FIELD(ctxt, gdt.pv.frames[j]);
> if ( (pfn >= dinfo->p2m_size) ||
> (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB) )
> {
> @@ -2071,7 +2071,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd,
> uint32_t dom,
> j, (unsigned long)pfn);
> goto out;
> }
> - SET_FIELD(ctxt, gdt_frames[j], ctx->p2m[pfn]);
> + SET_FIELD(ctxt, gdt.pv.frames[j], ctx->p2m[pfn]);
> }
> /* Uncanonicalise the page table base pointer. */
> pfn = UNFOLD_CR3(GET_FIELD(ctxt, ctrlreg[3]));
> diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
> index fbc15e9..e938628 100644
> --- a/tools/libxc/xc_domain_save.c
> +++ b/tools/libxc/xc_domain_save.c
> @@ -1907,15 +1907,15 @@ int xc_domain_save(xc_interface *xch, int io_fd,
> uint32_t dom, uint32_t max_iter
> }
>
> /* Canonicalise each GDT frame number. */
> - for ( j = 0; (512*j) < GET_FIELD(&ctxt, gdt_ents); j++ )
> + for ( j = 0; (512*j) < GET_FIELD(&ctxt, gdt.pv.num_ents); j++ )
> {
> - mfn = GET_FIELD(&ctxt, gdt_frames[j]);
> + mfn = GET_FIELD(&ctxt, gdt.pv.frames[j]);
> if ( !MFN_IS_IN_PSEUDOPHYS_MAP(mfn) )
> {
> ERROR("GDT frame is not in range of pseudophys map");
> goto out;
> }
> - SET_FIELD(&ctxt, gdt_frames[j], mfn_to_pfn(mfn));
> + SET_FIELD(&ctxt, gdt.pv.frames[j], mfn_to_pfn(mfn));
> }
>
> /* Canonicalise the page table base pointer. */
> diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
> index 874742c..73ddad7 100644
> --- a/xen/arch/x86/domain.c
> +++ b/xen/arch/x86/domain.c
> @@ -784,8 +784,8 @@ int arch_set_info_guest(
> }
>
> for ( i = 0; i < ARRAY_SIZE(v->arch.pv_vcpu.gdt_frames); ++i )
> - fail |= v->arch.pv_vcpu.gdt_frames[i] != c(gdt_frames[i]);
> - fail |= v->arch.pv_vcpu.gdt_ents != c(gdt_ents);
> + fail |= v->arch.pv_vcpu.gdt_frames[i] != c(gdt.pv.frames[i]);
> + fail |= v->arch.pv_vcpu.gdt_ents != c(gdt.pv.num_ents);
>
> fail |= v->arch.pv_vcpu.ldt_base != c(ldt_base);
> fail |= v->arch.pv_vcpu.ldt_ents != c(ldt_ents);
> @@ -838,17 +838,17 @@ int arch_set_info_guest(
> return rc;
>
> if ( !compat )
> - rc = (int)set_gdt(v, c.nat->gdt_frames, c.nat->gdt_ents);
> + rc = (int)set_gdt(v, c.nat->gdt.pv.frames, c.nat->gdt.pv.num_ents);
> else
> {
> unsigned long gdt_frames[ARRAY_SIZE(v->arch.pv_vcpu.gdt_frames)];
> - unsigned int n = (c.cmp->gdt_ents + 511) / 512;
> + unsigned int n = (c.cmp->gdt.pv.num_ents + 511) / 512;
>
> if ( n > ARRAY_SIZE(v->arch.pv_vcpu.gdt_frames) )
> return -EINVAL;
> for ( i = 0; i < n; ++i )
> - gdt_frames[i] = c.cmp->gdt_frames[i];
> - rc = (int)set_gdt(v, gdt_frames, c.cmp->gdt_ents);
> + gdt_frames[i] = c.cmp->gdt.pv.frames[i];
> + rc = (int)set_gdt(v, gdt_frames, c.cmp->gdt.pv.num_ents);
> }
> if ( rc != 0 )
> return rc;
> diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
> index c2a04c4..f87d6ab 100644
> --- a/xen/arch/x86/domctl.c
> +++ b/xen/arch/x86/domctl.c
> @@ -1300,12 +1300,12 @@ void arch_get_info_guest(struct vcpu *v,
> vcpu_guest_context_u c)
> c(ldt_base = v->arch.pv_vcpu.ldt_base);
> c(ldt_ents = v->arch.pv_vcpu.ldt_ents);
> for ( i = 0; i < ARRAY_SIZE(v->arch.pv_vcpu.gdt_frames); ++i )
> - c(gdt_frames[i] = v->arch.pv_vcpu.gdt_frames[i]);
> - BUILD_BUG_ON(ARRAY_SIZE(c.nat->gdt_frames) !=
> - ARRAY_SIZE(c.cmp->gdt_frames));
> - for ( ; i < ARRAY_SIZE(c.nat->gdt_frames); ++i )
> - c(gdt_frames[i] = 0);
> - c(gdt_ents = v->arch.pv_vcpu.gdt_ents);
> + c(gdt.pv.frames[i] = v->arch.pv_vcpu.gdt_frames[i]);
> + BUILD_BUG_ON(ARRAY_SIZE(c.nat->gdt.pv.frames) !=
> + ARRAY_SIZE(c.cmp->gdt.pv.frames));
> + for ( ; i < ARRAY_SIZE(c.nat->gdt.pv.frames); ++i )
> + c(gdt.pv.frames[i] = 0);
> + c(gdt.pv.num_ents = v->arch.pv_vcpu.gdt_ents);
> c(kernel_ss = v->arch.pv_vcpu.kernel_ss);
> c(kernel_sp = v->arch.pv_vcpu.kernel_sp);
> for ( i = 0; i < ARRAY_SIZE(v->arch.pv_vcpu.ctrlreg); ++i )
> diff --git a/xen/include/public/arch-x86/xen.h
> b/xen/include/public/arch-x86/xen.h
> index b7f6a51..25c8519 100644
> --- a/xen/include/public/arch-x86/xen.h
> +++ b/xen/include/public/arch-x86/xen.h
> @@ -170,7 +170,21 @@ struct vcpu_guest_context {
> struct cpu_user_regs user_regs; /* User-level CPU registers
> */
> struct trap_info trap_ctxt[256]; /* Virtual IDT
> */
> unsigned long ldt_base, ldt_ents; /* LDT (linear address, # ents)
> */
> +#if __XEN_INTERFACE_VERSION__ < 0x00040400
> unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents)
> */
> +#else
> + union {
> + struct {
> + /* GDT (machine frames, # ents) */
> + unsigned long frames[16], num_ents;
> + } pv;
> + struct {
> + /* PVH: GDTR addr and size */
> + uint64_t addr;
> + uint16_t limit;
> + } pvh;
> + } gdt;
> +#endif
> unsigned long kernel_ss, kernel_sp; /* Virtual TSS (only SS1/SP1)
> */
> /* NB. User pagetable on x86/64 is placed in ctrlreg[1]. */
> unsigned long ctrlreg[8]; /* CR0-CR7 (control registers)
> */
> --
> 1.7.2.3
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |