2005-04-16 18:20:36 -04:00
|
|
|
#ifndef __ASM_SH_PTRACE_H
|
|
|
|
#define __ASM_SH_PTRACE_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 1999, 2000 Niibe Yutaka
|
|
|
|
*
|
|
|
|
*/
|
2008-07-25 04:47:34 -04:00
|
|
|
#if defined(__SH5__)
|
2007-11-09 02:57:27 -05:00
|
|
|
struct pt_regs {
|
|
|
|
unsigned long long pc;
|
|
|
|
unsigned long long sr;
|
2009-04-27 04:05:38 -04:00
|
|
|
long long syscall_nr;
|
2007-11-09 02:57:27 -05:00
|
|
|
unsigned long long regs[63];
|
|
|
|
unsigned long long tregs[8];
|
|
|
|
unsigned long long pad[2];
|
|
|
|
};
|
|
|
|
#else
|
2005-04-16 18:20:36 -04:00
|
|
|
/*
|
|
|
|
* GCC defines register number like this:
|
|
|
|
* -----------------------------
|
|
|
|
* 0 - 15 are integer registers
|
|
|
|
* 17 - 22 are control/special registers
|
|
|
|
* 24 - 39 fp registers
|
|
|
|
* 40 - 47 xd registers
|
|
|
|
* 48 - fpscr register
|
|
|
|
* -----------------------------
|
|
|
|
*
|
|
|
|
* We follows above, except:
|
|
|
|
* 16 --- program counter (PC)
|
|
|
|
* 22 --- syscall #
|
|
|
|
* 23 --- floating point communication register
|
|
|
|
*/
|
|
|
|
#define REG_REG0 0
|
|
|
|
#define REG_REG15 15
|
|
|
|
|
|
|
|
#define REG_PC 16
|
|
|
|
|
|
|
|
#define REG_PR 17
|
|
|
|
#define REG_SR 18
|
2007-11-09 02:57:27 -05:00
|
|
|
#define REG_GBR 19
|
2005-04-16 18:20:36 -04:00
|
|
|
#define REG_MACH 20
|
|
|
|
#define REG_MACL 21
|
|
|
|
|
|
|
|
#define REG_SYSCALL 22
|
|
|
|
|
|
|
|
#define REG_FPREG0 23
|
|
|
|
#define REG_FPREG15 38
|
|
|
|
#define REG_XFREG0 39
|
|
|
|
#define REG_XFREG15 54
|
|
|
|
|
|
|
|
#define REG_FPSCR 55
|
|
|
|
#define REG_FPUL 56
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This struct defines the way the registers are stored on the
|
|
|
|
* kernel stack during a system call or other kernel entry.
|
|
|
|
*/
|
|
|
|
struct pt_regs {
|
|
|
|
unsigned long regs[16];
|
|
|
|
unsigned long pc;
|
|
|
|
unsigned long pr;
|
|
|
|
unsigned long sr;
|
|
|
|
unsigned long gbr;
|
|
|
|
unsigned long mach;
|
|
|
|
unsigned long macl;
|
|
|
|
long tra;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This struct defines the way the DSP registers are stored on the
|
|
|
|
* kernel stack during a system call or other kernel entry.
|
|
|
|
*/
|
|
|
|
struct pt_dspregs {
|
|
|
|
unsigned long a1;
|
|
|
|
unsigned long a0g;
|
|
|
|
unsigned long a1g;
|
|
|
|
unsigned long m0;
|
|
|
|
unsigned long m1;
|
|
|
|
unsigned long a0;
|
|
|
|
unsigned long x0;
|
|
|
|
unsigned long x1;
|
|
|
|
unsigned long y0;
|
|
|
|
unsigned long y1;
|
|
|
|
unsigned long dsr;
|
|
|
|
unsigned long rs;
|
|
|
|
unsigned long re;
|
|
|
|
unsigned long mod;
|
|
|
|
};
|
2008-12-10 06:14:15 -05:00
|
|
|
#endif
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2008-09-12 06:52:36 -04:00
|
|
|
#define PTRACE_GETREGS 12 /* General registers */
|
|
|
|
#define PTRACE_SETREGS 13
|
|
|
|
|
|
|
|
#define PTRACE_GETFPREGS 14 /* FPU registers */
|
|
|
|
#define PTRACE_SETFPREGS 15
|
|
|
|
|
2008-05-19 00:40:12 -04:00
|
|
|
#define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */
|
|
|
|
|
|
|
|
#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */
|
|
|
|
#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */
|
|
|
|
|
2008-09-12 06:52:36 -04:00
|
|
|
#define PTRACE_GETDSPREGS 55 /* DSP registers */
|
2005-04-16 18:20:36 -04:00
|
|
|
#define PTRACE_SETDSPREGS 56
|
|
|
|
|
2010-02-12 01:40:00 -05:00
|
|
|
#define PT_TEXT_END_ADDR 240
|
|
|
|
#define PT_TEXT_ADDR 244 /* &(struct user)->start_code */
|
|
|
|
#define PT_DATA_ADDR 248 /* &(struct user)->start_data */
|
2009-05-08 10:48:15 -04:00
|
|
|
#define PT_TEXT_LEN 252
|
|
|
|
|
2005-04-16 18:20:36 -04:00
|
|
|
#ifdef __KERNEL__
|
2007-11-09 02:57:27 -05:00
|
|
|
#include <asm/addrspace.h>
|
2010-02-12 01:40:00 -05:00
|
|
|
#include <asm/page.h>
|
|
|
|
#include <asm/system.h>
|
2007-11-09 02:57:27 -05:00
|
|
|
|
|
|
|
#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
|
2007-11-20 04:08:06 -05:00
|
|
|
#define instruction_pointer(regs) ((unsigned long)(regs)->pc)
|
2007-11-09 02:57:27 -05:00
|
|
|
|
2005-04-16 18:20:36 -04:00
|
|
|
extern void show_regs(struct pt_regs *);
|
|
|
|
|
2008-07-30 06:09:31 -04:00
|
|
|
/*
|
|
|
|
* These are defined as per linux/ptrace.h.
|
|
|
|
*/
|
|
|
|
struct task_struct;
|
|
|
|
|
|
|
|
#define arch_has_single_step() (1)
|
|
|
|
|
2009-12-28 03:53:47 -05:00
|
|
|
struct perf_event;
|
|
|
|
struct perf_sample_data;
|
|
|
|
|
|
|
|
extern void ptrace_triggered(struct perf_event *bp, int nmi,
|
|
|
|
struct perf_sample_data *data, struct pt_regs *regs);
|
|
|
|
|
2006-01-12 04:05:44 -05:00
|
|
|
#define task_pt_regs(task) \
|
2009-02-23 02:16:34 -05:00
|
|
|
((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE) - 1)
|
2006-01-12 04:05:44 -05:00
|
|
|
|
2005-04-16 18:20:36 -04:00
|
|
|
static inline unsigned long profile_pc(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
unsigned long pc = instruction_pointer(regs);
|
|
|
|
|
2010-02-17 02:28:00 -05:00
|
|
|
if (virt_addr_uncached(pc))
|
|
|
|
return CAC_ADDR(pc);
|
2007-11-09 02:57:27 -05:00
|
|
|
|
2005-04-16 18:20:36 -04:00
|
|
|
return pc;
|
|
|
|
}
|
2007-11-09 02:57:27 -05:00
|
|
|
#endif /* __KERNEL__ */
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
#endif /* __ASM_SH_PTRACE_H */
|