public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov@ru•mvista.com>
To: systemtap@sourceware•org
Cc: linuxppc-dev@ozlabs•org, Jim Keniston <jkenisto@us•ibm.com>
Subject: [PATCH 2/4] powerpc: Fix longlong args handling
Date: Fri, 4 Dec 2009 02:31:54 +0300	[thread overview]
Message-ID: <20091203233154.GB3416@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20091203233059.GA28186@oksana.dev.rtsoft.ru>

When probing 32-bits apps on ppc64 or running native ppc32, int64
parts are stored in the big endian order, e.g. foo(1LL, 2LL, 3LL)'s
args turn into:

arg1: r3 = 0; r4 = 1
arg2: r5 = 0; r6 = 2
arg3: r7 = 0; r8 = 3

For example, to restore arg1 the current longlong_arg() will perform
(r4 << 32) | r3, which is obviously incorrect. And to restore arg2 it
will do (r5 << 32) | r4, which doesn't look right as well.

This patch fixes the issue.

Signed-off-by: Anton Vorontsov <avorontsov@ru•mvista.com>
---
 tapset/powerpc/registers.stp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tapset/powerpc/registers.stp b/tapset/powerpc/registers.stp
index 7f66d36..2403272 100644
--- a/tapset/powerpc/registers.stp
+++ b/tapset/powerpc/registers.stp
@@ -179,8 +179,8 @@ function ulong_arg:long (argnum:long) {
 
 function longlong_arg:long (argnum:long) {
 	if (probing_32bit_app()) {
-		lowbits = _stp_arg(argnum, 0, 1)
-		highbits = _stp_arg(argnum+1, 0, 1)
+		lowbits = _stp_arg(argnum * 2, 0, 1)
+		highbits = _stp_arg(argnum * 2 - 1, 0, 1)
 		return ((highbits << 32) | lowbits)
 	} else
 		return _stp_arg(argnum, 0, 0)
-- 
1.6.3.3

  parent reply	other threads:[~2009-12-03 23:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-03 23:30 [PATCH 0/4] systemtap: Some more powerpc patches Anton Vorontsov
2009-12-03 23:31 ` [PATCH 1/4] powerpc: Fix thinko in _stp_arg() Anton Vorontsov
2009-12-04  4:21   ` Ananth N Mavinakayanahalli
2009-12-03 23:31 ` Anton Vorontsov [this message]
2009-12-03 23:32 ` [PATCH 3/4] powerpc: Adjust registers.stp for ppc32 Anton Vorontsov
2009-12-03 23:32 ` [PATCH 4/4] powerpc: Improve backtrace output " Anton Vorontsov

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=20091203233154.GB3416@oksana.dev.rtsoft.ru \
    --to=avorontsov@ru$(echo .)mvista.com \
    --cc=jkenisto@us$(echo .)ibm.com \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=systemtap@sourceware$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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