ia64/xen-unstable

changeset 14176:f3271ae6a485

[XEN] Compat-mode dom0 always provides compat vcpu_guest_context structs.
Update arch_set_info_guest to do the right thing.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Wed Feb 28 13:19:16 2007 +0000 (2007-02-28)
parents 5943a8314d69
children 0f0ac445bf82
files xen/arch/x86/domain.c
line diff
     1.1 --- a/xen/arch/x86/domain.c	Wed Feb 28 13:17:27 2007 +0000
     1.2 +++ b/xen/arch/x86/domain.c	Wed Feb 28 13:19:16 2007 +0000
     1.3 @@ -497,18 +497,26 @@ int arch_set_info_guest(
     1.4      struct vcpu *v, vcpu_guest_context_u c)
     1.5  {
     1.6      struct domain *d = v->domain;
     1.7 +    unsigned long cr3_pfn = INVALID_MFN;
     1.8 +    unsigned long flags;
     1.9 +    int i, rc, compat;
    1.10 +
    1.11 +    /* The context is a compat-mode one if *either* the calling domain 
    1.12 +     * or the target domain is compat-mode: if the caller is compat, it
    1.13 +     * won't know to make a native context, and if the target is compat,
    1.14 +     * the tools will have made a compat-mode context for it. */
    1.15 +    compat = IS_COMPAT(d) || IS_COMPAT(current->domain);
    1.16 +
    1.17  #ifdef CONFIG_COMPAT
    1.18 -#define c(fld) (!IS_COMPAT(d) ? (c.nat->fld) : (c.cmp->fld))
    1.19 +#define c(fld) (compat ? (c.cmp->fld) : (c.nat->fld))
    1.20  #else
    1.21  #define c(fld) (c.nat->fld)
    1.22  #endif
    1.23 -    unsigned long cr3_pfn = INVALID_MFN;
    1.24 -    unsigned long flags = c(flags);
    1.25 -    int i, rc;
    1.26 +    flags = c(flags);
    1.27  
    1.28      if ( !is_hvm_vcpu(v) )
    1.29      {
    1.30 -        if ( !IS_COMPAT(d) )
    1.31 +        if ( !compat )
    1.32          {
    1.33              fixup_guest_stack_selector(d, c.nat->user_regs.ss);
    1.34              fixup_guest_stack_selector(d, c.nat->kernel_ss);
    1.35 @@ -560,7 +568,7 @@ int arch_set_info_guest(
    1.36      if ( (flags & VGCF_in_kernel) || is_hvm_vcpu(v)/*???*/ )
    1.37          v->arch.flags |= TF_kernel_mode;
    1.38  
    1.39 -    if ( !IS_COMPAT(v->domain) )
    1.40 +    if ( !compat )
    1.41          memcpy(&v->arch.guest_context, c.nat, sizeof(*c.nat));
    1.42  #ifdef CONFIG_COMPAT
    1.43      else
    1.44 @@ -602,7 +610,7 @@ int arch_set_info_guest(
    1.45  
    1.46      if ( !is_hvm_vcpu(v) )
    1.47      {
    1.48 -        if ( !IS_COMPAT(d) )
    1.49 +        if ( !compat )
    1.50              rc = (int)set_gdt(v, c.nat->gdt_frames, c.nat->gdt_ents);
    1.51  #ifdef CONFIG_COMPAT
    1.52          else
    1.53 @@ -620,7 +628,7 @@ int arch_set_info_guest(
    1.54          if ( rc != 0 )
    1.55              return rc;
    1.56  
    1.57 -        if ( !IS_COMPAT(d) )
    1.58 +        if ( !compat )
    1.59          {
    1.60              cr3_pfn = gmfn_to_mfn(d, xen_cr3_to_pfn(c.nat->ctrlreg[3]));
    1.61