blob: 94e92c8058592f786cfd6fac942c90b308664e85 [file] [log] [blame]
Michal Simek2b438452009-03-27 14:25:27 +01001/*
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__
Michal Simek2b438452009-03-27 14:25:27 +010013
14typedef unsigned long microblaze_reg_t;
15
16struct 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;
Michal Simekac3efab2009-04-16 10:58:47 +020054 int pt_mode;
Michal Simek2b438452009-03-27 14:25:27 +010055};
56
Michal Simek90974cb2009-12-28 14:25:15 +010057#ifdef __KERNEL__
Michal Simekac3efab2009-04-16 10:58:47 +020058#define kernel_mode(regs) ((regs)->pt_mode)
Michal Simek2b438452009-03-27 14:25:27 +010059#define user_mode(regs) (!kernel_mode(regs))
60
61#define instruction_pointer(regs) ((regs)->pc)
62#define profile_pc(regs) instruction_pointer(regs)
63
Eric Parisd7e75282012-01-03 14:23:06 -050064static inline long regs_return_value(struct pt_regs *regs)
65{
66 return regs->r3;
67}
68
Michal Simek90974cb2009-12-28 14:25:15 +010069#else /* __KERNEL__ */
70
71/* pt_regs offsets used by gdbserver etc in ptrace syscalls */
Michal Simek702d5422011-02-08 14:55:09 +010072#define PT_GPR(n) ((n) * sizeof(microblaze_reg_t))
73#define PT_PC (32 * sizeof(microblaze_reg_t))
74#define PT_MSR (33 * sizeof(microblaze_reg_t))
75#define PT_EAR (34 * sizeof(microblaze_reg_t))
76#define PT_ESR (35 * sizeof(microblaze_reg_t))
77#define PT_FSR (36 * sizeof(microblaze_reg_t))
78#define PT_KERNEL_MODE (37 * sizeof(microblaze_reg_t))
Michal Simek90974cb2009-12-28 14:25:15 +010079
80#endif /* __KERNEL */
81
Michal Simek2b438452009-03-27 14:25:27 +010082#endif /* __ASSEMBLY__ */
83
84#endif /* _ASM_MICROBLAZE_PTRACE_H */