Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / asm-ppc64 / ptrace-common.h
blobaf03547f9c7edf4151afbbb3f29d5bbd89fddba6
1 /*
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];
37 return tmp;
41 * Write contents of register REGNO in task TASK.
43 static inline int put_reg(struct task_struct *task, int regno,
44 unsigned long data)
46 if (regno < PT_SOFTE) {
47 if (regno == PT_MSR)
48 data = (data & MSR_DEBUGCHANGE)
49 | (task->thread.regs->msr & ~MSR_DEBUGCHANGE);
50 ((unsigned long *)task->thread.regs)[regno] = data;
51 return 0;
53 return -EIO;
56 static inline void set_single_step(struct task_struct *task)
58 struct pt_regs *regs = task->thread.regs;
59 if (regs != NULL)
60 regs->msr |= MSR_SE;
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;
67 if (regs != NULL)
68 regs->msr &= ~MSR_SE;
69 clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP);
72 #endif /* _PPC64_PTRACE_COMMON_H */