# HG changeset patch # User maf46@burn.cl.cam.ac.uk # Date 1114104854 0 # Node ID acc0c98dfe3fdfbb9ed4825dc6cf64ed2f39b25c # Parent 37be770f866c638266a1acfb473c1ed6dab68aed bitkeeper revision 1.1340.1.3 (4267e4164-4aUgpDERur941-hMFzxg) fix vmx problems Signed-off-by: Xin B Li Signed-off-by: Arun Sharma Signed-off-by: michael.fetterman@cl.cam.ac.uk diff -r 37be770f866c -r acc0c98dfe3f xen/arch/x86/vmx_io.c --- a/xen/arch/x86/vmx_io.c Thu Apr 21 17:30:34 2005 +0000 +++ b/xen/arch/x86/vmx_io.c Thu Apr 21 17:34:14 2005 +0000 @@ -282,7 +282,7 @@ void vmx_io_assist(struct exec_domain *e } } -#ifdef __i386__ +#if defined(__i386__) || defined(__x86_64__) static inline int __fls(u32 word) { int bit; @@ -296,53 +296,52 @@ static inline int __fls(u32 word) #define __fls(x) generic_fls(x) static __inline__ int generic_fls(u32 x) { - int r = 32; + int r = 31; - if (!x) - return 0; - if (!(x & 0xffff0000u)) { - x <<= 16; - r -= 16; - } - if (!(x & 0xff000000u)) { - x <<= 8; - r -= 8; - } - if (!(x & 0xf0000000u)) { - x <<= 4; - r -= 4; - } - if (!(x & 0xc0000000u)) { - x <<= 2; - r -= 2; - } - if (!(x & 0x80000000u)) { - x <<= 1; - r -= 1; - } - return r; + if (!x) + return 0; + if (!(x & 0xffff0000u)) { + x <<= 16; + r -= 16; + } + if (!(x & 0xff000000u)) { + x <<= 8; + r -= 8; + } + if (!(x & 0xf0000000u)) { + x <<= 4; + r -= 4; + } + if (!(x & 0xc0000000u)) { + x <<= 2; + r -= 2; + } + if (!(x & 0x80000000u)) { + x <<= 1; + r -= 1; + } + return r; } #endif - /* Simple minded Local APIC priority implementation. Fix later */ static __inline__ int find_highest_irq(u32 *pintr) { if (pintr[7]) - return __fls(pintr[7]) + (255-32*1); + return __fls(pintr[7]) + (256-32*1); if (pintr[6]) - return __fls(pintr[6]) + (255-32*2); + return __fls(pintr[6]) + (256-32*2); if (pintr[5]) - return __fls(pintr[5]) + (255-32*3); + return __fls(pintr[5]) + (256-32*3); if (pintr[4]) - return __fls(pintr[4]) + (255-32*4); + return __fls(pintr[4]) + (256-32*4); if (pintr[3]) - return __fls(pintr[3]) + (255-32*5); + return __fls(pintr[3]) + (256-32*5); if (pintr[2]) - return __fls(pintr[2]) + (255-32*6); + return __fls(pintr[2]) + (256-32*6); if (pintr[1]) - return __fls(pintr[1]) + (255-32*7); - return (__fls(pintr[0])-1); + return __fls(pintr[1]) + (256-32*7); + return __fls(pintr[0]); } /*