linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Dave Littell <littelld@verizon.net>
To: linuxppc-embedded@ozlabs.org
Subject: PPC440EPx skips instruction...
Date: Wed, 30 Jul 2008 20:57:01 -0500	[thread overview]
Message-ID: <48911BED.4040903@verizon.net> (raw)

Hi all,

I have a rather interesting problem with a PPC440EPx-based system.  I've
localized the problem down to a single instruction in a function
prologue that stores the return address to the stack:

stw r0,0x44(r1)

(lr is written to r0 earlier in the prologue.)

This code is in a normal device driver and is not being executed at
interrupt level or in some TLB miss handler or anything arcane - it's
just regular code (execution-context-wise).

It appears that if I just let the code run the write never makes it to
the stack, thus setting the stage for very interesting function returns.
 Whatever value happened to be on the stack becomes the IP with the
accompanying "excitement" that follows.  If I single-step through the
instruction using a JTAG debugger the write to the stack always occurs
and the function does its work and returns correctly.

If I step right up to the stw, write a test value into 0x44(r1), then
allow the processor to free run I am rewarded with an attempted return
address equal to the test value I wrote to the stack - the stw memory
write never makes it to the stack.

Because the code is compiled from C I'm limited in where I can sprinkle
sync instructions but I've tried adding asm("sync") as close as possible
to before (and after) the offending write - all to no effect.  I'm at a
loss to explain this as the remainder of the system seems to be running
just fine but I get this particular behavior at will.  More like its
will than mine... :-{

Has anyone seen this kind of behavior with a PPC440 core?  Please note
that workarounds for all known CPU core errata for the PPC440EPx are
already in place (based on the AMCC errata document).


Thanks very much,
Dave

                 reply	other threads:[~2008-07-31  2:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48911BED.4040903@verizon.net \
    --to=littelld@verizon.net \
    --cc=linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).