> On Thu, Nov 01, 2001 at 02:54:37PM -0700, John Regehr wrote:
> > > Don't forget to make sure it's __volatile__, elsewise this is the very
> > > epitome of what would produce dodgy results...
> > 
> > Right.  So method2 and method2A seem to be broken in multiple ways -
> > forget you ever saw them.  Rather, look at this page:

in what way is method2 brocken ??

if you compile method1 and method2A and look at the assembler coee they are
absolutly the same - the only difference on the source level is that its easier
to read "mov" than "0x31" thats all.

---method1---
__inline__ unsigned long long int rdtsc(void)
{
        unsigned long long int x;
        __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
        return x;
}


---method2A---
__inline__ unsigned long long int hwtime(void)
{
        unsigned long long int x;
        __asm__("rdtsc\n\t"
                "mov %%edx, %%ecx\n\t"
                :"=A" (x));
        return x;
}


---assembler code of method1----
.globl rdtsc
        .type    rdtsc,@function
rdtsc:
        pushl %ebp
        movl %esp,%ebp
        subl $20,%esp
        pushl %ebx


---assembler code of method2A----
.globl hwtime
        .type    hwtime,@function
hwtime:
        pushl %ebp
        movl %esp,%ebp
        subl $20,%esp
        pushl %ebx


hofrat
-- [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