This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / asm-powerpc / tracehook.h
1 /*
2  * Tracing hooks, PowerPC CPU support
3  */
4
5 #ifndef _ASM_TRACEHOOK_H
6 #define _ASM_TRACEHOOK_H        1
7
8 #include <linux/sched.h>
9 #include <asm/ptrace.h>
10
11 /*
12  * See linux/tracehook.h for the descriptions of what these need to do.
13  */
14
15 #define ARCH_HAS_SINGLE_STEP    (1)
16
17 static inline void tracehook_enable_single_step(struct task_struct *task)
18 {
19         struct pt_regs *regs = task->thread.regs;
20         if (regs != NULL) {
21 #if defined(CONFIG_PPC32) && (defined(CONFIG_40x) || defined(CONFIG_BOOKE))
22                 task->thread.dbcr0 = DBCR0_IDM | DBCR0_IC;
23                 regs->msr |= MSR_DE;
24 #else
25                 regs->msr |= MSR_SE;
26 #endif
27         }
28         set_tsk_thread_flag(task, TIF_SINGLESTEP);
29 }
30
31 static inline void tracehook_disable_single_step(struct task_struct *task)
32 {
33         struct pt_regs *regs = task->thread.regs;
34         if (regs != NULL) {
35 #if defined(CONFIG_PPC32) && (defined(CONFIG_40x) || defined(CONFIG_BOOKE))
36                 task->thread.dbcr0 = 0;
37                 regs->msr &= ~MSR_DE;
38 #else
39                 regs->msr &= ~MSR_SE;
40 #endif
41         }
42         clear_tsk_thread_flag(task, TIF_SINGLESTEP);
43 }
44
45 static inline int tracehook_single_step_enabled(struct task_struct *tsk)
46 {
47         return test_tsk_thread_flag(tsk, TIF_SINGLESTEP);
48 }
49
50 static inline void tracehook_enable_syscall_trace(struct task_struct *tsk)
51 {
52         set_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
53 }
54
55 static inline void tracehook_disable_syscall_trace(struct task_struct *tsk)
56 {
57         clear_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
58 }
59
60 static inline void tracehook_abort_syscall(struct pt_regs *regs)
61 {
62         regs->orig_gpr3 = -1L;
63 }
64
65
66 extern const struct utrace_regset_view utrace_ppc_native_view;
67 static inline const struct utrace_regset_view *
68 utrace_native_view(struct task_struct *tsk)
69 {
70 #ifdef CONFIG_PPC64
71         extern const struct utrace_regset_view utrace_ppc32_view;
72
73         if (test_tsk_thread_flag(tsk, TIF_32BIT))
74                 return &utrace_ppc32_view;
75 #endif
76         return &utrace_ppc_native_view;
77 }
78
79
80 #endif