Thread (23 messages) 23 messages, 7 authors, 2010-04-23

Re: Continual reading from the PowerPc time base register is not stable

From: Segher Boessenkool <hidden>
Date: 2010-03-26 09:01:29

Yes indeed.  Could you post the relevant piece if disassembly from
your original binary (the one that has the problem)?  Or send me the
binary (not to the mailing list), I'll do it then.
Ah scratch that.  I compiled your original code (after fixing the
compile errors -- there is no such type as "bool" in C).

The problem is that  (upper << 32) | lower  thing.  "upper" is a 32-bit
type, so shifting it by 32 or more bits is undefined.  GCC compiles this
to (shortened):

0: mftbu 9 ; mftbl 11 ; mftbu 0 ; cmpw 0,9 ; bne 0b  # so far so good
   slwi 0,0,0 ; or 4,0,11 ; li 3,0 ; blr

so it shifts by 0, i.e. it does  upper | lower .

Case closed, no hardware problem :-)


Segher
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help