Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: yao@codesourcery.com (Yao Qi)
Cc: Richard.Earnshaw@buzzard.freeserve.co.uk (Richard Earnshaw),
	       gdb-patches@sourceware.org, julian@codesourcery.com
Subject: Re: [patch] Fix PR tdep/12352: Handle str pc, [Rd, #imm] in displaced stepping
Date: Wed, 09 Feb 2011 13:51:00 -0000	[thread overview]
Message-ID: <201102091351.p19Dp0qB002862@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <4D5230F9.7030703@codesourcery.com> from "Yao Qi" at Feb 09, 2011 02:15:21 PM

Yao Qi wrote:

> I am afraid they are not equal to each other.  The intention of this
> complicated insn sequence is used to compute the implementation-defined
> constant offset of `str pc'.  See more explanations below.
> 
> http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204g/Cihbjifh.html
> 
> Section "Saving from r15"
> [...]
> If you do save from r15, the value saved is the address of the current
> instruction, plus an implementation-defined constant. The constant is
> always the same for a particular processor.
> If your assembled code might be used on different processors, you can
> find out what the constant is at runtime using code like the following:
> 
>     SUB R1, PC, #4 ; R1 = address of following STR instruction
>     STR PC, [R0]   ; Store address of STR instruction + offset,
>     LDR R0, [R0]   ; then reload it
>     SUB R0, R0, R1 ; Calculate the offset as the difference

Yes, I'm aware of that.  However, my understanding is that this special
definition of STR PC applies to *all* variants of STR, including PUSH
(PUSH { PC } is just another mnemonic for STR PC, [ SP, #-4 ]).

If you look at the formal semantics definition in the ARM reference
manual, all variants of STR (including PUSH) use the pseudo-code macro
"PCStoreValue" to implement storing of the PC, which is defined to
include the implementation-defined constant ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  reply	other threads:[~2011-02-09 13:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-28 17:24 Yao Qi
2011-01-06 14:03 ` [Ping : patch] " Yao Qi
2011-01-19 16:17   ` [Ping 2: " Yao Qi
2011-01-22 23:44 ` [patch] " Richard Earnshaw
2011-01-24 13:22   ` Yao Qi
2011-01-31  0:31   ` Yao Qi
2011-01-31 15:56     ` Ulrich Weigand
2011-02-09  6:15       ` Yao Qi
2011-02-09 13:51         ` Ulrich Weigand [this message]
2011-02-10  6:19           ` Yao Qi
2011-02-14 14:39             ` Ulrich Weigand
2011-02-15 10:55               ` Yao Qi
2011-02-15 13:36                 ` Ulrich Weigand
2011-02-15 15:57                   ` Yao Qi

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=201102091351.p19Dp0qB002862@d06av02.portsmouth.uk.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=Richard.Earnshaw@buzzard.freeserve.co.uk \
    --cc=gdb-patches@sourceware.org \
    --cc=julian@codesourcery.com \
    --cc=yao@codesourcery.com \
    /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