| .. | .. |
|---|
| 73 | 73 | |
|---|
| 74 | 74 | #else |
|---|
| 75 | 75 | # include <asm-generic/div64.h> |
|---|
| 76 | + |
|---|
| 77 | +/* |
|---|
| 78 | + * Will generate an #DE when the result doesn't fit u64, could fix with an |
|---|
| 79 | + * __ex_table[] entry when it becomes an issue. |
|---|
| 80 | + */ |
|---|
| 81 | +static inline u64 mul_u64_u64_div_u64(u64 a, u64 mul, u64 div) |
|---|
| 82 | +{ |
|---|
| 83 | + u64 q; |
|---|
| 84 | + |
|---|
| 85 | + asm ("mulq %2; divq %3" : "=a" (q) |
|---|
| 86 | + : "a" (a), "rm" (mul), "rm" (div) |
|---|
| 87 | + : "rdx"); |
|---|
| 88 | + |
|---|
| 89 | + return q; |
|---|
| 90 | +} |
|---|
| 91 | +#define mul_u64_u64_div_u64 mul_u64_u64_div_u64 |
|---|
| 92 | + |
|---|
| 93 | +static inline u64 mul_u64_u32_div(u64 a, u32 mul, u32 div) |
|---|
| 94 | +{ |
|---|
| 95 | + return mul_u64_u64_div_u64(a, mul, div); |
|---|
| 96 | +} |
|---|
| 97 | +#define mul_u64_u32_div mul_u64_u32_div |
|---|
| 98 | + |
|---|
| 76 | 99 | #endif /* CONFIG_X86_32 */ |
|---|
| 77 | 100 | |
|---|
| 78 | 101 | #endif /* _ASM_X86_DIV64_H */ |
|---|