aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2008-01-30 07:30:58 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:30:58 -0500
commit80976c0867b7537d77511492d3180b8093b0ba3d (patch)
treee381d99b8b6b4f84b5f3810ad40edef1f1d204b7 /arch
parentff14c6164bd532a6dc9025c07d3b562f839f00a9 (diff)
x86: x86-64 ptrace whitespace
This canonicalizes the indentation in the getreg and putreg functions. 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 'arch')
-rw-r--r--arch/x86/kernel/ptrace_64.c224
1 files changed, 112 insertions, 112 deletions
diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c
index 56b31cd3b865..2427548f2a01 100644
--- a/arch/x86/kernel/ptrace_64.c
+++ b/arch/x86/kernel/ptrace_64.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Pentium III FXSR, SSE support 3 * Pentium III FXSR, SSE support
4 * Gareth Hughes <gareth@valinux.com>, May 2000 4 * Gareth Hughes <gareth@valinux.com>, May 2000
5 * 5 *
6 * x86-64 port 2000-2002 Andi Kleen 6 * x86-64 port 2000-2002 Andi Kleen
7 */ 7 */
8 8
@@ -48,7 +48,7 @@
48 * Make sure the single step bit is not set. 48 * Make sure the single step bit is not set.
49 */ 49 */
50void ptrace_disable(struct task_struct *child) 50void ptrace_disable(struct task_struct *child)
51{ 51{
52 user_disable_single_step(child); 52 user_disable_single_step(child);
53} 53}
54 54
@@ -63,69 +63,69 @@ static int putreg(struct task_struct *child,
63{ 63{
64 struct pt_regs *regs = task_pt_regs(child); 64 struct pt_regs *regs = task_pt_regs(child);
65 switch (regno) { 65 switch (regno) {
66 case offsetof(struct user_regs_struct,fs): 66 case offsetof(struct user_regs_struct,fs):
67 if (value && (value & 3) != 3) 67 if (value && (value & 3) != 3)
68 return -EIO; 68 return -EIO;
69 child->thread.fsindex = value & 0xffff; 69 child->thread.fsindex = value & 0xffff;
70 return 0; 70 return 0;
71 case offsetof(struct user_regs_struct,gs): 71 case offsetof(struct user_regs_struct,gs):
72 if (value && (value & 3) != 3) 72 if (value && (value & 3) != 3)
73 return -EIO; 73 return -EIO;
74 child->thread.gsindex = value & 0xffff; 74 child->thread.gsindex = value & 0xffff;
75 return 0; 75 return 0;
76 case offsetof(struct user_regs_struct,ds): 76 case offsetof(struct user_regs_struct,ds):
77 if (value && (value & 3) != 3) 77 if (value && (value & 3) != 3)
78 return -EIO; 78 return -EIO;
79 child->thread.ds = value & 0xffff; 79 child->thread.ds = value & 0xffff;
80 return 0; 80 return 0;
81 case offsetof(struct user_regs_struct,es): 81 case offsetof(struct user_regs_struct,es):
82 if (value && (value & 3) != 3) 82 if (value && (value & 3) != 3)
83 return -EIO; 83 return -EIO;
84 child->thread.es = value & 0xffff; 84 child->thread.es = value & 0xffff;
85 return 0; 85 return 0;
86 case offsetof(struct user_regs_struct,ss): 86 case offsetof(struct user_regs_struct,ss):
87 if ((value & 3) != 3) 87 if ((value & 3) != 3)
88 return -EIO; 88 return -EIO;
89 value &= 0xffff; 89 value &= 0xffff;
90 return 0; 90 return 0;
91 case offsetof(struct user_regs_struct,fs_base): 91 case offsetof(struct user_regs_struct,fs_base):
92 if (value >= TASK_SIZE_OF(child)) 92 if (value >= TASK_SIZE_OF(child))
93 return -EIO; 93 return -EIO;
94 /* 94 /*
95 * When changing the segment base, use do_arch_prctl 95 * When changing the segment base, use do_arch_prctl
96 * to set either thread.fs or thread.fsindex and the 96 * to set either thread.fs or thread.fsindex and the
97 * corresponding GDT slot. 97 * corresponding GDT slot.
98 */ 98 */
99 if (child->thread.fs != value) 99 if (child->thread.fs != value)
100 return do_arch_prctl(child, ARCH_SET_FS, value); 100 return do_arch_prctl(child, ARCH_SET_FS, value);
101 return 0; 101 return 0;
102 case offsetof(struct user_regs_struct,gs_base): 102 case offsetof(struct user_regs_struct,gs_base):
103 /* 103 /*
104 * Exactly the same here as the %fs handling above. 104 * Exactly the same here as the %fs handling above.
105 */ 105 */
106 if (value >= TASK_SIZE_OF(child)) 106 if (value >= TASK_SIZE_OF(child))
107 return -EIO; 107 return -EIO;
108 if (child->thread.gs != value) 108 if (child->thread.gs != value)
109 return do_arch_prctl(child, ARCH_SET_GS, value); 109 return do_arch_prctl(child, ARCH_SET_GS, value);
110 return 0; 110 return 0;
111 case offsetof(struct user_regs_struct,flags): 111 case offsetof(struct user_regs_struct,flags):
112 value &= FLAG_MASK; 112 value &= FLAG_MASK;
113 /* 113 /*
114 * If the user value contains TF, mark that 114 * If the user value contains TF, mark that
115 * it was not "us" (the debugger) that set it. 115 * it was not "us" (the debugger) that set it.
116 * If not, make sure it stays set if we had. 116 * If not, make sure it stays set if we had.
117 */ 117 */
118 if (value & X86_EFLAGS_TF) 118 if (value & X86_EFLAGS_TF)
119 clear_tsk_thread_flag(child, TIF_FORCED_TF); 119 clear_tsk_thread_flag(child, TIF_FORCED_TF);
120 else if (test_tsk_thread_flag(child, TIF_FORCED_TF)) 120 else if (test_tsk_thread_flag(child, TIF_FORCED_TF))
121 value |= X86_EFLAGS_TF; 121 value |= X86_EFLAGS_TF;
122 value |= regs->flags & ~FLAG_MASK; 122 value |= regs->flags & ~FLAG_MASK;
123 break; 123 break;
124 case offsetof(struct user_regs_struct,cs): 124 case offsetof(struct user_regs_struct,cs):
125 if ((value & 3) != 3) 125 if ((value & 3) != 3)
126 return -EIO; 126 return -EIO;
127 value &= 0xffff; 127 value &= 0xffff;
128 break; 128 break;
129 } 129 }
130 *pt_regs_access(regs, regno) = value; 130 *pt_regs_access(regs, regno) = value;
131 return 0; 131 return 0;
@@ -136,49 +136,49 @@ static unsigned long getreg(struct task_struct *child, unsigned long regno)
136 struct pt_regs *regs = task_pt_regs(child); 136 struct pt_regs *regs = task_pt_regs(child);
137 unsigned long val; 137 unsigned long val;
138 switch (regno) { 138 switch (regno) {
139 case offsetof(struct user_regs_struct, fs): 139 case offsetof(struct user_regs_struct, fs):
140 return child->thread.fsindex; 140 return child->thread.fsindex;
141 case offsetof(struct user_regs_struct, gs): 141 case offsetof(struct user_regs_struct, gs):
142 return child->thread.gsindex; 142 return child->thread.gsindex;
143 case offsetof(struct user_regs_struct, ds): 143 case offsetof(struct user_regs_struct, ds):
144 return child->thread.ds; 144 return child->thread.ds;
145 case offsetof(struct user_regs_struct, es): 145 case offsetof(struct user_regs_struct, es):
146 return child->thread.es; 146 return child->thread.es;
147 case offsetof(struct user_regs_struct, fs_base): 147 case offsetof(struct user_regs_struct, fs_base):
148 /* 148 /*
149 * do_arch_prctl may have used a GDT slot instead of 149 * do_arch_prctl may have used a GDT slot instead of
150 * the MSR. To userland, it appears the same either 150 * the MSR. To userland, it appears the same either
151 * way, except the %fs segment selector might not be 0. 151 * way, except the %fs segment selector might not be 0.
152 */ 152 */
153 if (child->thread.fs != 0) 153 if (child->thread.fs != 0)
154 return child->thread.fs; 154 return child->thread.fs;
155 if (child->thread.fsindex != FS_TLS_SEL) 155 if (child->thread.fsindex != FS_TLS_SEL)
156 return 0; 156 return 0;
157 return get_desc_base(&child->thread.tls_array[FS_TLS]); 157 return get_desc_base(&child->thread.tls_array[FS_TLS]);
158 case offsetof(struct user_regs_struct, gs_base): 158 case offsetof(struct user_regs_struct, gs_base):
159 /* 159 /*
160 * Exactly the same here as the %fs handling above. 160 * Exactly the same here as the %fs handling above.
161 */ 161 */
162 if (child->thread.gs != 0) 162 if (child->thread.gs != 0)
163 return child->thread.gs; 163 return child->thread.gs;
164 if (child->thread.gsindex != GS_TLS_SEL) 164 if (child->thread.gsindex != GS_TLS_SEL)
165 return 0; 165 return 0;
166 return get_desc_base(&child->thread.tls_array[GS_TLS]); 166 return get_desc_base(&child->thread.tls_array[GS_TLS]);
167 case offsetof(struct user_regs_struct, flags): 167 case offsetof(struct user_regs_struct, flags):
168 /* 168 /*
169 * If the debugger set TF, hide it from the readout. 169 * If the debugger set TF, hide it from the readout.
170 */ 170 */
171 val = regs->flags; 171 val = regs->flags;
172 if (test_tsk_thread_flag(child, TIF_IA32)) 172 if (test_tsk_thread_flag(child, TIF_IA32))
173 val &= 0xffffffff; 173 val &= 0xffffffff;
174 if (test_tsk_thread_flag(child, TIF_FORCED_TF)) 174 if (test_tsk_thread_flag(child, TIF_FORCED_TF))
175 val &= ~X86_EFLAGS_TF; 175 val &= ~X86_EFLAGS_TF;
176 return val; 176 return val;
177 default: 177 default:
178 val = *pt_regs_access(regs, regno); 178 val = *pt_regs_access(regs, regno);
179 if (test_tsk_thread_flag(child, TIF_IA32)) 179 if (test_tsk_thread_flag(child, TIF_IA32))
180 val &= 0xffffffff; 180 val &= 0xffffffff;
181 return val; 181 return val;
182 } 182 }
183 183
184} 184}
@@ -244,7 +244,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
244 244
245 switch (request) { 245 switch (request) {
246 /* when I and D space are separate, these will need to be fixed. */ 246 /* when I and D space are separate, these will need to be fixed. */
247 case PTRACE_PEEKTEXT: /* read word at location addr. */ 247 case PTRACE_PEEKTEXT: /* read word at location addr. */
248 case PTRACE_PEEKDATA: 248 case PTRACE_PEEKDATA:
249 ret = generic_ptrace_peekdata(child, addr, data); 249 ret = generic_ptrace_peekdata(child, addr, data);
250 break; 250 break;
@@ -310,10 +310,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
310 (struct user_desc __user *) data, 0); 310 (struct user_desc __user *) data, 0);
311 break; 311 break;
312#endif 312#endif
313 /* normal 64bit interface to access TLS data. 313 /* normal 64bit interface to access TLS data.
314 Works just like arch_prctl, except that the arguments 314 Works just like arch_prctl, except that the arguments
315 are reversed. */ 315 are reversed. */
316 case PTRACE_ARCH_PRCTL: 316 case PTRACE_ARCH_PRCTL:
317 ret = do_arch_prctl(child, data, addr); 317 ret = do_arch_prctl(child, data, addr);
318 break; 318 break;
319 319
@@ -386,7 +386,7 @@ static void syscall_trace(struct pt_regs *regs)
386 printk("trace %s ip %lx sp %lx ax %d origrax %d caller %lx tiflags %x ptrace %x\n", 386 printk("trace %s ip %lx sp %lx ax %d origrax %d caller %lx tiflags %x ptrace %x\n",
387 current->comm, 387 current->comm,
388 regs->ip, regs->sp, regs->ax, regs->orig_ax, __builtin_return_address(0), 388 regs->ip, regs->sp, regs->ax, regs->orig_ax, __builtin_return_address(0),
389 current_thread_info()->flags, current->ptrace); 389 current_thread_info()->flags, current->ptrace);
390#endif 390#endif
391 391
392 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) 392 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)