From: Mike Frysinger <vapier@gentoo.org>
To: Roland McGrath <roland@redhat.com>,
Oleg Nesterov <oleg@redhat.com>,
linux-kernel@vger.kernel.org,
kgdb-bugreport@lists.sourceforge.net,
Jason Wessel <jason.wessel@windriver.com>
Cc: x86@kernel.org, Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
linux-sh@vger.kernel.org, Paul Mundt <lethal@linux-sh.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 1/5] asm-generic/ptrace.h: start a common low level ptrace helper
Date: Thu, 14 Apr 2011 06:01:31 +0000 [thread overview]
Message-ID: <1302760895-13459-2-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1302760895-13459-1-git-send-email-vapier@gentoo.org>
This implements a bunch of helper funcs for poking the registers of a
ptrace structure. Now common code should be able to portably update
specific registers (like kgdb updating the PC).
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
include/asm-generic/ptrace.h | 74 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 74 insertions(+), 0 deletions(-)
create mode 100644 include/asm-generic/ptrace.h
diff --git a/include/asm-generic/ptrace.h b/include/asm-generic/ptrace.h
new file mode 100644
index 0000000..82e674f
--- /dev/null
+++ b/include/asm-generic/ptrace.h
@@ -0,0 +1,74 @@
+/*
+ * Common low level (register) ptrace helpers
+ *
+ * Copyright 2004-2011 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#ifndef __ASM_GENERIC_PTRACE_H__
+#define __ASM_GENERIC_PTRACE_H__
+
+#ifndef __ASSEMBLY__
+
+/* Helpers for working with the instruction pointer */
+#ifndef GET_IP
+#define GET_IP(regs) ((regs)->pc)
+#endif
+#ifndef SET_IP
+#define SET_IP(regs, val) (GET_IP(regs) = (val))
+#endif
+
+static inline unsigned long instruction_pointer(struct pt_regs *regs)
+{
+ return GET_IP(regs);
+}
+static inline void instruction_pointer_set(struct pt_regs *regs,
+ unsigned long val)
+{
+ SET_IP(regs, val);
+}
+
+#ifndef profile_pc
+#define profile_pc(regs) instruction_pointer(regs)
+#endif
+
+/* Helpers for working with the user stack pointer */
+#ifndef GET_USP
+#define GET_USP(regs) ((regs)->usp)
+#endif
+#ifndef SET_USP
+#define SET_USP(regs, val) (GET_USP(regs) = (val))
+#endif
+
+static inline unsigned long user_stack_pointer(struct pt_regs *regs)
+{
+ return GET_USP(regs);
+}
+static inline void user_stack_pointer_set(struct pt_regs *regs,
+ unsigned long val)
+{
+ SET_USP(regs, val);
+}
+
+/* Helpers for working with the frame pointer */
+#ifndef GET_FP
+#define GET_FP(regs) ((regs)->fp)
+#endif
+#ifndef SET_FP
+#define SET_FP(regs, val) (GET_FP(regs) = (val))
+#endif
+
+static inline unsigned long frame_pointer(struct pt_regs *regs)
+{
+ return GET_FP(regs);
+}
+static inline void frame_pointer_set(struct pt_regs *regs,
+ unsigned long val)
+{
+ SET_FP(regs, val);
+}
+
+#endif /* __ASSEMBLY__ */
+
+#endif
--
1.7.5.rc1
next prev parent reply other threads:[~2011-04-14 6:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-14 6:01 [PATCH 0/5] ptrace low level unification Mike Frysinger
2011-04-14 6:01 ` Mike Frysinger [this message]
2011-04-14 18:09 ` [PATCH 1/5] asm-generic/ptrace.h: start a common low level Oleg Nesterov
2011-04-14 18:16 ` [PATCH 1/5] asm-generic/ptrace.h: start a common low level ptrace helper Mike Frysinger
2011-04-14 6:01 ` [PATCH 2/5] Blackfin: convert to asm-generic ptrace.h Mike Frysinger
2011-04-14 6:01 ` [PATCH 3/5] x86: " Mike Frysinger
2011-04-14 14:16 ` [Kgdb-bugreport] " Sergei Shtylyov
2011-04-14 17:05 ` H. Peter Anvin
2011-04-14 17:38 ` Sergei Shtylyov
2011-04-14 6:01 ` [PATCH 4/5] sh: " Mike Frysinger
2011-04-14 14:22 ` [Kgdb-bugreport] " Sergei Shtylyov
2011-04-16 19:17 ` Paul Mundt
2011-04-14 6:01 ` [PATCH 5/5] kgdbts: unify/generalize gdb breakpoint adjustment Mike Frysinger
2011-04-18 8:29 ` Paul Mundt
2011-06-16 15:07 ` Arnd Bergmann
2011-06-16 20:06 ` Mike Frysinger
2011-06-16 20:07 ` Mike Frysinger
2011-06-16 20:21 ` Arnd Bergmann
2011-06-16 20:29 ` Mike Frysinger
2011-04-19 5:36 ` [Kgdb-bugreport] [PATCH 5/5] kgdbts: unify/generalize gdb breakpoint DDD
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=1302760895-13459-2-git-send-email-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=jason.wessel@windriver.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=roland@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).