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 3/4] powerpc: Adjust registers.stp for ppc32
Date: Fri, 4 Dec 2009 02:32:02 +0300	[thread overview]
Message-ID: <20091203233202.GC3416@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20091203233059.GA28186@oksana.dev.rtsoft.ru>

registers.stp is missing a few small bits when running on ppc32:

* Divide register offsets by 2;
* There is 'mq' register instead of 'softe';
* long_arg() should sign-extend the result on ppc32.

Suggested-by: Jim Keniston <jkenisto@us•ibm.com>
Signed-off-by: Anton Vorontsov <avorontsov@ru•mvista.com>
---
 tapset/powerpc/registers.stp |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/tapset/powerpc/registers.stp b/tapset/powerpc/registers.stp
index 2403272..4e77c7a 100644
--- a/tapset/powerpc/registers.stp
+++ b/tapset/powerpc/registers.stp
@@ -1,5 +1,13 @@
 /* Dwarfless register access for powerpc */
 
+function is_powerpc32() %{ /* pure */
+#ifdef __powerpc64__
+        THIS->__retvalue = 0;
+#else
+        THIS->__retvalue = 1;
+#endif
+%}
+
 global _reg_offsets, _stp_regs_registered
 
 function _stp_register_regs() {
@@ -43,23 +51,24 @@ function _stp_register_regs() {
 	_reg_offsets["link"] = 288
 	_reg_offsets["xer"] = 296
 	_reg_offsets["ccr"] = 304
-	_reg_offsets["softe"] = 312
+	if (is_powerpc32())
+		_reg_offsets["mq"] = 312
+	else
+		_reg_offsets["softe"] = 312
 	_reg_offsets["trap"] = 320
 	_reg_offsets["dar"] = 328
 	_reg_offsets["dsisr"] = 336
 	_reg_offsets["result"] = 344
 
-	/*
-	 * If we ever need to support 32bit powerpc, we can
-	 * get to the register offsets by using just a
-	 * reg32_offset = _reg_offsets["reg"]/2
-	 * or somesuch
-	 */
 	_stp_regs_registered = 1
 }
 
 function probing_32bit_app() %{ /* pure */
+#ifdef __powerpc64__
         THIS->__retvalue = _stp_probing_32bit_app(CONTEXT->regs);
+#else
+        THIS->__retvalue = 1;
+#endif
 %}
 
 function _stp_get_register_by_offset:long (offset:long) %{ /* pure */
@@ -91,7 +100,11 @@ function _stp_register:long (name:string, sign_extend:long) {
 	}
 	if (!_stp_regs_registered)
 		_stp_register_regs()
+
 	offset = _reg_offsets[name]
+	if (is_powerpc32())
+		offset /= 2
+
 	if (offset == 0 && !(name in _reg_offsets)) {
 		error("Unknown register: " . name)
 		return 0
@@ -170,7 +183,7 @@ function uint_arg:long (argnum:long) {
 }
 
 function long_arg:long (argnum:long) {
-	return _stp_arg(argnum, 1, 0)
+	return _stp_arg(argnum, 1, is_powerpc32())
 }
 
 function ulong_arg:long (argnum:long) {
-- 
1.6.3.3

  parent reply	other threads:[~2009-12-03 23:32 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 ` [PATCH 2/4] powerpc: Fix longlong args handling Anton Vorontsov
2009-12-03 23:32 ` Anton Vorontsov [this message]
2009-12-03 23:32 ` [PATCH 4/4] powerpc: Improve backtrace output for ppc32 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=20091203233202.GC3416@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