linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/27] ptrace: arch_has_single_step
@ 2007-11-25 21:55 Roland McGrath
  2007-11-25 21:58 ` [PATCH 02/27] x86: segment selector macros Roland McGrath
                   ` (27 more replies)
  0 siblings, 28 replies; 44+ messages in thread
From: Roland McGrath @ 2007-11-25 21:55 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds
  Cc: linux-kernel, Thomas Gleixner, Ingo Molnar, H. Peter Anvin

This defines the new macro arch_has_single_step() in linux/ptrace.h, a
default for when asm/ptrace.h does not define it.  It declares the new
user_enable_single_step and user_disable_single_step functions.
This is not used yet, but paves the way to harmonize on this interface
for the arch-specific calls on all machines.

Signed-off-by: Roland McGrath <roland@redhat.com>
---
 include/linux/ptrace.h |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index ae8146a..a6effc8 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -128,6 +128,52 @@ int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data);
 #define force_successful_syscall_return() do { } while (0)
 #endif
 
+/*
+ * <asm/ptrace.h> should define the following things inside #ifdef __KERNEL__.
+ *
+ * These do-nothing inlines are used when the arch does not
+ * implement single-step.  The kerneldoc comments are here
+ * to document the interface for all arch definitions.
+ */
+
+#ifndef arch_has_single_step
+/**
+ * arch_has_single_step - does this CPU support user-mode single-step?
+ *
+ * If this is defined, then there must be function declarations or
+ * inlines for user_enable_single_step() and user_disable_single_step().
+ * arch_has_single_step() should evaluate to nonzero iff the machine
+ * supports instruction single-step for user mode.
+ * It can be a constant or it can test a CPU feature bit.
+ */
+#define arch_has_single_step()		(0)
+
+/**
+ * user_enable_single_step - single-step in user-mode task
+ * @task: either current or a task stopped in %TASK_TRACED
+ *
+ * This can only be called when arch_has_single_step() has returned nonzero.
+ * Set @task so that when it returns to user mode, it will trap after the
+ * next single instruction executes.
+ */
+static inline void user_enable_single_step(struct task_struct *task)
+{
+	BUG();			/* This can never be called.  */
+}
+
+/**
+ * user_disable_single_step - cancel user-mode single-step
+ * @task: either current or a task stopped in %TASK_TRACED
+ *
+ * Clear @task of the effects of user_enable_single_step().  This can
+ * be called whether or not user_enable_single_step() was ever called
+ * on @task, and even if arch_has_single_step() returned zero.
+ */
+static inline void user_disable_single_step(struct task_struct *task)
+{
+}
+#endif	/* arch_has_single_step */
+
 #endif
 
 #endif
-- 
1.5.3.4


^ permalink raw reply related	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2007-12-03  8:13 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-25 21:55 [PATCH 01/27] ptrace: arch_has_single_step Roland McGrath
2007-11-25 21:58 ` [PATCH 02/27] x86: segment selector macros Roland McGrath
2007-11-25 21:58 ` [PATCH 03/27] x86: remove TRAP_FLAG Roland McGrath
2007-11-25 21:59 ` [PATCH 04/27] x86: arch_has_single_step Roland McGrath
2007-11-25 21:59 ` [PATCH 05/27] x86: single_step moved Roland McGrath
2007-11-25 21:59 ` [PATCH 06/27] x86: single_step segment macros Roland McGrath
2007-11-25 22:00 ` [PATCH 07/27] x86: single_step 0xf0 Roland McGrath
2007-11-25 22:00 ` [PATCH 08/27] x86: single_step: share code Roland McGrath
2007-11-25 22:00 ` [PATCH 09/27] x86 single_step: TIF_FORCED_TF Roland McGrath
2007-11-25 22:01 ` [PATCH 10/27] ptrace: generic resume Roland McGrath
2007-11-25 22:23   ` Christoph Hellwig
2007-11-25 22:37     ` Roland McGrath
2007-11-25 22:01 ` [PATCH 11/27] x86-64: ptrace " Roland McGrath
2007-11-25 22:01 ` [PATCH 12/27] x86-32: " Roland McGrath
2007-11-25 22:03 ` [PATCH 13/27] powerpc: arch_has_single_step Roland McGrath
2007-11-25 22:04 ` [PATCH 14/27] powerpc: ptrace generic resume Roland McGrath
2007-12-03  8:12   ` Srinivasa Ds
2007-11-25 22:04 ` [PATCH 15/27] x86-32 ptrace: use task_pt_regs Roland McGrath
2007-11-25 22:04 ` [PATCH 16/27] x86-64 " Roland McGrath
2007-11-25 22:04 ` [PATCH 17/27] x86-64 ptrace debugreg cleanup Roland McGrath
2007-11-25 22:05 ` [PATCH 18/27] x86-64 ia32 " Roland McGrath
2007-11-25 22:05 ` [PATCH 19/27] x86-32 " Roland McGrath
2007-11-25 22:05 ` [PATCH 20/27] ptrace: arch_has_block_step Roland McGrath
2007-11-28 23:39   ` David Wilder
2007-11-28 23:58     ` Roland McGrath
2007-11-25 22:06 ` [PATCH 21/27] ptrace: generic PTRACE_SINGLEBLOCK Roland McGrath
2007-11-25 22:06 ` [PATCH 22/27] x86: debugctlmsr constants Roland McGrath
2007-11-25 22:08 ` [PATCH 23/27] x86: debugctlmsr kconfig Roland McGrath
2007-11-26  1:09   ` Denys Vlasenko
2007-11-26  7:51     ` Roland McGrath
2007-11-26 22:52       ` Denys Vlasenko
2007-11-26  1:57   ` Dave Jones
2007-11-26  8:06     ` Roland McGrath
2007-11-25 22:08 ` [PATCH 24/27] x86: debugctlmsr context switch Roland McGrath
2007-11-25 22:08 ` [PATCH 25/27] x86: debugctlmsr arch_has_block_step Roland McGrath
2007-11-25 22:08 ` [PATCH 26/27] x86: debugctlmsr kprobes Roland McGrath
2007-11-25 22:08 ` [PATCH 27/27] x86: PTRACE_SINGLEBLOCK Roland McGrath
2007-11-25 22:22 ` [PATCH 01/27] ptrace: arch_has_single_step Christoph Hellwig
2007-11-25 22:59   ` Roland McGrath
2007-11-27  8:53 ` Andrew Morton
2007-11-27 10:38   ` Ingo Molnar
2007-11-27 23:05   ` Roland McGrath
2007-11-27 23:58     ` Ingo Molnar
2007-11-28  0:08       ` Roland McGrath

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).