debuggers.hg

changeset 19950:721c14d7f60b

x86 hvm: Use 'x' as parameter name for macros converting between
{vcpu,domain} and {vlapic,vpic,vrtc,hpet}. Completely avoids
accidental aliasing.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jul 08 14:22:00 2009 +0100 (2009-07-08)
parents e7d4fd334626
children ef38784f9f85
files xen/arch/x86/hvm/hpet.c xen/arch/x86/hvm/i8254.c xen/arch/x86/hvm/rtc.c xen/arch/x86/hvm/vlapic.c xen/include/asm-x86/hvm/vlapic.h
line diff
     1.1 --- a/xen/arch/x86/hvm/hpet.c	Wed Jul 08 11:00:23 2009 +0100
     1.2 +++ b/xen/arch/x86/hvm/hpet.c	Wed Jul 08 14:22:00 2009 +0100
     1.3 @@ -24,11 +24,11 @@
     1.4  #include <xen/sched.h>
     1.5  #include <xen/event.h>
     1.6  
     1.7 -#define domain_vhpet(d)    (&(d)->arch.hvm_domain.pl_time.vhpet)
     1.8 -#define vcpu_vhpet(vcpu)   (domain_vhpet((vcpu)->domain))
     1.9 -#define vhpet_domain(hpet) (container_of((hpet), struct domain, \
    1.10 -                                         arch.hvm_domain.pl_time.vhpet))
    1.11 -#define vhpet_vcpu(hpet)   (pt_global_vcpu_target(vhpet_domain(hpet)))
    1.12 +#define domain_vhpet(x) (&(x)->arch.hvm_domain.pl_time.vhpet)
    1.13 +#define vcpu_vhpet(x)   (domain_vhpet((x)->domain))
    1.14 +#define vhpet_domain(x) (container_of((x), struct domain, \
    1.15 +                                      arch.hvm_domain.pl_time.vhpet))
    1.16 +#define vhpet_vcpu(x)   (pt_global_vcpu_target(vhpet_domain(x)))
    1.17  
    1.18  #define HPET_BASE_ADDRESS   0xfed00000ULL
    1.19  #define HPET_MMAP_SIZE      1024
     2.1 --- a/xen/arch/x86/hvm/i8254.c	Wed Jul 08 11:00:23 2009 +0100
     2.2 +++ b/xen/arch/x86/hvm/i8254.c	Wed Jul 08 14:22:00 2009 +0100
     2.3 @@ -38,11 +38,11 @@
     2.4  #include <asm/hvm/vpt.h>
     2.5  #include <asm/current.h>
     2.6  
     2.7 -#define domain_vpit(d)   (&(d)->arch.hvm_domain.pl_time.vpit)
     2.8 -#define vcpu_vpit(vcpu)  (domain_vpit((vcpu)->domain))
     2.9 -#define vpit_domain(pit) (container_of((pit), struct domain, \
    2.10 -                                       arch.hvm_domain.pl_time.vpit))
    2.11 -#define vpit_vcpu(pit)   (pt_global_vcpu_target(vpit_domain(pit)))
    2.12 +#define domain_vpit(x) (&(x)->arch.hvm_domain.pl_time.vpit)
    2.13 +#define vcpu_vpit(x)   (domain_vpit((x)->domain))
    2.14 +#define vpit_domain(x) (container_of((x), struct domain, \
    2.15 +                                     arch.hvm_domain.pl_time.vpit))
    2.16 +#define vpit_vcpu(x)   (pt_global_vcpu_target(vpit_domain(x)))
    2.17  
    2.18  #define RW_STATE_LSB 1
    2.19  #define RW_STATE_MSB 2
     3.1 --- a/xen/arch/x86/hvm/rtc.c	Wed Jul 08 11:00:23 2009 +0100
     3.2 +++ b/xen/arch/x86/hvm/rtc.c	Wed Jul 08 14:22:00 2009 +0100
     3.3 @@ -28,11 +28,11 @@
     3.4  #include <asm/hvm/support.h>
     3.5  #include <asm/current.h>
     3.6  
     3.7 -#define domain_vrtc(d)   (&(d)->arch.hvm_domain.pl_time.vrtc)
     3.8 -#define vcpu_vrtc(vcpu)  (domain_vrtc((vcpu)->domain))
     3.9 -#define vrtc_domain(rtc) (container_of((rtc), struct domain, \
    3.10 -                                       arch.hvm_domain.pl_time.vrtc))
    3.11 -#define vrtc_vcpu(rtc)   (pt_global_vcpu_target(vrtc_domain(rtc)))
    3.12 +#define domain_vrtc(x) (&(x)->arch.hvm_domain.pl_time.vrtc)
    3.13 +#define vcpu_vrtc(x)   (domain_vrtc((x)->domain))
    3.14 +#define vrtc_domain(x) (container_of((x), struct domain, \
    3.15 +                                     arch.hvm_domain.pl_time.vrtc))
    3.16 +#define vrtc_vcpu(x)   (pt_global_vcpu_target(vrtc_domain(x)))
    3.17  
    3.18  static void rtc_periodic_cb(struct vcpu *v, void *opaque)
    3.19  {
     4.1 --- a/xen/arch/x86/hvm/vlapic.c	Wed Jul 08 11:00:23 2009 +0100
     4.2 +++ b/xen/arch/x86/hvm/vlapic.c	Wed Jul 08 14:22:00 2009 +0100
     4.3 @@ -460,7 +460,7 @@ int vlapic_ipi(
     4.4  
     4.5      if ( delivery_mode == APIC_DM_LOWEST )
     4.6      {
     4.7 -        target = apic_lowest_prio(vlapic_domain(v), lpr_map);
     4.8 +        target = apic_lowest_prio(vlapic_domain(vlapic), lpr_map);
     4.9          if ( target != NULL )
    4.10              rc = vlapic_accept_irq(vlapic_vcpu(target), delivery_mode,
    4.11                                     vector, level, trig_mode);
     5.1 --- a/xen/include/asm-x86/hvm/vlapic.h	Wed Jul 08 11:00:23 2009 +0100
     5.2 +++ b/xen/include/asm-x86/hvm/vlapic.h	Wed Jul 08 14:22:00 2009 +0100
     5.3 @@ -28,10 +28,9 @@
     5.4  
     5.5  #define MAX_VECTOR      256
     5.6  
     5.7 -#define vcpu_vlapic(vcpu)   (&(vcpu)->arch.hvm_vcpu.vlapic)
     5.8 -#define vlapic_vcpu(vpic)   (container_of((vpic), struct vcpu, \
     5.9 -                                          arch.hvm_vcpu.vlapic))
    5.10 -#define vlapic_domain(vpic) (vlapic_vcpu(vlapic)->domain)
    5.11 +#define vcpu_vlapic(x)   (&(x)->arch.hvm_vcpu.vlapic)
    5.12 +#define vlapic_vcpu(x)   (container_of((x), struct vcpu, arch.hvm_vcpu.vlapic))
    5.13 +#define vlapic_domain(x) (vlapic_vcpu(x)->domain)
    5.14  
    5.15  #define VLAPIC_ID(vlapic)   \
    5.16      (GET_xAPIC_ID(vlapic_get_reg((vlapic), APIC_ID)))