Michal Simek | 2b43845 | 2009-03-27 14:25:27 +0100 | [diff] [blame] | 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__ |
Michal Simek | 2b43845 | 2009-03-27 14:25:27 +0100 | [diff] [blame] | 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; |
Michal Simek | ac3efab | 2009-04-16 10:58:47 +0200 | [diff] [blame] | 54 | int pt_mode; |
Michal Simek | 2b43845 | 2009-03-27 14:25:27 +0100 | [diff] [blame] | 55 | }; |
| 56 | |
Michal Simek | 90974cb | 2009-12-28 14:25:15 +0100 | [diff] [blame] | 57 | #ifdef __KERNEL__ |
Michal Simek | ac3efab | 2009-04-16 10:58:47 +0200 | [diff] [blame] | 58 | #define kernel_mode(regs) ((regs)->pt_mode) |
Michal Simek | 2b43845 | 2009-03-27 14:25:27 +0100 | [diff] [blame] | 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 | |
Eric Paris | d7e7528 | 2012-01-03 14:23:06 -0500 | [diff] [blame] | 64 | static inline long regs_return_value(struct pt_regs *regs) |
| 65 | { |
| 66 | return regs->r3; |
| 67 | } |
| 68 | |
Michal Simek | 90974cb | 2009-12-28 14:25:15 +0100 | [diff] [blame] | 69 | #else /* __KERNEL__ */ |
| 70 | |
| 71 | /* pt_regs offsets used by gdbserver etc in ptrace syscalls */ |
Michal Simek | 702d542 | 2011-02-08 14:55:09 +0100 | [diff] [blame] | 72 | #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 Simek | 90974cb | 2009-12-28 14:25:15 +0100 | [diff] [blame] | 79 | |
| 80 | #endif /* __KERNEL */ |
| 81 | |
Michal Simek | 2b43845 | 2009-03-27 14:25:27 +0100 | [diff] [blame] | 82 | #endif /* __ASSEMBLY__ */ |
| 83 | |
| 84 | #endif /* _ASM_MICROBLAZE_PTRACE_H */ |