1 /*
2  * Copyright (C) 2006 Atmark Techno, Inc.
3  *
4  * This file is subject to the terms and conditions of the GNU General Public
5  * License. See the file "COPYING" in the main directory of this archive
6  * for more details.
7  */
8 
9 #ifndef _ASM_MICROBLAZE_PTRACE_H
10 #define _ASM_MICROBLAZE_PTRACE_H
11 
12 #ifndef __ASSEMBLY__
13 
14 typedef unsigned long microblaze_reg_t;
15 
16 struct pt_regs {
17 	microblaze_reg_t r0;
18 	microblaze_reg_t r1;
19 	microblaze_reg_t r2;
20 	microblaze_reg_t r3;
21 	microblaze_reg_t r4;
22 	microblaze_reg_t r5;
23 	microblaze_reg_t r6;
24 	microblaze_reg_t r7;
25 	microblaze_reg_t r8;
26 	microblaze_reg_t r9;
27 	microblaze_reg_t r10;
28 	microblaze_reg_t r11;
29 	microblaze_reg_t r12;
30 	microblaze_reg_t r13;
31 	microblaze_reg_t r14;
32 	microblaze_reg_t r15;
33 	microblaze_reg_t r16;
34 	microblaze_reg_t r17;
35 	microblaze_reg_t r18;
36 	microblaze_reg_t r19;
37 	microblaze_reg_t r20;
38 	microblaze_reg_t r21;
39 	microblaze_reg_t r22;
40 	microblaze_reg_t r23;
41 	microblaze_reg_t r24;
42 	microblaze_reg_t r25;
43 	microblaze_reg_t r26;
44 	microblaze_reg_t r27;
45 	microblaze_reg_t r28;
46 	microblaze_reg_t r29;
47 	microblaze_reg_t r30;
48 	microblaze_reg_t r31;
49 	microblaze_reg_t pc;
50 	microblaze_reg_t msr;
51 	microblaze_reg_t ear;
52 	microblaze_reg_t esr;
53 	microblaze_reg_t fsr;
54 	int pt_mode;
55 };
56 
57 #ifdef __KERNEL__
58 #define kernel_mode(regs)		((regs)->pt_mode)
59 #define user_mode(regs)			(!kernel_mode(regs))
60 
61 #define instruction_pointer(regs)	((regs)->pc)
62 #define profile_pc(regs)		instruction_pointer(regs)
63 
64 void show_regs(struct pt_regs *);
65 
66 #else /* __KERNEL__ */
67 
68 /* pt_regs offsets used by gdbserver etc in ptrace syscalls */
69 #define PT_GPR(n)	((n) * sizeof(microblaze_reg_t))
70 #define PT_PC		(32 * sizeof(microblaze_reg_t))
71 #define PT_MSR		(33 * sizeof(microblaze_reg_t))
72 #define PT_EAR		(34 * sizeof(microblaze_reg_t))
73 #define PT_ESR		(35 * sizeof(microblaze_reg_t))
74 #define PT_FSR		(36 * sizeof(microblaze_reg_t))
75 #define PT_KERNEL_MODE	(37 * sizeof(microblaze_reg_t))
76 
77 #endif /* __KERNEL */
78 
79 #endif /* __ASSEMBLY__ */
80 
81 #endif /* _ASM_MICROBLAZE_PTRACE_H */
82