ia64/xen-unstable

changeset 6557:df589c4cf1ad

Update __vmread()
To make it not to break the stack.

Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
Signed-off-by: Chengyuan Li <chengyuan.li@intel.com>
author lcy@vtsmp-build.sh.intel.com
date Sun Aug 28 14:55:37 2005 +0800 (2005-08-28)
parents dfaf788ab18c
children 0bc9e2af21c8
files xen/include/asm-x86/vmx.h
line diff
     1.1 --- a/xen/include/asm-x86/vmx.h	Fri Aug 26 13:47:16 2005 -0700
     1.2 +++ b/xen/include/asm-x86/vmx.h	Sun Aug 28 14:55:37 2005 +0800
     1.3 @@ -275,7 +275,9 @@ static inline int __vmpclear (u64 addr)
     1.4      return 0;
     1.5  }
     1.6  
     1.7 -static inline int __vmread (unsigned long field, void *value)
     1.8 +#define __vmread(x, ptr) ___vmread((x), (ptr), sizeof(*(ptr)))
     1.9 +
    1.10 +static always_inline int ___vmread (const unsigned long field,  void *ptr, const int size)
    1.11  {
    1.12      unsigned long eflags;
    1.13      unsigned long ecx = 0;
    1.14 @@ -286,7 +288,23 @@ static inline int __vmread (unsigned lon
    1.15                             : "a" (field)
    1.16                             : "memory");
    1.17  
    1.18 -    *((long *) value) = ecx;
    1.19 +    switch (size) {
    1.20 +    case 1:
    1.21 +        *((u8 *) (ptr)) = ecx;
    1.22 +        break;
    1.23 +    case 2:
    1.24 +        *((u16 *) (ptr)) = ecx;
    1.25 +        break;
    1.26 +    case 4:
    1.27 +        *((u32 *) (ptr)) = ecx;
    1.28 +        break;
    1.29 +    case 8:
    1.30 +        *((u64 *) (ptr)) = ecx;
    1.31 +        break;
    1.32 +    default:
    1.33 +        domain_crash_synchronous();
    1.34 +        break;
    1.35 +    }
    1.36  
    1.37      __save_flags(eflags);
    1.38      if (eflags & X86_EFLAGS_ZF || eflags & X86_EFLAGS_CF)