Commit 64e2a42b authored by Helge Deller's avatar Helge Deller

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: default avatarHelge Deller <deller@gmx.de>
parent d2ad824f
......@@ -32,6 +32,7 @@ config PARISC
select HAVE_DEBUG_STACKOVERFLOW
select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_TRACEHOOK
select ARCH_NO_COHERENT_DMA_MMAP
select CPU_NO_EFFICIENT_FFS
......
......@@ -13,6 +13,11 @@
* N.B. gdb/strace care about the size and offsets within this
* structure. If you change things, you may break object compatibility
* for those applications.
*
* Please do NOT use this structure for future programs, but use
* user_regs_struct (see below) instead.
*
* It can be accessed through PTRACE_PEEKUSR/PTRACE_POKEUSR only.
*/
struct pt_regs {
......@@ -33,6 +38,45 @@ struct pt_regs {
unsigned long ipsw; /* CR22 */
};
/**
* struct user_regs_struct - User general purpose registers
*
* This is the user-visible general purpose register state structure
* which is used to define the elf_gregset_t.
*
* It can be accessed through PTRACE_GETREGSET with NT_PRSTATUS
* and through PTRACE_GETREGS.
*/
struct user_regs_struct {
unsigned long gr[32]; /* PSW is in gr[0] */
unsigned long sr[8];
unsigned long iaoq[2];
unsigned long iasq[2];
unsigned long sar; /* CR11 */
unsigned long iir; /* CR19 */
unsigned long isr; /* CR20 */
unsigned long ior; /* CR21 */
unsigned long ipsw; /* CR22 */
unsigned long cr0;
unsigned long cr24, cr25, cr26, cr27, cr28, cr29, cr30, cr31;
unsigned long cr8, cr9, cr12, cr13, cr10, cr15;
unsigned long _pad[80-64]; /* pad to ELF_NGREG (80) */
};
/**
* struct user_fp_struct - User floating point registers
*
* This is the user-visible floating point register state structure.
* It uses the same layout and size as elf_fpregset_t.
*
* It can be accessed through PTRACE_GETREGSET with NT_PRFPREG
* and through PTRACE_GETFPREGS.
*/
struct user_fp_struct {
__u64 fr[32];
};
/*
* The numbers chosen here are somewhat arbitrary but absolutely MUST
* not overlap with any of the number assigned in <linux/ptrace.h>.
......@@ -43,5 +87,9 @@ struct pt_regs {
*/
#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */
#define PTRACE_GETREGS 18
#define PTRACE_SETREGS 19
#define PTRACE_GETFPREGS 14
#define PTRACE_SETFPREGS 15
#endif /* _UAPI_PARISC_PTRACE_H */
This diff is collapsed.
......@@ -1234,6 +1234,10 @@ TEST_F(TRACE_poke, getpid_runs_normally)
# define ARCH_REGS struct user_pt_regs
# define SYSCALL_NUM regs[8]
# define SYSCALL_RET regs[0]
#elif defined(__hppa__)
# define ARCH_REGS struct user_regs_struct
# define SYSCALL_NUM gr[20]
# define SYSCALL_RET gr[28]
#elif defined(__powerpc__)
# define ARCH_REGS struct pt_regs
# define SYSCALL_NUM gpr[0]
......@@ -1303,7 +1307,7 @@ void change_syscall(struct __test_metadata *_metadata,
EXPECT_EQ(0, ret);
#if defined(__x86_64__) || defined(__i386__) || defined(__powerpc__) || \
defined(__s390__)
defined(__s390__) || defined(__hppa__)
{
regs.SYSCALL_NUM = syscall;
}
......@@ -1505,6 +1509,8 @@ TEST_F(TRACE_syscall, syscall_dropped)
# define __NR_seccomp 383
# elif defined(__aarch64__)
# define __NR_seccomp 277
# elif defined(__hppa__)
# define __NR_seccomp 338
# elif defined(__powerpc__)
# define __NR_seccomp 358
# elif defined(__s390__)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment