Re: [rtl] hrtime_t -> int
---On Mon, Jun 26, 2000 at 09:22:44AM -0500, Cory Papenfuss wrote: > I've (sorta) figured it out. The int must first be cast as a long long > or the multiplication will overflow, but when I tried putting a division in a > rt-space function to return miliseconds since boot, I get > > ./init.o: unresolved symbol __divdi3 > > when I try to load up my init.o module. Is the access of the longlong > division > forbidden within rt-space? I ran into this problem a while back __divdi3 is in a library not linked to the kernel. My solution for dividing a 54bit by a 32bit was to copy /usr/src/linux/arch/i386/math-emu/div_small.S to my local dir and include it in my module. --re: Re: [rtl] hrtime_t -> int Chris #include Christopher R. Hawks Software Engineer Syscon Plantstar a Division of Syscon International [EMAIL PROTECTED] Computers are like air-conditioners: They stop working properly when you open windows. Linux: The OS for people with an IQ over 98 -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl " | mail [EMAIL PROTECTED] --- For more information on Real-Time Linux see: http://www.rtlinux.org/rtlinux/
Re: [rtl] hrtime_t -> int
Hi, > Long long division requires a function call to a function that is > part of libgcc. Do to 'executive decision' in the kernel, i.e., > it's been that way forever, libgcc is not linked with the kernel. > (Libgcc _is_ linked with the kernel for most non-i386 architectures, > however.) You have the option of making a difference 'executive > decision', and link your module with libgcc. It would be a bad idea. Only arm and sh include the libgcc.a, but normally you never know how libgcc.a is compiled. It's compiled for user space not for the kernel. AFAIK the latest libgcc.a is compiled with -fpic, but you can also optimize your compiler for a specific cpu, what currently means that libgcc.a is optimized for that cpu, what is very bad for cross compiling environments. So if you want to link anything into the kernel, you have to check how it was compiled. bye, Roman -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl " | mail [EMAIL PROTECTED] --- For more information on Real-Time Linux see: http://www.rtlinux.org/rtlinux/
Re: [rtl] hrtime_t -> int
On Mon, Jun 26, 2000 at 09:22:44AM -0500, Cory Papenfuss wrote: > I've (sorta) figured it out. The int must first be cast as a long long > or the multiplication will overflow, but when I tried putting a division in a > rt-space function to return miliseconds since boot, I get > > ./init.o: unresolved symbol __divdi3 > > when I try to load up my init.o module. Is the access of the longlong division > forbidden within rt-space? Long long division requires a function call to a function that is part of libgcc. Do to 'executive decision' in the kernel, i.e., it's been that way forever, libgcc is not linked with the kernel. (Libgcc _is_ linked with the kernel for most non-i386 architectures, however.) You have the option of making a difference 'executive decision', and link your module with libgcc. dave... > > BTW, getlrtime that produced that error is little more than > > unsigned long int getlrtime(void){ > return((unsigned long)((long long)gethrtime() / 100LL) > } > > -Cory > On Mon, 26 Jun 2000, Michael Barabanov wrote: > > > Cory Papenfuss ([EMAIL PROTECTED]) wrote: > > > Hey all... I've got something that's been bugging me for awhile on this > > > project. I really only need millisecond resolution (since I'm logging data to > > > disk), but the hrtime_t doesn't like to be divided by 1000 (NS_PER_MS), as > > > it's a funky type. Any way I can get around that and get a millisecond > > > timestamp? > > > > What do you mean it doesn't like to be divided? hrtime_t is just > > an alias for long long. > > > > > On a related note, I've got a user-space app that can send new > > > pthread_make_period_np periods (again in [ms]). Problem is that if I try to > > > send a time greater than 2147 ms, the machine craps out. I suspect it's a > > > rollover on my > > > > > > looptime = * 100; > > > pthread_make_periodic_np(thread[0], genesis+OFFSET, looptime); > > > > > > > > > What's a good way to do arithmetic on these hrtime_t creatures? > > > > looptime = * (long long) 100; > > > > Michael. > > > > > -- [rtl] --- > To unsubscribe: > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR > echo "unsubscribe rtl " | mail [EMAIL PROTECTED] > --- > For more information on Real-Time Linux see: > http://www.rtlinux.org/rtlinux/ > -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl " | mail [EMAIL PROTECTED] --- For more information on Real-Time Linux see: http://www.rtlinux.org/rtlinux/
Re: [rtl] hrtime_t -> int
I've (sorta) figured it out. The int must first be cast as a long long or the multiplication will overflow, but when I tried putting a division in a rt-space function to return miliseconds since boot, I get ./init.o: unresolved symbol __divdi3 when I try to load up my init.o module. Is the access of the longlong division forbidden within rt-space? BTW, getlrtime that produced that error is little more than unsigned long int getlrtime(void){ return((unsigned long)((long long)gethrtime() / 100LL) } -Cory On Mon, 26 Jun 2000, Michael Barabanov wrote: > Cory Papenfuss ([EMAIL PROTECTED]) wrote: > > Hey all... I've got something that's been bugging me for awhile on this > > project. I really only need millisecond resolution (since I'm logging data to > > disk), but the hrtime_t doesn't like to be divided by 1000 (NS_PER_MS), as > > it's a funky type. Any way I can get around that and get a millisecond > > timestamp? > > What do you mean it doesn't like to be divided? hrtime_t is just > an alias for long long. > > > On a related note, I've got a user-space app that can send new > > pthread_make_period_np periods (again in [ms]). Problem is that if I try to > > send a time greater than 2147 ms, the machine craps out. I suspect it's a > > rollover on my > > > > looptime = * 100; > > pthread_make_periodic_np(thread[0], genesis+OFFSET, looptime); > > > > > > What's a good way to do arithmetic on these hrtime_t creatures? > > looptime = * (long long) 100; > > Michael. > -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl " | mail [EMAIL PROTECTED] --- For more information on Real-Time Linux see: http://www.rtlinux.org/rtlinux/
Re: [rtl] hrtime_t -> int
Cory Papenfuss ([EMAIL PROTECTED]) wrote: > Hey all... I've got something that's been bugging me for awhile on this > project. I really only need millisecond resolution (since I'm logging data to > disk), but the hrtime_t doesn't like to be divided by 1000 (NS_PER_MS), as > it's a funky type. Any way I can get around that and get a millisecond > timestamp? What do you mean it doesn't like to be divided? hrtime_t is just an alias for long long. > On a related note, I've got a user-space app that can send new > pthread_make_period_np periods (again in [ms]). Problem is that if I try to > send a time greater than 2147 ms, the machine craps out. I suspect it's a > rollover on my > > looptime = * 100; > pthread_make_periodic_np(thread[0], genesis+OFFSET, looptime); > > > What's a good way to do arithmetic on these hrtime_t creatures? looptime = * (long long) 100; Michael. -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl " | mail [EMAIL PROTECTED] --- For more information on Real-Time Linux see: http://www.rtlinux.org/rtlinux/
[rtl] hrtime_t -> int
Hey all... I've got something that's been bugging me for awhile on this project. I really only need millisecond resolution (since I'm logging data to disk), but the hrtime_t doesn't like to be divided by 1000 (NS_PER_MS), as it's a funky type. Any way I can get around that and get a millisecond timestamp? On a related note, I've got a user-space app that can send new pthread_make_period_np periods (again in [ms]). Problem is that if I try to send a time greater than 2147 ms, the machine craps out. I suspect it's a rollover on my looptime = * 100; pthread_make_periodic_np(thread[0], genesis+OFFSET, looptime); What's a good way to do arithmetic on these hrtime_t creatures? -Cory -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl " | mail [EMAIL PROTECTED] --- For more information on Real-Time Linux see: http://www.rtlinux.org/rtlinux/