I'd agree that not using 64-bit arithmetic is the way to go but if you want
to use it then you can use the same trick we do for the scheduler.

If you look at the Makefile in schedulers/ you'll see something like this.

LIBGCC := $(shell $(CC) -print-libgcc-file-name)

Ignore the MIPS version of the above, it's a bit wacky.

module.o: ....
        $(LD) $(LDFLAGS) -r -o module.o .......o ${LIBGCC}

You'll pull in the soft floating-point operations that you need for the
64-bit arithmetic.
        
} > Hi all,
} >
} > When I try to do an integer division of an hrtime_t variable within the
} > kernel, I get the following error upon inserting the module:
} >
} > my_module.o: unresolved symbol __divdi3
} > make: *** [test] Error 1
} >
} > As best I can tell, __divdi3 is called by the compiler to do that division,
} > and is not available within the kernel (actually, it is available from the
} > NVdriver module for my nvidia graphics card, but that leads to other
} > problems).
} >
} > Does anybody know of a way to avoid using this function, or to make this
} > function available in the kernel, or am I stuck multiplying by 0.0000001?
} >
} 
} I had this problem. I worked around it by not using 64 bit type in my
} division:
} 
}    hrtime_t start_time;
}    hrtime_t end_time;
}    long usec;
}    long divisor = 1000;   // nano to micro
} 
}    start_time = gethrtime();
}    my_hardworking_function();
}    end_time = gethrtime();
} 
}    usec = end_time - start_time;     // store difference in 32-bit variable.
}    usec /= divisor;                  // 32-bit division
} 
} Of course, I just needed to measure how long it took my code to run.
} And since my code needed to be fast the (end-start) never exceeded the
} the 32-bit value. Using long give you (I think about 2 sec) in hrtime_r
} resolution.
} 
} Hopefully this will work for you... otherwise  you may need to find
} 64 bit math libs. If you don't one suggestion is to look for the idiv
} source code in the glib...maybe it might be a inline function in the
} header file?
} 
} Tony
} 
} 
} 
} -- [rtl] ---
} To unsubscribe:
} echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
} echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
} --
} For more information on Real-Time Linux see:
} http://www.rtlinux.org/
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to