aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2012-12-13 11:34:45 -0500
committerChris Metcalf <cmetcalf@tilera.com>2012-12-14 12:56:54 -0500
commit395e095ed92b1ccfe74c90fee4cc637cff468ea7 (patch)
tree0c93516feaaf0c4383c1d7b5963fe5fddb7231a6 /arch
parentcb67e161bc947ab467657dda38168c2b2266f5bc (diff)
arch/tile: clean up tile-specific PTRACE_SETOPTIONS
Use the newer idioms for setting PTRACE_O_xxx and PT_TRACE_xxx flags. Only set/clear tile-specific flags if the generic routine returns success, since otherwise we want to avoid setting any flags at all. Atomically update the ptrace flags with the new values. Eliminate the PT_TRACE_MASK_TILE bitmask and just shift PTRACE_O_MASK_TILE. Add a BUILD_BUG_ON to avoid overlapping with generic bits. Acked-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/tile/include/asm/ptrace.h3
-rw-r--r--arch/tile/include/uapi/asm/ptrace.h2
-rw-r--r--arch/tile/kernel/ptrace.c10
3 files changed, 9 insertions, 6 deletions
diff --git a/arch/tile/include/asm/ptrace.h b/arch/tile/include/asm/ptrace.h
index 1a4fd9ab0ee1..5ce052e16b7b 100644
--- a/arch/tile/include/asm/ptrace.h
+++ b/arch/tile/include/asm/ptrace.h
@@ -24,8 +24,7 @@ typedef unsigned long pt_reg_t;
24#include <uapi/asm/ptrace.h> 24#include <uapi/asm/ptrace.h>
25 25
26#define PTRACE_O_MASK_TILE (PTRACE_O_TRACEMIGRATE) 26#define PTRACE_O_MASK_TILE (PTRACE_O_TRACEMIGRATE)
27#define PT_TRACE_MIGRATE 0x00080000 27#define PT_TRACE_MIGRATE PT_EVENT_FLAG(PTRACE_EVENT_MIGRATE)
28#define PT_TRACE_MASK_TILE (PT_TRACE_MIGRATE)
29 28
30/* Flag bits in pt_regs.flags */ 29/* Flag bits in pt_regs.flags */
31#define PT_FLAGS_DISABLE_IRQ 1 /* on return to kernel, disable irqs */ 30#define PT_FLAGS_DISABLE_IRQ 1 /* on return to kernel, disable irqs */
diff --git a/arch/tile/include/uapi/asm/ptrace.h b/arch/tile/include/uapi/asm/ptrace.h
index 0d2208803b29..7757e1985fb6 100644
--- a/arch/tile/include/uapi/asm/ptrace.h
+++ b/arch/tile/include/uapi/asm/ptrace.h
@@ -81,8 +81,8 @@ struct pt_regs {
81#define PTRACE_SETFPREGS 15 81#define PTRACE_SETFPREGS 15
82 82
83/* Support TILE-specific ptrace options, with events starting at 16. */ 83/* Support TILE-specific ptrace options, with events starting at 16. */
84#define PTRACE_O_TRACEMIGRATE 0x00010000
85#define PTRACE_EVENT_MIGRATE 16 84#define PTRACE_EVENT_MIGRATE 16
85#define PTRACE_O_TRACEMIGRATE (1 << PTRACE_EVENT_MIGRATE)
86 86
87/* 87/*
88 * Flag bits in pt_regs.flags that are part of the ptrace API. 88 * Flag bits in pt_regs.flags that are part of the ptrace API.
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 64ba102c5964..b32bc3f9d631 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -151,12 +151,16 @@ long arch_ptrace(struct task_struct *child, long request,
151 151
152 case PTRACE_SETOPTIONS: 152 case PTRACE_SETOPTIONS:
153 /* Support TILE-specific ptrace options. */ 153 /* Support TILE-specific ptrace options. */
154 child->ptrace &= ~PT_TRACE_MASK_TILE; 154 BUILD_BUG_ON(PTRACE_O_MASK_TILE & PTRACE_O_MASK);
155 tmp = data & PTRACE_O_MASK_TILE; 155 tmp = data & PTRACE_O_MASK_TILE;
156 data &= ~PTRACE_O_MASK_TILE; 156 data &= ~PTRACE_O_MASK_TILE;
157 ret = ptrace_request(child, request, addr, data); 157 ret = ptrace_request(child, request, addr, data);
158 if (tmp & PTRACE_O_TRACEMIGRATE) 158 if (ret == 0) {
159 child->ptrace |= PT_TRACE_MIGRATE; 159 unsigned int flags = child->ptrace;
160 flags &= ~(PTRACE_O_MASK_TILE << PT_OPT_FLAG_SHIFT);
161 flags |= (tmp << PT_OPT_FLAG_SHIFT);
162 child->ptrace = flags;
163 }
160 break; 164 break;
161 165
162 default: 166 default: