]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/powerpc/kernel/ptrace-ppc64.h
[POWERPC] Allow ptrace write to pt_regs trap and orig_r3
[mirror_ubuntu-artful-kernel.git] / arch / powerpc / kernel / ptrace-ppc64.h
CommitLineData
acd89828
BH
1/*
2 * Copyright (c) 2002 Stephen Rothwell, IBM Coproration
3 * Extracted from ptrace.c and ptrace32.c
4 *
5 * This file is subject to the terms and conditions of the GNU General
6 * Public License. See the file README.legal in the main directory of
7 * this archive for more details.
8 */
9
10#ifndef _POWERPC_PTRACE_PPC64_H
11#define _POWERPC_PTRACE_PPC64_H
12
13/*
14 * Set of msr bits that gdb can change on behalf of a process.
15 */
16#define MSR_DEBUGCHANGE (MSR_FE0 | MSR_SE | MSR_BE | MSR_FE1)
17
18/*
19 * Max register writeable via put_reg
20 */
21#define PT_MAX_PUT_REG PT_CCR
22
23/*
24 * Munging of MSR on return from get_regs
25 *
26 * Put the correct FP bits in, they might be wrong as a result
27 * of our lazy FP restore.
28 */
29
30#define PT_MUNGE_MSR(msr, task) ({ (msr) | (task)->thread.fpexc_mode; })
31
32static inline int ptrace_set_debugreg(struct task_struct *task,
33 unsigned long addr, unsigned long data)
34{
35 /* We only support one DABR and no IABRS at the moment */
36 if (addr > 0)
37 return -EINVAL;
38
39 /* The bottom 3 bits are flags */
40 if ((data & ~0x7UL) >= TASK_SIZE)
41 return -EIO;
42
43 /* Ensure translation is on */
44 if (data && !(data & DABR_TRANSLATION))
45 return -EIO;
46
47 task->thread.dabr = data;
48 return 0;
49}
50
51#endif /* _POWERPC_PTRACE_PPC64_H */