ptrace.h 3.3 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7
#ifndef __ASM_SH_PTRACE_H
#define __ASM_SH_PTRACE_H

/*
 * Copyright (C) 1999, 2000  Niibe Yutaka
 *
 */
8
#if defined(__SH5__)
P
Paul Mundt 已提交
9 10 11 12 13 14 15 16 17
struct pt_regs {
	unsigned long long pc;
	unsigned long long sr;
	unsigned long long syscall_nr;
	unsigned long long regs[63];
	unsigned long long tregs[8];
	unsigned long long pad[2];
};
#else
L
Linus Torvalds 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
/*
 * 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
P
Paul Mundt 已提交
40
#define REG_GBR		19
L
Linus Torvalds 已提交
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
#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;
};
89
#endif
L
Linus Torvalds 已提交
90

91 92 93 94 95 96
#define PTRACE_GETREGS		12	/* General registers */
#define PTRACE_SETREGS		13

#define PTRACE_GETFPREGS	14	/* FPU registers */
#define PTRACE_SETFPREGS	15

P
Paul Mundt 已提交
97 98 99 100 101
#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 */

102
#define	PTRACE_GETDSPREGS	55	/* DSP registers */
L
Linus Torvalds 已提交
103 104 105
#define	PTRACE_SETDSPREGS	56

#ifdef __KERNEL__
P
Paul Mundt 已提交
106 107 108
#include <asm/addrspace.h>

#define user_mode(regs)			(((regs)->sr & 0x40000000)==0)
109
#define instruction_pointer(regs)	((unsigned long)(regs)->pc)
P
Paul Mundt 已提交
110

L
Linus Torvalds 已提交
111 112
extern void show_regs(struct pt_regs *);

113 114 115 116 117 118 119 120 121
/*
 * These are defined as per linux/ptrace.h.
 */
struct task_struct;

#define arch_has_single_step()	(1)
extern void user_enable_single_step(struct task_struct *);
extern void user_disable_single_step(struct task_struct *);

A
Al Viro 已提交
122 123
#ifdef CONFIG_SH_DSP
#define task_pt_regs(task) \
A
Al Viro 已提交
124
	((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
A
Al Viro 已提交
125
		 - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1)
126 127 128
#define task_pt_dspregs(task) \
	((struct pt_dspregs *) (task_stack_page(task) + THREAD_SIZE \
		 - sizeof(unsigned long)) - 1)
A
Al Viro 已提交
129 130
#else
#define task_pt_regs(task) \
A
Al Viro 已提交
131
	((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
A
Al Viro 已提交
132 133 134
		 - sizeof(unsigned long)) - 1)
#endif

L
Linus Torvalds 已提交
135 136 137 138
static inline unsigned long profile_pc(struct pt_regs *regs)
{
	unsigned long pc = instruction_pointer(regs);

P
Paul Mundt 已提交
139 140
#ifdef P2SEG
	if (pc >= P2SEG && pc < P3SEG)
L
Linus Torvalds 已提交
141
		pc -= 0x20000000;
P
Paul Mundt 已提交
142 143
#endif

L
Linus Torvalds 已提交
144 145
	return pc;
}
P
Paul Mundt 已提交
146
#endif /* __KERNEL__ */
L
Linus Torvalds 已提交
147 148

#endif /* __ASM_SH_PTRACE_H */