fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / asm-ia64 / tracehook.h
1 /*
2  * Copyright (C)2006 Intel Co
3  *      Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
4  *      and Bibo Mao <bibo.mao@intel.com> adapted from i386.
5  *
6  *      Tracing hooks, ia64 CPU support
7  */
8
9 #ifndef _ASM_TRACEHOOK_H
10 #define _ASM_TRACEHOOK_H        1
11
12 #include <linux/sched.h>
13 #include <asm/ptrace.h>
14
15 /*
16  * See linux/tracehook.h for the descriptions of what these need to do.
17  */
18
19 #define ARCH_HAS_SINGLE_STEP    (1)
20 #define ARCH_HAS_BLOCK_STEP     (1)
21
22 static inline void tracehook_enable_single_step(struct task_struct *tsk)
23 {
24         struct pt_regs *pt = task_pt_regs(tsk);
25         ia64_psr(pt)->ss = 1;
26         set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
27 }
28
29 static inline void tracehook_disable_single_step(struct task_struct *tsk)
30 {
31         struct pt_regs *pt = task_pt_regs(tsk);
32         ia64_psr(pt)->ss = 0;
33         if (ia64_psr(pt)->tb == 0)
34                 clear_tsk_thread_flag(tsk, TIF_SINGLESTEP);
35 }
36
37 static inline void tracehook_enable_block_step(struct task_struct *tsk)
38 {
39         struct pt_regs *pt = task_pt_regs(tsk);
40         ia64_psr(pt)->tb = 1;
41         set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
42 }
43
44 static inline void tracehook_disable_block_step(struct task_struct *tsk)
45 {
46         struct pt_regs *pt = task_pt_regs(tsk);
47         ia64_psr(pt)->tb = 0;
48         if (ia64_psr(pt)->ss == 0)
49                 clear_tsk_thread_flag(tsk, TIF_SINGLESTEP);
50 }
51
52 static inline void tracehook_enable_syscall_trace(struct task_struct *tsk)
53 {
54         set_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
55 }
56
57 static inline void tracehook_disable_syscall_trace(struct task_struct *tsk)
58 {
59         clear_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
60 }
61
62 static inline int tracehook_single_step_enabled(struct task_struct *tsk)
63 {
64         struct pt_regs *pt = task_pt_regs(tsk);
65         return ia64_psr(pt)->ss;
66 }
67
68 static inline void tracehook_abort_syscall(struct pt_regs *regs)
69 {
70         if (IS_IA32_PROCESS(regs))
71                 regs->r1 = -1UL;
72         else
73                 regs->r15 = -1UL;
74 }
75
76 extern const struct utrace_regset_view utrace_ia64_native;
77 static inline const struct utrace_regset_view *
78 utrace_native_view(struct task_struct *tsk)
79 {
80 #ifdef CONFIG_IA32_SUPPORT
81         extern const struct utrace_regset_view utrace_ia32_view;
82         if (IS_IA32_PROCESS(task_pt_regs(tsk)))
83                 return &utrace_ia32_view;
84 #endif
85         return &utrace_ia64_native;
86 }
87
88
89 #endif  /* asm/tracehook.h */