2 * linux/arch/cris/kernel/ptrace.c
4 * Parts taken from the m68k port.
6 * Copyright (c) 2000, 2001, 2002 Axis Communications AB
11 * Revision 1.1.1.1 2005/04/29 01:40:43 echo
12 * Project for BCMDT_3.0
14 * Revision 1.9 2003/07/04 12:56:11 tobiasa
15 * Moved arch-specific code to arch-specific files.
17 * Revision 1.8 2003/04/09 05:20:47 starvik
18 * Merge of Linux 2.5.67
20 * Revision 1.7 2002/11/27 08:42:34 starvik
21 * Argument to user_regs() is thread_info*
23 * Revision 1.6 2002/11/20 11:56:11 starvik
24 * Merge of Linux 2.5.48
26 * Revision 1.5 2002/11/18 07:41:19 starvik
29 * Revision 1.4 2002/11/11 12:47:28 starvik
30 * SYSCALL_TRACE has been moved to thread flags
32 * Revision 1.3 2002/02/05 15:37:18 bjornw
33 * * Add do_notify_resume (replaces do_signal in the callchain)
34 * * syscall_trace is now do_syscall_trace
35 * * current->ptrace flag PT_TRACESYS -> PT_SYSCALLTRACE
36 * * Keep track of the current->work.syscall_trace counter
38 * Revision 1.2 2001/12/18 13:35:20 bjornw
39 * Applied the 2.4.13->2.4.16 CRIS patch to 2.5.1 (is a copy of 2.4.15).
41 * Revision 1.8 2001/11/12 18:26:21 pkj
42 * Fixed compiler warnings.
44 * Revision 1.7 2001/09/26 11:53:49 bjornw
45 * PTRACE_DETACH works more simple in 2.4.10
47 * Revision 1.6 2001/07/25 16:08:47 bjornw
48 * PTRACE_ATTACH bulk moved into arch-independent code in 2.4.7
50 * Revision 1.5 2001/03/26 14:24:28 orjanf
51 * * Changed loop condition.
52 * * Added comment documenting non-standard ptrace behaviour.
54 * Revision 1.4 2001/03/20 19:44:41 bjornw
55 * Use the user_regs macro instead of thread.esp0
57 * Revision 1.3 2000/12/18 23:45:25 bjornw
58 * Linux/CRIS first version
63 #include <linux/kernel.h>
64 #include <linux/sched.h>
66 #include <linux/smp.h>
67 #include <linux/smp_lock.h>
68 #include <linux/errno.h>
69 #include <linux/ptrace.h>
70 #include <linux/user.h>
72 #include <asm/uaccess.h>
74 #include <asm/pgtable.h>
75 #include <asm/system.h>
76 #include <asm/processor.h>
79 * Get contents of register REGNO in task TASK.
81 inline long get_reg(struct task_struct *task, unsigned int regno)
83 /* USP is a special case, it's not in the pt_regs struct but
84 * in the tasks thread struct
88 return task->thread.usp;
89 else if (regno < PT_MAX)
90 return ((unsigned long *)user_regs(task->thread_info))[regno];
96 * Write contents of register REGNO in task TASK.
98 inline int put_reg(struct task_struct *task, unsigned int regno,
102 task->thread.usp = data;
103 else if (regno < PT_MAX)
104 ((unsigned long *)user_regs(task->thread_info))[regno] = data;
110 /* notification of userspace execution resumption
111 * - triggered by current->work.notify_resume
113 extern int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs);
116 void do_notify_resume(int canrestart, sigset_t *oldset, struct pt_regs *regs,
117 __u32 thread_info_flags )
119 /* deal with pending signal delivery */
120 if (thread_info_flags & _TIF_SIGPENDING)
121 do_signal(canrestart,oldset,regs);