Vineet Gupta | 3be80aa | 2013-01-18 15:12:17 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | * |
| 8 | * Amit Bhor, Sameer Dhavale: Codito Technologies 2004 |
| 9 | */ |
| 10 | |
| 11 | #ifndef __ASM_ARC_PTRACE_H |
| 12 | #define __ASM_ARC_PTRACE_H |
| 13 | |
| 14 | #ifdef __KERNEL__ |
| 15 | |
| 16 | #ifndef __ASSEMBLY__ |
| 17 | |
| 18 | /* THE pt_regs: Defines how regs are saved during entry into kernel */ |
| 19 | |
| 20 | struct pt_regs { |
| 21 | /* |
| 22 | * 1 word gutter after reg-file has been saved |
| 23 | * Technically not needed, Since SP always points to a "full" location |
| 24 | * (vs. "empty"). But pt_regs is shared with tools.... |
| 25 | */ |
| 26 | long res; |
| 27 | |
| 28 | /* Real registers */ |
| 29 | long bta; /* bta_l1, bta_l2, erbta */ |
| 30 | long lp_start; |
| 31 | long lp_end; |
| 32 | long lp_count; |
| 33 | long status32; /* status32_l1, status32_l2, erstatus */ |
| 34 | long ret; /* ilink1, ilink2 or eret */ |
| 35 | long blink; |
| 36 | long fp; |
| 37 | long r26; /* gp */ |
| 38 | long r12; |
| 39 | long r11; |
| 40 | long r10; |
| 41 | long r9; |
| 42 | long r8; |
| 43 | long r7; |
| 44 | long r6; |
| 45 | long r5; |
| 46 | long r4; |
| 47 | long r3; |
| 48 | long r2; |
| 49 | long r1; |
| 50 | long r0; |
| 51 | long sp; /* user/kernel sp depending on where we came from */ |
| 52 | long orig_r0; |
| 53 | long orig_r8; /*to distinguish bet excp, sys call, int1 or int2 */ |
| 54 | }; |
| 55 | |
| 56 | /* Callee saved registers - need to be saved only when you are scheduled out */ |
| 57 | |
| 58 | struct callee_regs { |
| 59 | long res; /* Again this is not needed */ |
| 60 | long r25; |
| 61 | long r24; |
| 62 | long r23; |
| 63 | long r22; |
| 64 | long r21; |
| 65 | long r20; |
| 66 | long r19; |
| 67 | long r18; |
| 68 | long r17; |
| 69 | long r16; |
| 70 | long r15; |
| 71 | long r14; |
| 72 | long r13; |
| 73 | }; |
| 74 | |
| 75 | #define instruction_pointer(regs) ((regs)->ret) |
| 76 | #define profile_pc(regs) instruction_pointer(regs) |
| 77 | |
| 78 | /* return 1 if user mode or 0 if kernel mode */ |
| 79 | #define user_mode(regs) (regs->status32 & STATUS_U_MASK) |
| 80 | |
| 81 | #define user_stack_pointer(regs)\ |
| 82 | ({ unsigned int sp; \ |
| 83 | if (user_mode(regs)) \ |
| 84 | sp = (regs)->sp;\ |
| 85 | else \ |
| 86 | sp = -1; \ |
| 87 | sp; \ |
| 88 | }) |
| 89 | #endif /* !__ASSEMBLY__ */ |
| 90 | |
| 91 | #endif /* __KERNEL__ */ |
| 92 | |
| 93 | #ifndef __ASSEMBLY__ |
| 94 | /* |
| 95 | * Userspace ABI: Register state needed by |
| 96 | * -ptrace (gdbserver) |
| 97 | * -sigcontext (SA_SIGNINFO signal frame) |
| 98 | * |
| 99 | * This is to decouple pt_regs from user-space ABI, to be able to change it |
| 100 | * w/o affecting the ABI. |
| 101 | * Although the layout (initial padding) is similar to pt_regs to have some |
| 102 | * optimizations when copying pt_regs to/from user_regs_struct. |
| 103 | * |
| 104 | * Also, sigcontext only care about the scratch regs as that is what we really |
| 105 | * save/restore for signal handling. |
| 106 | */ |
| 107 | struct user_regs_struct { |
| 108 | |
| 109 | struct scratch { |
| 110 | long pad; |
| 111 | long bta, lp_start, lp_end, lp_count; |
| 112 | long status32, ret, blink, fp, gp; |
| 113 | long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0; |
| 114 | long sp; |
| 115 | } scratch; |
| 116 | struct callee { |
| 117 | long pad; |
| 118 | long r25, r24, r23, r22, r21, r20; |
| 119 | long r19, r18, r17, r16, r15, r14, r13; |
| 120 | } callee; |
| 121 | long efa; /* break pt addr, for break points in delay slots */ |
| 122 | long stop_pc; /* give dbg stop_pc directly after checking orig_r8 */ |
| 123 | }; |
| 124 | #endif /* !__ASSEMBLY__ */ |
| 125 | |
| 126 | #endif /* __ASM_PTRACE_H */ |