diff options
Diffstat (limited to 'arch/cris/kernel/ptrace.c')
-rw-r--r-- | arch/cris/kernel/ptrace.c | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/arch/cris/kernel/ptrace.c b/arch/cris/kernel/ptrace.c new file mode 100644 index 000000000000..e85a2fdd9acf --- /dev/null +++ b/arch/cris/kernel/ptrace.c | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | * linux/arch/cris/kernel/ptrace.c | ||
3 | * | ||
4 | * Parts taken from the m68k port. | ||
5 | * | ||
6 | * Copyright (c) 2000, 2001, 2002 Axis Communications AB | ||
7 | * | ||
8 | * Authors: Bjorn Wesen | ||
9 | * | ||
10 | * $Log: ptrace.c,v $ | ||
11 | * Revision 1.9 2003/07/04 12:56:11 tobiasa | ||
12 | * Moved arch-specific code to arch-specific files. | ||
13 | * | ||
14 | * Revision 1.8 2003/04/09 05:20:47 starvik | ||
15 | * Merge of Linux 2.5.67 | ||
16 | * | ||
17 | * Revision 1.7 2002/11/27 08:42:34 starvik | ||
18 | * Argument to user_regs() is thread_info* | ||
19 | * | ||
20 | * Revision 1.6 2002/11/20 11:56:11 starvik | ||
21 | * Merge of Linux 2.5.48 | ||
22 | * | ||
23 | * Revision 1.5 2002/11/18 07:41:19 starvik | ||
24 | * Removed warning | ||
25 | * | ||
26 | * Revision 1.4 2002/11/11 12:47:28 starvik | ||
27 | * SYSCALL_TRACE has been moved to thread flags | ||
28 | * | ||
29 | * Revision 1.3 2002/02/05 15:37:18 bjornw | ||
30 | * * Add do_notify_resume (replaces do_signal in the callchain) | ||
31 | * * syscall_trace is now do_syscall_trace | ||
32 | * * current->ptrace flag PT_TRACESYS -> PT_SYSCALLTRACE | ||
33 | * * Keep track of the current->work.syscall_trace counter | ||
34 | * | ||
35 | * Revision 1.2 2001/12/18 13:35:20 bjornw | ||
36 | * Applied the 2.4.13->2.4.16 CRIS patch to 2.5.1 (is a copy of 2.4.15). | ||
37 | * | ||
38 | * Revision 1.8 2001/11/12 18:26:21 pkj | ||
39 | * Fixed compiler warnings. | ||
40 | * | ||
41 | * Revision 1.7 2001/09/26 11:53:49 bjornw | ||
42 | * PTRACE_DETACH works more simple in 2.4.10 | ||
43 | * | ||
44 | * Revision 1.6 2001/07/25 16:08:47 bjornw | ||
45 | * PTRACE_ATTACH bulk moved into arch-independent code in 2.4.7 | ||
46 | * | ||
47 | * Revision 1.5 2001/03/26 14:24:28 orjanf | ||
48 | * * Changed loop condition. | ||
49 | * * Added comment documenting non-standard ptrace behaviour. | ||
50 | * | ||
51 | * Revision 1.4 2001/03/20 19:44:41 bjornw | ||
52 | * Use the user_regs macro instead of thread.esp0 | ||
53 | * | ||
54 | * Revision 1.3 2000/12/18 23:45:25 bjornw | ||
55 | * Linux/CRIS first version | ||
56 | * | ||
57 | * | ||
58 | */ | ||
59 | |||
60 | #include <linux/kernel.h> | ||
61 | #include <linux/sched.h> | ||
62 | #include <linux/mm.h> | ||
63 | #include <linux/smp.h> | ||
64 | #include <linux/smp_lock.h> | ||
65 | #include <linux/errno.h> | ||
66 | #include <linux/ptrace.h> | ||
67 | #include <linux/user.h> | ||
68 | |||
69 | #include <asm/uaccess.h> | ||
70 | #include <asm/page.h> | ||
71 | #include <asm/pgtable.h> | ||
72 | #include <asm/system.h> | ||
73 | #include <asm/processor.h> | ||
74 | |||
75 | /* | ||
76 | * Get contents of register REGNO in task TASK. | ||
77 | */ | ||
78 | inline long get_reg(struct task_struct *task, unsigned int regno) | ||
79 | { | ||
80 | /* USP is a special case, it's not in the pt_regs struct but | ||
81 | * in the tasks thread struct | ||
82 | */ | ||
83 | |||
84 | if (regno == PT_USP) | ||
85 | return task->thread.usp; | ||
86 | else if (regno < PT_MAX) | ||
87 | return ((unsigned long *)user_regs(task->thread_info))[regno]; | ||
88 | else | ||
89 | return 0; | ||
90 | } | ||
91 | |||
92 | /* | ||
93 | * Write contents of register REGNO in task TASK. | ||
94 | */ | ||
95 | inline int put_reg(struct task_struct *task, unsigned int regno, | ||
96 | unsigned long data) | ||
97 | { | ||
98 | if (regno == PT_USP) | ||
99 | task->thread.usp = data; | ||
100 | else if (regno < PT_MAX) | ||
101 | ((unsigned long *)user_regs(task->thread_info))[regno] = data; | ||
102 | else | ||
103 | return -1; | ||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | /* notification of userspace execution resumption | ||
108 | * - triggered by current->work.notify_resume | ||
109 | */ | ||
110 | extern int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs); | ||
111 | |||
112 | |||
113 | void do_notify_resume(int canrestart, sigset_t *oldset, struct pt_regs *regs, | ||
114 | __u32 thread_info_flags ) | ||
115 | { | ||
116 | /* deal with pending signal delivery */ | ||
117 | if (thread_info_flags & _TIF_SIGPENDING) | ||
118 | do_signal(canrestart,oldset,regs); | ||
119 | } | ||