Skip to contentSkip to conversation

xtensa: implement PTRACE_PEEKUSER addresses for nommu

PATCH Superseded Daniel Glöckner 1 participant 2 messages Mar 25, 2009 – Apr 24, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xtensa: implement PTRACE_PEEKUSER addresses for nommu

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.

---
 arch/xtensa/include/asm/ptrace.h |    4 ++++
 arch/xtensa/kernel/ptrace.c      |   12 ++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
arch/xtensa/include/asm/ptrace.h +4 -0
index 905e1e6..8f4fbf3 100644
@@ -66,6 +66,10 @@
 
 #define SYSCALL_NR	0x00ff
 
+#define PT_TEXT_ADDR	0x0300
+#define PT_DATA_ADDR	0x0301
+#define PT_TEXT_END_ADDR	0x0302
+
 /* Other PTRACE_ values defined in <linux/ptrace.h> using values 0-9,16,17,24 */
 
 #define PTRACE_GETREGS		12
arch/xtensa/kernel/ptrace.c +12 -0
index 9486882..82f3620 100644
@@ -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;
 	}
Signature · 1 line
1.6.2.107.ge47ee
#1 lore raw

PATCH v2 1/1 xtensa: implement PTRACE_PEEKUSER addresses for nommu

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.

---
 arch/xtensa/include/asm/ptrace.h |    4 ++++
 arch/xtensa/kernel/ptrace.c      |   12 ++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
arch/xtensa/include/asm/ptrace.h +4 -0
index 905e1e6..85851f4 100644
@@ -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
arch/xtensa/kernel/ptrace.c +12 -0
index 9486882..82f3620 100644
@@ -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;
 	}
Signature · 1 line
1.6.1.3