diff options
author | Roland McGrath <roland@redhat.com> | 2008-01-30 07:30:50 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:30:50 -0500 |
commit | e1f287735c1e58c653b516931b5d3dd899edcb77 (patch) | |
tree | 1a2948cfe8ff679135971e2c573d11b847fee93d /include | |
parent | 7122ec8158b0f88befd94f4da8feae2c8d08d1b4 (diff) |
x86 single_step: TIF_FORCED_TF
This changes the single-step support to use a new thread_info flag
TIF_FORCED_TF instead of the PT_DTRACE flag in task_struct.ptrace.
This keeps arch implementation uses out of this non-arch field.
This changes the ptrace access to eflags to mask TF and maintain
the TIF_FORCED_TF flag directly if userland sets TF, instead of
relying on ptrace_signal_deliver. The 64-bit and 32-bit kernels
are harmonized on this same behavior. The ptrace_signal_deliver
approach works now, but this change makes the low-level register
access code reliable when called from different contexts than a
ptrace stop, which will be possible in the future.
The 64-bit do_debug exception handler is also changed not to clear TF
from user-mode registers. This matches the 32-bit kernel's behavior.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-x86/signal.h | 11 | ||||
-rw-r--r-- | include/asm-x86/thread_info_32.h | 2 | ||||
-rw-r--r-- | include/asm-x86/thread_info_64.h | 2 |
3 files changed, 6 insertions, 9 deletions
diff --git a/include/asm-x86/signal.h b/include/asm-x86/signal.h index 987a422a2c78..aee7eca585ab 100644 --- a/include/asm-x86/signal.h +++ b/include/asm-x86/signal.h | |||
@@ -245,21 +245,14 @@ static __inline__ int sigfindinword(unsigned long word) | |||
245 | 245 | ||
246 | struct pt_regs; | 246 | struct pt_regs; |
247 | 247 | ||
248 | #define ptrace_signal_deliver(regs, cookie) \ | ||
249 | do { \ | ||
250 | if (current->ptrace & PT_DTRACE) { \ | ||
251 | current->ptrace &= ~PT_DTRACE; \ | ||
252 | (regs)->eflags &= ~TF_MASK; \ | ||
253 | } \ | ||
254 | } while (0) | ||
255 | |||
256 | #else /* __i386__ */ | 248 | #else /* __i386__ */ |
257 | 249 | ||
258 | #undef __HAVE_ARCH_SIG_BITOPS | 250 | #undef __HAVE_ARCH_SIG_BITOPS |
259 | 251 | ||
252 | #endif /* !__i386__ */ | ||
253 | |||
260 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | 254 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) |
261 | 255 | ||
262 | #endif /* !__i386__ */ | ||
263 | #endif /* __KERNEL__ */ | 256 | #endif /* __KERNEL__ */ |
264 | #endif /* __ASSEMBLY__ */ | 257 | #endif /* __ASSEMBLY__ */ |
265 | 258 | ||
diff --git a/include/asm-x86/thread_info_32.h b/include/asm-x86/thread_info_32.h index a516e9192f11..009ecc6ad38b 100644 --- a/include/asm-x86/thread_info_32.h +++ b/include/asm-x86/thread_info_32.h | |||
@@ -138,6 +138,7 @@ static inline struct thread_info *current_thread_info(void) | |||
138 | #define TIF_IO_BITMAP 18 /* uses I/O bitmap */ | 138 | #define TIF_IO_BITMAP 18 /* uses I/O bitmap */ |
139 | #define TIF_FREEZE 19 /* is freezing for suspend */ | 139 | #define TIF_FREEZE 19 /* is freezing for suspend */ |
140 | #define TIF_NOTSC 20 /* TSC is not accessible in userland */ | 140 | #define TIF_NOTSC 20 /* TSC is not accessible in userland */ |
141 | #define TIF_FORCED_TF 21 /* true if TF in eflags artificially */ | ||
141 | 142 | ||
142 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 143 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
143 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 144 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
@@ -153,6 +154,7 @@ static inline struct thread_info *current_thread_info(void) | |||
153 | #define _TIF_IO_BITMAP (1<<TIF_IO_BITMAP) | 154 | #define _TIF_IO_BITMAP (1<<TIF_IO_BITMAP) |
154 | #define _TIF_FREEZE (1<<TIF_FREEZE) | 155 | #define _TIF_FREEZE (1<<TIF_FREEZE) |
155 | #define _TIF_NOTSC (1<<TIF_NOTSC) | 156 | #define _TIF_NOTSC (1<<TIF_NOTSC) |
157 | #define _TIF_FORCED_TF (1<<TIF_FORCED_TF) | ||
156 | 158 | ||
157 | /* work to do on interrupt/exception return */ | 159 | /* work to do on interrupt/exception return */ |
158 | #define _TIF_WORK_MASK \ | 160 | #define _TIF_WORK_MASK \ |
diff --git a/include/asm-x86/thread_info_64.h b/include/asm-x86/thread_info_64.h index c8e7736fc792..e0f41b3deced 100644 --- a/include/asm-x86/thread_info_64.h +++ b/include/asm-x86/thread_info_64.h | |||
@@ -121,6 +121,7 @@ static inline struct thread_info *stack_thread_info(void) | |||
121 | #define TIF_DEBUG 21 /* uses debug registers */ | 121 | #define TIF_DEBUG 21 /* uses debug registers */ |
122 | #define TIF_IO_BITMAP 22 /* uses I/O bitmap */ | 122 | #define TIF_IO_BITMAP 22 /* uses I/O bitmap */ |
123 | #define TIF_FREEZE 23 /* is freezing for suspend */ | 123 | #define TIF_FREEZE 23 /* is freezing for suspend */ |
124 | #define TIF_FORCED_TF 24 /* true if TF in eflags artificially */ | ||
124 | 125 | ||
125 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 126 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
126 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 127 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
@@ -138,6 +139,7 @@ static inline struct thread_info *stack_thread_info(void) | |||
138 | #define _TIF_DEBUG (1<<TIF_DEBUG) | 139 | #define _TIF_DEBUG (1<<TIF_DEBUG) |
139 | #define _TIF_IO_BITMAP (1<<TIF_IO_BITMAP) | 140 | #define _TIF_IO_BITMAP (1<<TIF_IO_BITMAP) |
140 | #define _TIF_FREEZE (1<<TIF_FREEZE) | 141 | #define _TIF_FREEZE (1<<TIF_FREEZE) |
142 | #define _TIF_FORCED_TF (1<<TIF_FORCED_TF) | ||
141 | 143 | ||
142 | /* work to do on interrupt/exception return */ | 144 | /* work to do on interrupt/exception return */ |
143 | #define _TIF_WORK_MASK \ | 145 | #define _TIF_WORK_MASK \ |