mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
bitkeeper revision 1.1357.1.1 (42681e7b7KG-juYnPnNfse4HYMkaMw)
Make find_highest_irq() work for both 32 and 64 bit. Signed-off-by: Xin B Li <xin.b.li@intel.com> Signed-off-by: ian@xensource.com
This commit is contained in:
1 parent
c184a240a5
commit
db9037d21a
1 file changed
+33
-34
+33
-34
@@ -282,7 +282,7 @@ void vmx_io_assist(struct exec_domain *ed)
|
||||
}
|
||||
}
|
||||
|
||||
#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 -1;
|
||||
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]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||