2 * Tracing hooks, PowerPC CPU support
4 * Copyright (C) 2006, 2007 Red Hat, Inc. All rights reserved.
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
10 * Red Hat Author: Roland McGrath.
13 #ifndef _ASM_TRACEHOOK_H
14 #define _ASM_TRACEHOOK_H 1
16 #include <linux/sched.h>
17 #include <asm/ptrace.h>
20 * See linux/tracehook.h for the descriptions of what these need to do.
23 #define ARCH_HAS_SINGLE_STEP (1)
25 static inline void tracehook_enable_single_step(struct task_struct *task)
27 struct pt_regs *regs = task->thread.regs;
29 #if defined(CONFIG_PPC32) && (defined(CONFIG_40x) || defined(CONFIG_BOOKE))
30 task->thread.dbcr0 = DBCR0_IDM | DBCR0_IC;
36 set_tsk_thread_flag(task, TIF_SINGLESTEP);
39 static inline void tracehook_disable_single_step(struct task_struct *task)
41 struct pt_regs *regs = task->thread.regs;
43 #if defined(CONFIG_PPC32) && (defined(CONFIG_40x) || defined(CONFIG_BOOKE))
44 task->thread.dbcr0 = 0;
50 clear_tsk_thread_flag(task, TIF_SINGLESTEP);
53 static inline int tracehook_single_step_enabled(struct task_struct *tsk)
55 return test_tsk_thread_flag(tsk, TIF_SINGLESTEP);
58 static inline void tracehook_enable_syscall_trace(struct task_struct *tsk)
60 set_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
63 static inline void tracehook_disable_syscall_trace(struct task_struct *tsk)
65 clear_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
68 static inline void tracehook_abort_syscall(struct pt_regs *regs)
70 regs->orig_gpr3 = -1L;
74 extern const struct utrace_regset_view utrace_ppc_native_view;
75 static inline const struct utrace_regset_view *
76 utrace_native_view(struct task_struct *tsk)
79 extern const struct utrace_regset_view utrace_ppc32_view;
81 if (test_tsk_thread_flag(tsk, TIF_32BIT))
82 return &utrace_ppc32_view;
84 return &utrace_ppc_native_view;