static inline unsigned long do_fast_gettimeoffset(void) { register unsigned long eax, edx; /* Read the Time Stamp Counter */ rdtsc(eax,edx); /* .. relative to previous jiffy (32 bits is enough) */ eax -= last_tsc_low; /* tsc_low delta */ /* * Time offset = (tsc_low delta) * fast_gettimeoffset_quotient * = (tsc_low delta) * (usecs_per_clock) * = (tsc_low delta) * (usecs_per_jiffy/clocks_per_jiffy) * * Using a mull instead of a divl saves up to 31 clock cycles * in the critical path. */ __asm__("mull %2" :"=a" (eax), "=d" (edx) :"rm" (fast_gettimeoffset_quotient), "" (eax)); /* our adjusted time offset in microseconds */ return delay_at_last_interrupt + edx; } Suppose I wanted to do the same thing as above but with both the upper and lower 32 bits what is read by rdtsc, what would I do? The intel documents have some code that looks like this: unsigned time, time_low, time_high; unsigned mhz = 150000000; // 150 MHz processor __asm rdtsc // Read time stamp to EAX __asm mov time_low, eax __asm mov time_high, edx Sleep (35000); // Sleep for 35 seconds __asm rdtsc __asm sub eax, time_low // Find the difference __asm sub edx, time_high __asm div mhz // Unsigned divide EDX:EAX by mhz __asm mov time, eax printf("Seconds: %u\n", time); What exactly does the div line do? Anton -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/