On Wed, Aug 09, 2000 at 05:19:57PM +0200, Andi Kleen wrote:
> >
> >
> > Damn, looks like I get to work out what these asm statements really do, any
> > pointers?
>
> info gcc. It is documented in the RTL manual.
>
> It clearly breaks on the do_div inline assembly, so maybe a C version
> of do_div will be a reasonable workaround.
>
> do_div looks wrong anyways. The asms are not volatile so may be
> moved (while it assumes that variables stay in registers between asm
> statements), and the
>
> asm("":"=a" (__low), "=d" (__high):"A" (n)); \
>
> trick to force variables into specific registers looks very nasty to the
> compiler.
Indeed this patch makes it compile. I haven't tested if it runs correctly.
Index: include/asm-i386/div64.h
===================================================================
RCS file: /cvs/linux-2.4-xfs/linux/include/asm-i386/div64.h,v
retrieving revision 1.1
diff -u -r1.1 div64.h
--- include/asm-i386/div64.h 1999/11/12 18:56:11 1.1
+++ include/asm-i386/div64.h 2000/08/09 15:24:32
@@ -3,7 +3,7 @@
#define do_div(n,base) ({ \
unsigned long __upper, __low, __high, __mod; \
- asm("":"=a" (__low), "=d" (__high):"A" (n)); \
+ /* asm("":"=a" (__low), "=d" (__high):"A" (n)); */ \
__upper = __high; \
if (__high) { \
__upper = __high % (base); \
-Andi
|