2 * linux/arch/ppc64/kernel/ptrace-common.h
4 * Copyright (c) 2002 Stephen Rothwell, IBM Coproration
5 * Extracted from ptrace.c and ptrace32.c
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file README.legal in the main directory of
9 * this archive for more details.
12 #ifndef _PPC64_PTRACE_COMMON_H
13 #define _PPC64_PTRACE_COMMON_H
15 * Set of msr bits that gdb can change on behalf of a process.
17 #define MSR_DEBUGCHANGE (MSR_FE0 | MSR_SE | MSR_BE | MSR_FE1)
20 * Get contents of register REGNO in task TASK.
22 static inline unsigned long get_reg(struct task_struct *task, int regno)
24 unsigned long tmp = 0;
27 * Put the correct FP bits in, they might be wrong as a result
28 * of our lazy FP restore.
30 if (regno == PT_MSR) {
31 tmp = ((unsigned long *)task->thread.regs)[PT_MSR];
32 tmp |= task->thread.fpexc_mode;
33 } else if (regno < (sizeof(struct pt_regs) / sizeof(unsigned long))) {
34 tmp = ((unsigned long *)task->thread.regs)[regno];
41 * Write contents of register REGNO in task TASK.
43 static inline int put_reg(struct task_struct *task, int regno,
46 if (regno < PT_SOFTE) {
48 data = (data & MSR_DEBUGCHANGE)
49 | (task->thread.regs->msr & ~MSR_DEBUGCHANGE);
50 ((unsigned long *)task->thread.regs)[regno] = data;
56 static inline void set_single_step(struct task_struct *task)
58 struct pt_regs *regs = task->thread.regs;
61 set_ti_thread_flag(task->thread_info, TIF_SINGLESTEP);
64 static inline void clear_single_step(struct task_struct *task)
66 struct pt_regs *regs = task->thread.regs;
69 clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP);
72 #endif /* _PPC64_PTRACE_COMMON_H */