X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fv850%2Fkernel%2Fptrace.c;h=cd759caff1866cbe64e86052efa92da7a1f68645;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=7d2554774198dbde0c50724503fc210d45055590;hpb=a8e794ca871505c8ea96cc102f4ad555c5231d7f;p=linux-2.6.git diff --git a/arch/v850/kernel/ptrace.c b/arch/v850/kernel/ptrace.c index 7d2554774..cd759caff 100644 --- a/arch/v850/kernel/ptrace.c +++ b/arch/v850/kernel/ptrace.c @@ -1,8 +1,8 @@ /* * arch/v850/kernel/ptrace.c -- `ptrace' system call * - * Copyright (C) 2002,03 NEC Electronics Corporation - * Copyright (C) 2002,03 Miles Bader + * Copyright (C) 2002,03,04 NEC Electronics Corporation + * Copyright (C) 2002,03,04 Miles Bader * * Derived from arch/mips/kernel/ptrace.c: * @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include @@ -57,7 +59,7 @@ static v850_reg_t *reg_save_addr (unsigned reg_offs, struct task_struct *t) regs = thread_saved_regs (t); else /* Register saved during kernel entry (or not available). */ - regs = task_regs (t); + regs = task_pt_regs (t); return (v850_reg_t *)((char *)regs + reg_offs); } @@ -112,52 +114,12 @@ static int set_single_step (struct task_struct *t, int val) return 1; } -int sys_ptrace(long request, long pid, long addr, long data) +long arch_ptrace(struct task_struct *child, long request, long addr, long data) { - struct task_struct *child; int rval; - lock_kernel(); - - if (request == PTRACE_TRACEME) { - /* are we already being traced? */ - if (current->ptrace & PT_PTRACED) { - rval = -EPERM; - goto out; - } - /* set the ptrace bit in the process flags. */ - current->ptrace |= PT_PTRACED; - rval = 0; + if (!vx_check(vx_task_xid(child), VS_WATCH_P|VS_IDENT)) goto out; - } - rval = -ESRCH; - read_lock(&tasklist_lock); - child = find_task_by_pid(pid); - if (child) - get_task_struct(child); - read_unlock(&tasklist_lock); - if (!child) - goto out; - if (!vx_check(vx_task_xid(child), VX_WATCH|VX_IDENT)) - goto out_tsk; - - rval = -EPERM; - if (pid == 1) /* you may not mess with init */ - goto out_tsk; - - if (request == PTRACE_ATTACH) { - rval = ptrace_attach(child); - goto out_tsk; - } - rval = -ESRCH; - if (!(child->ptrace & PT_PTRACED)) - goto out_tsk; - if (child->state != TASK_STOPPED) { - if (request != PTRACE_KILL) - goto out_tsk; - } - if (child->parent != current) - goto out_tsk; switch (request) { unsigned long val, copied; @@ -216,7 +178,7 @@ int sys_ptrace(long request, long pid, long addr, long data) /* Execute a single instruction. */ case PTRACE_SINGLESTEP: rval = -EIO; - if ((unsigned long) data > _NSIG) + if (!valid_signal(data)) break; /* Turn CHILD's single-step flag on or off. */ @@ -240,7 +202,7 @@ int sys_ptrace(long request, long pid, long addr, long data) */ case PTRACE_KILL: rval = 0; - if (child->state == TASK_ZOMBIE) /* already dead */ + if (child->exit_state == EXIT_ZOMBIE) /* already dead */ break; child->exit_code = SIGKILL; wake_up_process(child); @@ -255,11 +217,7 @@ int sys_ptrace(long request, long pid, long addr, long data) rval = -EIO; goto out; } - -out_tsk: - put_task_struct(child); -out: - unlock_kernel(); + out: return rval; } @@ -271,11 +229,8 @@ asmlinkage void syscall_trace(void) return; /* The 0x80 provides a way for the tracing parent to distinguish between a syscall stop and SIGTRAP delivery */ - current->exit_code = SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) - ? 0x80 : 0); - current->state = TASK_STOPPED; - notify_parent(current, SIGCHLD); - schedule(); + ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) + ? 0x80 : 0)); /* * this isn't the same as continuing with a signal, but it will do * for normal use. strace only continues with a signal if the