Commit 80976c08 authored by Roland McGrath's avatar Roland McGrath Committed by Ingo Molnar

x86: x86-64 ptrace whitespace

This canonicalizes the indentation in the getreg and putreg functions.
Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent ff14c616
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* /*
* Pentium III FXSR, SSE support * Pentium III FXSR, SSE support
* Gareth Hughes <gareth@valinux.com>, May 2000 * Gareth Hughes <gareth@valinux.com>, May 2000
* *
* x86-64 port 2000-2002 Andi Kleen * x86-64 port 2000-2002 Andi Kleen
*/ */
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
* Make sure the single step bit is not set. * Make sure the single step bit is not set.
*/ */
void ptrace_disable(struct task_struct *child) void ptrace_disable(struct task_struct *child)
{ {
user_disable_single_step(child); user_disable_single_step(child);
} }
...@@ -63,69 +63,69 @@ static int putreg(struct task_struct *child, ...@@ -63,69 +63,69 @@ static int putreg(struct task_struct *child,
{ {
struct pt_regs *regs = task_pt_regs(child); struct pt_regs *regs = task_pt_regs(child);
switch (regno) { switch (regno) {
case offsetof(struct user_regs_struct,fs): case offsetof(struct user_regs_struct,fs):
if (value && (value & 3) != 3) if (value && (value & 3) != 3)
return -EIO; return -EIO;
child->thread.fsindex = value & 0xffff; child->thread.fsindex = value & 0xffff;
return 0; return 0;
case offsetof(struct user_regs_struct,gs): case offsetof(struct user_regs_struct,gs):
if (value && (value & 3) != 3) if (value && (value & 3) != 3)
return -EIO; return -EIO;
child->thread.gsindex = value & 0xffff; child->thread.gsindex = value & 0xffff;
return 0; return 0;
case offsetof(struct user_regs_struct,ds): case offsetof(struct user_regs_struct,ds):
if (value && (value & 3) != 3) if (value && (value & 3) != 3)
return -EIO; return -EIO;
child->thread.ds = value & 0xffff; child->thread.ds = value & 0xffff;
return 0; return 0;
case offsetof(struct user_regs_struct,es): case offsetof(struct user_regs_struct,es):
if (value && (value & 3) != 3) if (value && (value & 3) != 3)
return -EIO; return -EIO;
child->thread.es = value & 0xffff; child->thread.es = value & 0xffff;
return 0; return 0;
case offsetof(struct user_regs_struct,ss): case offsetof(struct user_regs_struct,ss):
if ((value & 3) != 3) if ((value & 3) != 3)
return -EIO; return -EIO;
value &= 0xffff; value &= 0xffff;
return 0; return 0;
case offsetof(struct user_regs_struct,fs_base): case offsetof(struct user_regs_struct,fs_base):
if (value >= TASK_SIZE_OF(child)) if (value >= TASK_SIZE_OF(child))
return -EIO; return -EIO;
/* /*
* When changing the segment base, use do_arch_prctl * When changing the segment base, use do_arch_prctl
* to set either thread.fs or thread.fsindex and the * to set either thread.fs or thread.fsindex and the
* corresponding GDT slot. * corresponding GDT slot.
*/ */
if (child->thread.fs != value) if (child->thread.fs != value)
return do_arch_prctl(child, ARCH_SET_FS, value); return do_arch_prctl(child, ARCH_SET_FS, value);
return 0; return 0;
case offsetof(struct user_regs_struct,gs_base): case offsetof(struct user_regs_struct,gs_base):
/* /*
* Exactly the same here as the %fs handling above. * Exactly the same here as the %fs handling above.
*/ */
if (value >= TASK_SIZE_OF(child)) if (value >= TASK_SIZE_OF(child))
return -EIO; return -EIO;
if (child->thread.gs != value) if (child->thread.gs != value)
return do_arch_prctl(child, ARCH_SET_GS, value); return do_arch_prctl(child, ARCH_SET_GS, value);
return 0; return 0;
case offsetof(struct user_regs_struct,flags): case offsetof(struct user_regs_struct,flags):
value &= FLAG_MASK; value &= FLAG_MASK;
/* /*
* If the user value contains TF, mark that * If the user value contains TF, mark that
* it was not "us" (the debugger) that set it. * it was not "us" (the debugger) that set it.
* If not, make sure it stays set if we had. * If not, make sure it stays set if we had.
*/ */
if (value & X86_EFLAGS_TF) if (value & X86_EFLAGS_TF)
clear_tsk_thread_flag(child, TIF_FORCED_TF); clear_tsk_thread_flag(child, TIF_FORCED_TF);
else if (test_tsk_thread_flag(child, TIF_FORCED_TF)) else if (test_tsk_thread_flag(child, TIF_FORCED_TF))
value |= X86_EFLAGS_TF; value |= X86_EFLAGS_TF;
value |= regs->flags & ~FLAG_MASK; value |= regs->flags & ~FLAG_MASK;
break; break;
case offsetof(struct user_regs_struct,cs): case offsetof(struct user_regs_struct,cs):
if ((value & 3) != 3) if ((value & 3) != 3)
return -EIO; return -EIO;
value &= 0xffff; value &= 0xffff;
break; break;
} }
*pt_regs_access(regs, regno) = value; *pt_regs_access(regs, regno) = value;
return 0; return 0;
...@@ -136,49 +136,49 @@ static unsigned long getreg(struct task_struct *child, unsigned long regno) ...@@ -136,49 +136,49 @@ static unsigned long getreg(struct task_struct *child, unsigned long regno)
struct pt_regs *regs = task_pt_regs(child); struct pt_regs *regs = task_pt_regs(child);
unsigned long val; unsigned long val;
switch (regno) { switch (regno) {
case offsetof(struct user_regs_struct, fs): case offsetof(struct user_regs_struct, fs):
return child->thread.fsindex; return child->thread.fsindex;
case offsetof(struct user_regs_struct, gs): case offsetof(struct user_regs_struct, gs):
return child->thread.gsindex; return child->thread.gsindex;
case offsetof(struct user_regs_struct, ds): case offsetof(struct user_regs_struct, ds):
return child->thread.ds; return child->thread.ds;
case offsetof(struct user_regs_struct, es): case offsetof(struct user_regs_struct, es):
return child->thread.es; return child->thread.es;
case offsetof(struct user_regs_struct, fs_base): case offsetof(struct user_regs_struct, fs_base):
/* /*
* do_arch_prctl may have used a GDT slot instead of * do_arch_prctl may have used a GDT slot instead of
* the MSR. To userland, it appears the same either * the MSR. To userland, it appears the same either
* way, except the %fs segment selector might not be 0. * way, except the %fs segment selector might not be 0.
*/ */
if (child->thread.fs != 0) if (child->thread.fs != 0)
return child->thread.fs; return child->thread.fs;
if (child->thread.fsindex != FS_TLS_SEL) if (child->thread.fsindex != FS_TLS_SEL)
return 0; return 0;
return get_desc_base(&child->thread.tls_array[FS_TLS]); return get_desc_base(&child->thread.tls_array[FS_TLS]);
case offsetof(struct user_regs_struct, gs_base): case offsetof(struct user_regs_struct, gs_base):
/* /*
* Exactly the same here as the %fs handling above. * Exactly the same here as the %fs handling above.
*/ */
if (child->thread.gs != 0) if (child->thread.gs != 0)
return child->thread.gs; return child->thread.gs;
if (child->thread.gsindex != GS_TLS_SEL) if (child->thread.gsindex != GS_TLS_SEL)
return 0; return 0;
return get_desc_base(&child->thread.tls_array[GS_TLS]); return get_desc_base(&child->thread.tls_array[GS_TLS]);
case offsetof(struct user_regs_struct, flags): case offsetof(struct user_regs_struct, flags):
/* /*
* If the debugger set TF, hide it from the readout. * If the debugger set TF, hide it from the readout.
*/ */
val = regs->flags; val = regs->flags;
if (test_tsk_thread_flag(child, TIF_IA32)) if (test_tsk_thread_flag(child, TIF_IA32))
val &= 0xffffffff; val &= 0xffffffff;
if (test_tsk_thread_flag(child, TIF_FORCED_TF)) if (test_tsk_thread_flag(child, TIF_FORCED_TF))
val &= ~X86_EFLAGS_TF; val &= ~X86_EFLAGS_TF;
return val; return val;
default: default:
val = *pt_regs_access(regs, regno); val = *pt_regs_access(regs, regno);
if (test_tsk_thread_flag(child, TIF_IA32)) if (test_tsk_thread_flag(child, TIF_IA32))
val &= 0xffffffff; val &= 0xffffffff;
return val; return val;
} }
} }
...@@ -244,7 +244,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -244,7 +244,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
switch (request) { switch (request) {
/* when I and D space are separate, these will need to be fixed. */ /* when I and D space are separate, these will need to be fixed. */
case PTRACE_PEEKTEXT: /* read word at location addr. */ case PTRACE_PEEKTEXT: /* read word at location addr. */
case PTRACE_PEEKDATA: case PTRACE_PEEKDATA:
ret = generic_ptrace_peekdata(child, addr, data); ret = generic_ptrace_peekdata(child, addr, data);
break; break;
...@@ -310,10 +310,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -310,10 +310,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
(struct user_desc __user *) data, 0); (struct user_desc __user *) data, 0);
break; break;
#endif #endif
/* normal 64bit interface to access TLS data. /* normal 64bit interface to access TLS data.
Works just like arch_prctl, except that the arguments Works just like arch_prctl, except that the arguments
are reversed. */ are reversed. */
case PTRACE_ARCH_PRCTL: case PTRACE_ARCH_PRCTL:
ret = do_arch_prctl(child, data, addr); ret = do_arch_prctl(child, data, addr);
break; break;
...@@ -386,7 +386,7 @@ static void syscall_trace(struct pt_regs *regs) ...@@ -386,7 +386,7 @@ static void syscall_trace(struct pt_regs *regs)
printk("trace %s ip %lx sp %lx ax %d origrax %d caller %lx tiflags %x ptrace %x\n", printk("trace %s ip %lx sp %lx ax %d origrax %d caller %lx tiflags %x ptrace %x\n",
current->comm, current->comm,
regs->ip, regs->sp, regs->ax, regs->orig_ax, __builtin_return_address(0), regs->ip, regs->sp, regs->ax, regs->orig_ax, __builtin_return_address(0),
current_thread_info()->flags, current->ptrace); current_thread_info()->flags, current->ptrace);
#endif #endif
ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment