Commit 1b47a683 authored by Max Filippov's avatar Max Filippov

xtensa: clean up xtensa/kernel/ptrace.c

- make locally-used functions static;
- drop meaningless comments and commented out code;
- fix code style and alignment.
Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
parent d9c7710d
// TODO some minor issues
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
......@@ -24,13 +23,13 @@
#include <linux/security.h>
#include <linux/signal.h>
#include <linux/smp.h>
#include <linux/uaccess.h>
#include <asm/coprocessor.h>
#include <asm/elf.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/ptrace.h>
#include <linux/uaccess.h>
void user_enable_single_step(struct task_struct *child)
......@@ -52,7 +51,7 @@ void ptrace_disable(struct task_struct *child)
/* Nothing to do.. */
}
int ptrace_getregs(struct task_struct *child, void __user *uregs)
static int ptrace_getregs(struct task_struct *child, void __user *uregs)
{
struct pt_regs *regs = task_pt_regs(child);
xtensa_gregset_t __user *gregset = uregs;
......@@ -78,7 +77,7 @@ int ptrace_getregs(struct task_struct *child, void __user *uregs)
return 0;
}
int ptrace_setregs(struct task_struct *child, void __user *uregs)
static int ptrace_setregs(struct task_struct *child, void __user *uregs)
{
struct pt_regs *regs = task_pt_regs(child);
xtensa_gregset_t *gregset = uregs;
......@@ -127,7 +126,7 @@ int ptrace_setregs(struct task_struct *child, void __user *uregs)
}
int ptrace_getxregs(struct task_struct *child, void __user *uregs)
static int ptrace_getxregs(struct task_struct *child, void __user *uregs)
{
struct pt_regs *regs = task_pt_regs(child);
struct thread_info *ti = task_thread_info(child);
......@@ -151,7 +150,7 @@ int ptrace_getxregs(struct task_struct *child, void __user *uregs)
return ret ? -EFAULT : 0;
}
int ptrace_setxregs(struct task_struct *child, void __user *uregs)
static int ptrace_setxregs(struct task_struct *child, void __user *uregs)
{
struct thread_info *ti = task_thread_info(child);
struct pt_regs *regs = task_pt_regs(child);
......@@ -177,7 +176,8 @@ int ptrace_setxregs(struct task_struct *child, void __user *uregs)
return ret ? -EFAULT : 0;
}
int ptrace_peekusr(struct task_struct *child, long regno, long __user *ret)
static int ptrace_peekusr(struct task_struct *child, long regno,
long __user *ret)
{
struct pt_regs *regs;
unsigned long tmp;
......@@ -186,7 +186,6 @@ int ptrace_peekusr(struct task_struct *child, long regno, long __user *ret)
tmp = 0; /* Default return value. */
switch(regno) {
case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1:
tmp = regs->areg[regno - REG_AR_BASE];
break;
......@@ -202,7 +201,8 @@ int ptrace_peekusr(struct task_struct *child, long regno, long __user *ret)
case REG_PS:
/* Note: PS.EXCM is not set while user task is running;
* its being set in regs is for exception handling
* convenience. */
* convenience.
*/
tmp = (regs->ps & ~(1 << PS_EXCM_BIT));
break;
......@@ -213,7 +213,8 @@ int ptrace_peekusr(struct task_struct *child, long regno, long __user *ret)
{
unsigned long wb = regs->windowbase;
unsigned long ws = regs->windowstart;
tmp = ((ws>>wb) | (ws<<(WSBITS-wb))) & ((1<<WSBITS)-1);
tmp = ((ws >> wb) | (ws << (WSBITS - wb))) &
((1 << WSBITS) - 1);
break;
}
case REG_LBEG:
......@@ -242,7 +243,7 @@ int ptrace_peekusr(struct task_struct *child, long regno, long __user *ret)
return put_user(tmp, ret);
}
int ptrace_pokeusr(struct task_struct *child, long regno, long val)
static int ptrace_pokeusr(struct task_struct *child, long regno, long val)
{
struct pt_regs *regs;
regs = task_pt_regs(child);
......@@ -473,7 +474,8 @@ void do_syscall_trace(void)
* The 0x80 provides a way for the tracing parent to distinguish
* between a syscall stop and SIGTRAP delivery
*/
ptrace_notify(SIGTRAP|((current->ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
ptrace_notify(SIGTRAP |
((current->ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
/*
* this isn't the same as continuing with a signal, but it will do
......@@ -488,18 +490,14 @@ void do_syscall_trace(void)
void do_syscall_trace_enter(struct pt_regs *regs)
{
if (test_thread_flag(TIF_SYSCALL_TRACE)
&& (current->ptrace & PT_PTRACED))
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
(current->ptrace & PT_PTRACED))
do_syscall_trace();
#if 0
audit_syscall_entry(...);
#endif
}
void do_syscall_trace_leave(struct pt_regs *regs)
{
if ((test_thread_flag(TIF_SYSCALL_TRACE))
&& (current->ptrace & PT_PTRACED))
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
(current->ptrace & PT_PTRACED))
do_syscall_trace();
}
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