Skip to content

Commit 64e2a42

Browse files
committed
parisc: Add ARCH_TRACEHOOK and regset support
By adding TRACEHOOK support we now get a clean user interface to access registers via PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS and PTRACE_SETFPREGS. The user-visible regset struct user_regs_struct and user_fp_struct are modelled similiar to x86 and can be accessed via PTRACE_GETREGSET. Signed-off-by: Helge Deller <deller@gmx.de>
1 parent d2ad824 commit 64e2a42

File tree

4 files changed

+410
-3
lines changed

4 files changed

+410
-3
lines changed

arch/parisc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ config PARISC
3232
select HAVE_DEBUG_STACKOVERFLOW
3333
select HAVE_ARCH_AUDITSYSCALL
3434
select HAVE_ARCH_SECCOMP_FILTER
35+
select HAVE_ARCH_TRACEHOOK
3536
select ARCH_NO_COHERENT_DMA_MMAP
3637
select CPU_NO_EFFICIENT_FFS
3738

arch/parisc/include/uapi/asm/ptrace.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
* N.B. gdb/strace care about the size and offsets within this
1414
* structure. If you change things, you may break object compatibility
1515
* for those applications.
16+
*
17+
* Please do NOT use this structure for future programs, but use
18+
* user_regs_struct (see below) instead.
19+
*
20+
* It can be accessed through PTRACE_PEEKUSR/PTRACE_POKEUSR only.
1621
*/
1722

1823
struct pt_regs {
@@ -33,6 +38,45 @@ struct pt_regs {
3338
unsigned long ipsw; /* CR22 */
3439
};
3540

41+
/**
42+
* struct user_regs_struct - User general purpose registers
43+
*
44+
* This is the user-visible general purpose register state structure
45+
* which is used to define the elf_gregset_t.
46+
*
47+
* It can be accessed through PTRACE_GETREGSET with NT_PRSTATUS
48+
* and through PTRACE_GETREGS.
49+
*/
50+
struct user_regs_struct {
51+
unsigned long gr[32]; /* PSW is in gr[0] */
52+
unsigned long sr[8];
53+
unsigned long iaoq[2];
54+
unsigned long iasq[2];
55+
unsigned long sar; /* CR11 */
56+
unsigned long iir; /* CR19 */
57+
unsigned long isr; /* CR20 */
58+
unsigned long ior; /* CR21 */
59+
unsigned long ipsw; /* CR22 */
60+
unsigned long cr0;
61+
unsigned long cr24, cr25, cr26, cr27, cr28, cr29, cr30, cr31;
62+
unsigned long cr8, cr9, cr12, cr13, cr10, cr15;
63+
unsigned long _pad[80-64]; /* pad to ELF_NGREG (80) */
64+
};
65+
66+
/**
67+
* struct user_fp_struct - User floating point registers
68+
*
69+
* This is the user-visible floating point register state structure.
70+
* It uses the same layout and size as elf_fpregset_t.
71+
*
72+
* It can be accessed through PTRACE_GETREGSET with NT_PRFPREG
73+
* and through PTRACE_GETFPREGS.
74+
*/
75+
struct user_fp_struct {
76+
__u64 fr[32];
77+
};
78+
79+
3680
/*
3781
* The numbers chosen here are somewhat arbitrary but absolutely MUST
3882
* not overlap with any of the number assigned in <linux/ptrace.h>.
@@ -43,5 +87,9 @@ struct pt_regs {
4387
*/
4488
#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */
4589

90+
#define PTRACE_GETREGS 18
91+
#define PTRACE_SETREGS 19
92+
#define PTRACE_GETFPREGS 14
93+
#define PTRACE_SETFPREGS 15
4694

4795
#endif /* _UAPI_PARISC_PTRACE_H */

0 commit comments

Comments
 (0)