On 03/25/2010 09:00 AM, Csdncannon wrote:
> I am really sorry that the previously attached code is wrong, this one
> "timebase.c" is the right one, and the "log_timebase" file is the right log.
> 
> We are using FreeScale PowerPc 8378, kernel 2.6.28 and compiled as 32-bit.


volatile unsigned long long getTimeBase()
{
        unsigned long upper,lower,upper2;
        do {
                asm volatile("sync; isync":::"memory");
                asm volatile("mftbu %0" : "=r" (upper));
                asm volatile("sync; isync":::"memory");
                asm volatile("mftbl %0" : "=r" (lower));
                asm volatile("sync; isync":::"memory");
                asm volatile("mftbu %0" : "=r" (upper2));
                asm volatile("sync; isync":::"memory");
        }while(upper2!=upper);

        return (upper<<32)|lower;
}


Shouldn't "upper" be cast to 64-bit before shifting?

Chris
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to