|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] [xen-unstable] x86, time: Fix scale_reciprocal().
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1228488398 0
# Node ID c520af4bde59d5756d6c58014d5ae0b9011840bc
# Parent 4ffd935c08a3e88fa67328efc4f7bbdbce4a162b
x86, time: Fix scale_reciprocal().
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
xen/arch/x86/time.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff -r 4ffd935c08a3 -r c520af4bde59 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c Fri Dec 05 13:06:57 2008 +0000
+++ b/xen/arch/x86/time.c Fri Dec 05 14:46:38 2008 +0000
@@ -152,14 +152,23 @@ static inline u64 scale_delta(u64 delta,
/* Compute the reciprocal of the given time_scale. */
static inline struct time_scale scale_reciprocal(struct time_scale scale)
{
- u32 q, r;
+ struct time_scale reciprocal;
+ u32 dividend;
+
+ dividend = 0x80000000u;
+ reciprocal.shift = 1 - scale.shift;
+ while ( unlikely(dividend >= scale.mul_frac) )
+ {
+ dividend >>= 1;
+ reciprocal.shift++;
+ }
asm (
"divl %4"
- : "=a" (q), "=d" (r)
- : "0" (1), "1" (0), "r" (scale.mul_frac) );
-
- return (struct time_scale) { .shift = -scale.shift, .mul_frac = q };
+ : "=a" (reciprocal.mul_frac), "=d" (dividend)
+ : "0" (0), "1" (dividend), "r" (scale.mul_frac) );
+
+ return reciprocal;
}
/*
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-changelog] [xen-unstable] x86, time: Fix scale_reciprocal().,
Xen patchbot-unstable <=
|
|
|
|
|