00001 #ifndef __I386_DIV64
00002 #define __I386_DIV64
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #define do_div(n,base) ({ \
00017 unsigned long __upper, __low, __high, __mod, __base; \
00018 __base = (base); \
00019 asm("":"=a" (__low), "=d" (__high):"A" (n)); \
00020 __upper = __high; \
00021 if (__high) { \
00022 __upper = __high % (__base); \
00023 __high = __high / (__base); \
00024 } \
00025 asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (__base), "0" (__low), "1" (__upper)); \
00026 asm("":"=A" (n):"a" (__low),"d" (__high)); \
00027 __mod; \
00028 })
00029
00030
00031
00032
00033
00034
00035
00036 #define div_long_long_rem(a,b,c) div_ll_X_l_rem(a,b,c)
00037
00038 extern inline long
00039 div_ll_X_l_rem(long long divs, long div, long *rem)
00040 {
00041 long dum2;
00042 __asm__("divl %2":"=a"(dum2), "=d"(*rem)
00043 : "rm"(div), "A"(divs));
00044
00045 return dum2;
00046
00047 }
00048 #endif