if ((unsigned long) data > _NSIG) 
if (!valid_signal(data)) 
asmlinkage int sys_ptrace(long request, long pid, long addr, long data){	struct task_struct *child;	struct user * dummy = NULL;	int ret;	lock_kernel();	ret = -EPERM;	if (request == PTRACE_TRACEME) {		/* are we already being traced? */		if (current->ptrace & PT_PTRACED)			goto out;		ret = security_ptrace(current->parent, current);		if (ret)			goto out;		/* set the ptrace bit in the process flags. */		current->ptrace |= PT_PTRACED;		ret = 0;		goto out;	}	ret = -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;	ret = -EPERM;	if (pid == 1)		/* you may not mess with init */		goto out_tsk;	if (request == PTRACE_ATTACH) {		ret = ptrace_attach(child);		goto out_tsk;	}	ret = ptrace_check_attach(child, request == PTRACE_KILL);	if (ret < 0)		goto out_tsk;	switch (request) {	/* when I and D space are separate, these will need to be fixed. */	case PTRACE_PEEKTEXT: /* read word at location addr. */ 	case PTRACE_PEEKDATA: {		unsigned long tmp;		int copied;		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);		ret = -EIO;		if (copied != sizeof(tmp))			break;		ret = put_user(tmp,(unsigned long *) data);		break;	}	/* read the word at location addr in the USER area. */	case PTRACE_PEEKUSR: {		unsigned long tmp;		ret = -EIO;		if ((addr & 3) || addr < 0 || 		    addr > sizeof(struct user) - 3)			break;		if (addr < sizeof(struct pt_regs))			tmp = get_stack_long(child, addr);		else if (addr >= (long) &dummy->fpu &&			 addr < (long) &dummy->u_fpvalid) {			if (!tsk_used_math(child)) {				if (addr == (long)&dummy->fpu.fpscr)					tmp = FPSCR_INIT;				else					tmp = 0;			} else				tmp = ((long *)&child->thread.fpu)					[(addr - (long)&dummy->fpu) >> 2];		} else if (addr == (long) &dummy->u_fpvalid)			tmp = !!tsk_used_math(child);		else			tmp = 0;		ret = put_user(tmp, (unsigned long *)data);		break;	}	/* when I and D space are separate, this will have to be fixed. */	case PTRACE_POKETEXT: /* write the word at location addr. */	case PTRACE_POKEDATA:		ret = 0;		if (access_process_vm(child, addr, &data, sizeof(data), 1) == sizeof(data))			break;		ret = -EIO;		break;	case PTRACE_POKEUSR: /* write the word at location addr in the USER area */		ret = -EIO;		if ((addr & 3) || addr < 0 || 		    addr > sizeof(struct user) - 3)			break;		if (addr < sizeof(struct pt_regs))			ret = put_stack_long(child, addr, data);		else if (addr >= (long) &dummy->fpu &&			 addr < (long) &dummy->u_fpvalid) {			set_stopped_child_used_math(child);			((long *)&child->thread.fpu)				[(addr - (long)&dummy->fpu) >> 2] = data;			ret = 0;		} else if (addr == (long) &dummy->u_fpvalid) {			conditional_stopped_child_used_math(data, child);			ret = 0;		}		break;	case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */	case PTRACE_CONT: { /* restart after signal. */		ret = -EIO;		if ((unsigned long) data > _NSIG)			break;		if (request == PTRACE_SYSCALL)			set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);		else			clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);		child->exit_code = data;		wake_up_process(child);		ret = 0;		break;	}/* * make the child exit.  Best I can do is send it a sigkill.  * perhaps it should be put in the status that it wants to  * exit. */	case PTRACE_KILL: {		ret = 0;		if (child->exit_state == EXIT_ZOMBIE)	/* already dead */			break;		child->exit_code = SIGKILL;		wake_up_process(child);		break;	}	case PTRACE_SINGLESTEP: {  /* set the trap flag. */		long pc;		struct pt_regs *dummy = NULL;		ret = -EIO;		if ((unsigned long) data > _NSIG)			break;		clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);		if ((child->ptrace & PT_DTRACE) == 0) {			/* Spurious delayed TF traps may occur */			child->ptrace |= PT_DTRACE;		}		pc = get_stack_long(child, (long)&dummy->pc);		/* Next scheduling will set up UBC */		if (child->thread.ubc_pc == 0)			ubc_usercnt += 1;		child->thread.ubc_pc = pc;		child->exit_code = data;		/* give it a chance to run. */		wake_up_process(child);		ret = 0;		break;	}	case PTRACE_DETACH: /* detach a process that was attached. */		ret = ptrace_detach(child, data);		break;#ifdef CONFIG_SH_DSP	case PTRACE_GETDSPREGS: {		unsigned long dp;		ret = -EIO;		dp = ((unsigned long) child) + THREAD_SIZE -			 sizeof(struct pt_dspregs);		if (*((int *) (dp - 4)) == SR_FD) {			copy_to_user(addr, (void *) dp,				sizeof(struct pt_dspregs));			ret = 0;		}		break;	}	case PTRACE_SETDSPREGS: {		unsigned long dp;		int i;		ret = -EIO;		dp = ((unsigned long) child) + THREAD_SIZE -			 sizeof(struct pt_dspregs);		if (*((int *) (dp - 4)) == SR_FD) {			copy_from_user((void *) dp, addr,				sizeof(struct pt_dspregs));			ret = 0;		}		break;	}#endif	default:		ret = ptrace_request(child, request, addr, data);		break;	}out_tsk:	put_task_struct(child);out:	unlock_kernel();	return ret;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/7ed20e1ad521b5f5df61bf6559ae60738e393741/ptrace.c/clean/arch/sh/kernel/ptrace.c