Program Counter in PPC750

How do I get a current PC in assembly for PPC750? As far as I know there is no PC register that I can read. Is there any trick? I tried with a dummy function call and reading Link Register, but that is not good enough. Regards, Goran

Reply to
g r
Loading thread data ...

Which PC do you mean? The one for the 6 instructions executing in parallel? Which of those 6? Or perhaps you mean the PC used to fetch one of the 6 instructions sitting in the instruction fetch queue, but that have not yet been dispatched... which of THOSE six do you mean? Or should we discuss the PC being used to bring in four instructions from the cache that might never be executed because a prior branch is about to speculatively change directions?

Which PC WOULD be good enough for you?

How about the one you get by doing something like: ; stack lr, how you do that is your problem bl next ; LR will be set with run time addr of next next: mflr r31 ; capture that run time value ; unstack lr, how you do that is your problem

If that isn't good enough, I would like to know what is.

--
Skipper Smith                         Helpful Knowledge Consulting
Worldwide         Microprocessor       Architecture       Training
PowerPC, ColdFire, 68K, CPU32                Hardware and Software

/* Remove no-spam. from the reply address to send mail directly */
Reply to
Skipper Smith

This smacks of arrogance. A bit more courtesy would be expected from somebody working for a company called "Helpful" Knowledge Consulting.

Reply to
Bob Smith

Actually, although the PPC does not have a user-visible PC, and is super-scaler, it acts as though it were entirely sequential. You can pretend that it reads one instruction, interpretes it, executes it, stores the results, and then moves on to the next instuction - from the programmers viewpoint, that is exactly what is happening. Somehow the chip manages to get through several of these sequences in every clock tick, but you can normally ignore that (except for cache flushes, hardware access and the like, when you need the occasional "isync" or "eieio" - IBM *does* have a sense of humour).

So your code below reads *the* program counter, according to the programmer's model. As far as I know, it is the only way to do it, so it had better be "good enough" for the O/P.

Reply to
David Brown

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.