mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Daniel Glöckner" <dg@emlix.com>
To: Chris Zankel <chris@zankel.net>
Cc: "Piet Delaney" <pdelaney@tensilica.com>,
	"Marc Gauthier" <marc@tensilica.com>,
	"Maxim Grigoriev" <maxim@tensilica.com>,
	linux-kernel@vger.kernel.org, linux-xtensa@linux-xtensa.org,
	"Daniel Glöckner" <dg@emlix.com>
Subject: [PATCH v2] xtensa: implement PTRACE_PEEKUSER addresses for nommu
Date: Fri, 24 Apr 2009 11:18:22 +0200	[thread overview]
Message-ID: <1240564702-11796-1-git-send-email-dg@emlix.com> (raw)
In-Reply-To: <1237978628-23746-1-git-send-email-dg@emlix.com>

On nommu gdbserver needs to be able to look up where the currently
debugged application has been relocated. Based on the Blackfin
implementation, this introduces three "addresses" PT_TEXT_ADDR,
PT_DATA_ADDR, and PT_TEXT_END_ADDR for PTRACE_PEEKUSER.

Changes compared to v1:

- changed PT_*_ADDR constants from 0x300..0x302 to 0xF000..0xF002

The range 0x300..0x3FF has been reserved by Tensilica for TIE user
registers. 0xF000..0xFFFF is free for 3rd-party debuggers, so use
that range instead. See xtensa-libdb-macros.h for details.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
---
 arch/xtensa/include/asm/ptrace.h |    4 ++++
 arch/xtensa/kernel/ptrace.c      |   12 ++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/xtensa/include/asm/ptrace.h b/arch/xtensa/include/asm/ptrace.h
index 905e1e6..85851f4 100644
--- a/arch/xtensa/include/asm/ptrace.h
+++ b/arch/xtensa/include/asm/ptrace.h
@@ -66,6 +66,10 @@
 
 #define SYSCALL_NR	0x00ff
 
+#define PT_TEXT_ADDR	0xF000
+#define PT_DATA_ADDR	0xF001
+#define PT_TEXT_END_ADDR	0xF002
+
 /* Other PTRACE_ values defined in <linux/ptrace.h> using values 0-9,16,17,24 */
 
 #define PTRACE_GETREGS		12
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c
index 9486882..82f3620 100644
--- a/arch/xtensa/kernel/ptrace.c
+++ b/arch/xtensa/kernel/ptrace.c
@@ -211,6 +211,18 @@ int ptrace_peekusr(struct task_struct *child, long regno, long __user *ret)
 			tmp = regs->syscall;
 			break;
 
+		case PT_TEXT_ADDR:
+			tmp = child->mm->start_code;
+			break;
+
+		case PT_DATA_ADDR:
+			tmp = child->mm->start_data;
+			break;
+
+		case PT_TEXT_END_ADDR:
+			tmp = child->mm->end_code;
+			break;
+
 		default:
 			return -EIO;
 	}
-- 
1.6.1.3


      reply	other threads:[~2009-04-24  9:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-25 10:57 [patch] " Daniel Glöckner
2009-04-24  9:18 ` Daniel Glöckner [this message]

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=1240564702-11796-1-git-send-email-dg@emlix.com \
    --to=dg@emlix.com \
    --cc=chris@zankel.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=marc@tensilica.com \
    --cc=maxim@tensilica.com \
    --cc=pdelaney@tensilica.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

all inboxes | Powered by JetHome®