| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __ASM_SH_PTRACE_H | 
 | 2 | #define __ASM_SH_PTRACE_H | 
 | 3 |  | 
 | 4 | #include <asm/ubc.h> | 
 | 5 |  | 
 | 6 | /* | 
 | 7 |  * Copyright (C) 1999, 2000  Niibe Yutaka | 
 | 8 |  * | 
 | 9 |  */ | 
 | 10 |  | 
 | 11 | /* | 
 | 12 |  * GCC defines register number like this: | 
 | 13 |  * ----------------------------- | 
 | 14 |  *	 0 - 15 are integer registers | 
 | 15 |  *	17 - 22 are control/special registers | 
 | 16 |  *	24 - 39 fp registers | 
 | 17 |  *	40 - 47 xd registers | 
 | 18 |  *	48 -    fpscr register | 
 | 19 |  * ----------------------------- | 
 | 20 |  * | 
 | 21 |  * We follows above, except: | 
 | 22 |  *	16 --- program counter (PC) | 
 | 23 |  *	22 --- syscall # | 
 | 24 |  *	23 --- floating point communication register | 
 | 25 |  */ | 
 | 26 | #define REG_REG0	 0 | 
 | 27 | #define REG_REG15	15 | 
 | 28 |  | 
 | 29 | #define REG_PC		16 | 
 | 30 |  | 
 | 31 | #define REG_PR		17 | 
 | 32 | #define REG_SR		18 | 
 | 33 | #define REG_GBR      	19 | 
 | 34 | #define REG_MACH	20 | 
 | 35 | #define REG_MACL	21 | 
 | 36 |  | 
 | 37 | #define REG_SYSCALL	22 | 
 | 38 |  | 
 | 39 | #define REG_FPREG0	23 | 
 | 40 | #define REG_FPREG15	38 | 
 | 41 | #define REG_XFREG0	39 | 
 | 42 | #define REG_XFREG15	54 | 
 | 43 |  | 
 | 44 | #define REG_FPSCR	55 | 
 | 45 | #define REG_FPUL	56 | 
 | 46 |  | 
 | 47 | /* options set using PTRACE_SETOPTIONS */ | 
 | 48 | #define PTRACE_O_TRACESYSGOOD     0x00000001 | 
 | 49 |  | 
 | 50 | /* | 
 | 51 |  * This struct defines the way the registers are stored on the | 
 | 52 |  * kernel stack during a system call or other kernel entry. | 
 | 53 |  */ | 
 | 54 | struct pt_regs { | 
 | 55 | 	unsigned long regs[16]; | 
 | 56 | 	unsigned long pc; | 
 | 57 | 	unsigned long pr; | 
 | 58 | 	unsigned long sr; | 
 | 59 | 	unsigned long gbr; | 
 | 60 | 	unsigned long mach; | 
 | 61 | 	unsigned long macl; | 
 | 62 | 	long tra; | 
 | 63 | }; | 
 | 64 |  | 
 | 65 | /* | 
 | 66 |  * This struct defines the way the DSP registers are stored on the | 
 | 67 |  * kernel stack during a system call or other kernel entry. | 
 | 68 |  */ | 
 | 69 | struct pt_dspregs { | 
 | 70 | 	unsigned long	a1; | 
 | 71 | 	unsigned long	a0g; | 
 | 72 | 	unsigned long	a1g; | 
 | 73 | 	unsigned long	m0; | 
 | 74 | 	unsigned long	m1; | 
 | 75 | 	unsigned long	a0; | 
 | 76 | 	unsigned long	x0; | 
 | 77 | 	unsigned long	x1; | 
 | 78 | 	unsigned long	y0; | 
 | 79 | 	unsigned long	y1; | 
 | 80 | 	unsigned long	dsr; | 
 | 81 | 	unsigned long	rs; | 
 | 82 | 	unsigned long	re; | 
 | 83 | 	unsigned long	mod; | 
 | 84 | }; | 
 | 85 |  | 
 | 86 | #define	PTRACE_GETDSPREGS	55 | 
 | 87 | #define	PTRACE_SETDSPREGS	56 | 
 | 88 |  | 
 | 89 | #ifdef __KERNEL__ | 
 | 90 | #define user_mode(regs) (((regs)->sr & 0x40000000)==0) | 
 | 91 | #define instruction_pointer(regs) ((regs)->pc) | 
 | 92 | extern void show_regs(struct pt_regs *); | 
 | 93 |  | 
| Al Viro | 3cf0f4e | 2006-01-12 01:05:44 -0800 | [diff] [blame] | 94 | #ifdef CONFIG_SH_DSP | 
 | 95 | #define task_pt_regs(task) \ | 
| Al Viro | 308a792 | 2006-01-12 01:05:45 -0800 | [diff] [blame] | 96 | 	((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \ | 
| Al Viro | 3cf0f4e | 2006-01-12 01:05:44 -0800 | [diff] [blame] | 97 | 		 - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1) | 
 | 98 | #else | 
 | 99 | #define task_pt_regs(task) \ | 
| Al Viro | 308a792 | 2006-01-12 01:05:45 -0800 | [diff] [blame] | 100 | 	((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \ | 
| Al Viro | 3cf0f4e | 2006-01-12 01:05:44 -0800 | [diff] [blame] | 101 | 		 - sizeof(unsigned long)) - 1) | 
 | 102 | #endif | 
 | 103 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | static inline unsigned long profile_pc(struct pt_regs *regs) | 
 | 105 | { | 
 | 106 | 	unsigned long pc = instruction_pointer(regs); | 
 | 107 |  | 
 | 108 | 	if (pc >= 0xa0000000UL && pc < 0xc0000000UL) | 
 | 109 | 		pc -= 0x20000000; | 
 | 110 | 	return pc; | 
 | 111 | } | 
 | 112 | #endif | 
 | 113 |  | 
 | 114 | #endif /* __ASM_SH_PTRACE_H */ |