[Cbe-oss-dev] [PATCH 1/2]MARS/core: Tick counter api

Yuji Mano yuji.mano at am.sony.com
Tue Nov 25 07:04:52 EST 2008


Arnd Bergmann wrote:
> On Friday 21 November 2008, Yuji Mano wrote:
>> +uint32_t mars_get_ticks(void) +{ +       return __mftb() &
>> 0xffffffff; +}
> 
> Where does the definition of __mftb come from?

It's defined in <ppu_intrinsics.h>
Documented in Language_Extensions_for_CBEA_2.4.pdf - page 90

#ifdef __powerpc64__
#define __mftb() __extension__			\
  ({ unsigned long long result;			\
  __asm__ volatile ("mftb %0" : "=r" (result));	\
  result; })
#else
#define __mftb() __extension__			\
  ({ unsigned long long result;			\
  unsigned long t;				\
  __asm__ volatile ("1:\n"			\
		    "\tmftbu %0\n"		\
		    "\tmftb %L0\n"		\
		    "\tmftbu %1\n"		\
		    "\tcmpw %0,%1\n"		\
		    "\tbne 1b"			\
		    : "=r" (result), "=r" (t));	\
  result; })
#endif /* __powerpc64__ */


> Does it have the fixup for the cell erratum reading the time base?

Maybe Andrew Pinski or someone more familiar with this has the answer?

Regards,
Yuji




More information about the cbe-oss-dev mailing list