diff options
author | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2008-06-12 04:47:58 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-12 04:47:58 -0400 |
commit | d5e181f78ac753893eb930868a52a4488cd3de0a (patch) | |
tree | 7d2f71fd3c84196f0d81a9e44861743b74e58ef6 /include/linux/math64.h | |
parent | f595ec964daf7f99668039d7303ddedd09a75142 (diff) |
add an inlined version of iter_div_u64_rem
iter_div_u64_rem is used in the x86-64 vdso, which cannot call other
kernel code. For this case, provide the always_inlined version,
__iter_div_u64_rem.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/math64.h')
-rw-r--r-- | include/linux/math64.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/math64.h b/include/linux/math64.h index 177785e1e4a3..c87f1528703a 100644 --- a/include/linux/math64.h +++ b/include/linux/math64.h | |||
@@ -83,4 +83,23 @@ static inline s64 div_s64(s64 dividend, s32 divisor) | |||
83 | 83 | ||
84 | u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder); | 84 | u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder); |
85 | 85 | ||
86 | static __always_inline u32 | ||
87 | __iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) | ||
88 | { | ||
89 | u32 ret = 0; | ||
90 | |||
91 | while (dividend >= divisor) { | ||
92 | /* The following asm() prevents the compiler from | ||
93 | optimising this loop into a modulo operation. */ | ||
94 | asm("" : "+rm"(dividend)); | ||
95 | |||
96 | dividend -= divisor; | ||
97 | ret++; | ||
98 | } | ||
99 | |||
100 | *remainder = dividend; | ||
101 | |||
102 | return ret; | ||
103 | } | ||
104 | |||
86 | #endif /* _LINUX_MATH64_H */ | 105 | #endif /* _LINUX_MATH64_H */ |