aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64/ptrace-common.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-ppc64/ptrace-common.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-ppc64/ptrace-common.h')
-rw-r--r--include/asm-ppc64/ptrace-common.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/include/asm-ppc64/ptrace-common.h b/include/asm-ppc64/ptrace-common.h
new file mode 100644
index 000000000000..af03547f9c7e
--- /dev/null
+++ b/include/asm-ppc64/ptrace-common.h
@@ -0,0 +1,72 @@
1/*
2 * linux/arch/ppc64/kernel/ptrace-common.h
3 *
4 * Copyright (c) 2002 Stephen Rothwell, IBM Coproration
5 * Extracted from ptrace.c and ptrace32.c
6 *
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.
10 */
11
12#ifndef _PPC64_PTRACE_COMMON_H
13#define _PPC64_PTRACE_COMMON_H
14/*
15 * Set of msr bits that gdb can change on behalf of a process.
16 */
17#define MSR_DEBUGCHANGE (MSR_FE0 | MSR_SE | MSR_BE | MSR_FE1)
18
19/*
20 * Get contents of register REGNO in task TASK.
21 */
22static inline unsigned long get_reg(struct task_struct *task, int regno)
23{
24 unsigned long tmp = 0;
25
26 /*
27 * Put the correct FP bits in, they might be wrong as a result
28 * of our lazy FP restore.
29 */
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];
35 }
36
37 return tmp;
38}
39
40/*
41 * Write contents of register REGNO in task TASK.
42 */
43static inline int put_reg(struct task_struct *task, int regno,
44 unsigned long data)
45{
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;
52 }
53 return -EIO;
54}
55
56static inline void set_single_step(struct task_struct *task)
57{
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);
62}
63
64static inline void clear_single_step(struct task_struct *task)
65{
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);
70}
71
72#endif /* _PPC64_PTRACE_COMMON_H */