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>
This commit is contained in:
Roland McGrath
2008-01-30 13:30:58 +01:00
committed by Ingo Molnar
parent ff14c6164b
commit 80976c0867

View File

@@ -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)
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;
} }
} }