| 1 | /* |
|---|
| 2 | * Copyright (c) 2011 Aeroflex Gaisler |
|---|
| 3 | * |
|---|
| 4 | * BSD license: |
|---|
| 5 | * |
|---|
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
|---|
| 7 | * of this software and associated documentation files (the "Software"), to deal |
|---|
| 8 | * in the Software without restriction, including without limitation the rights |
|---|
| 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|---|
| 10 | * copies of the Software, and to permit persons to whom the Software is |
|---|
| 11 | * furnished to do so, subject to the following conditions: |
|---|
| 12 | * |
|---|
| 13 | * The above copyright notice and this permission notice shall be included in |
|---|
| 14 | * all copies or substantial portions of the Software. |
|---|
| 15 | * |
|---|
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|---|
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|---|
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|---|
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|---|
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|---|
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|---|
| 22 | * THE SOFTWARE. |
|---|
| 23 | */ |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | #ifndef _INCLUDE_LEON_STACK_h |
|---|
| 27 | #define _INCLUDE_LEON_STACK_h |
|---|
| 28 | |
|---|
| 29 | #ifndef __ASSEMBLER__ |
|---|
| 30 | |
|---|
| 31 | #ifdef __cplusplus |
|---|
| 32 | extern "C" |
|---|
| 33 | { |
|---|
| 34 | #endif |
|---|
| 35 | |
|---|
| 36 | /* process trap regs */ |
|---|
| 37 | struct leonbare_pt_regs |
|---|
| 38 | { |
|---|
| 39 | unsigned long psr; |
|---|
| 40 | unsigned long pc; |
|---|
| 41 | unsigned long npc; |
|---|
| 42 | unsigned long y; |
|---|
| 43 | unsigned long u_regs[16]; /* globals and ins */ |
|---|
| 44 | }; |
|---|
| 45 | #define PT_REGS_SZ sizeof(struct leonbare_pt_regs) |
|---|
| 46 | |
|---|
| 47 | /* A Sparc stack frame */ |
|---|
| 48 | struct sparc_stackframe_regs |
|---|
| 49 | { |
|---|
| 50 | unsigned long sf_locals[8]; |
|---|
| 51 | unsigned long sf_ins[6]; |
|---|
| 52 | struct sparc_stackframe_regs *sf_fp; |
|---|
| 53 | unsigned long sf_callers_pc; |
|---|
| 54 | char *sf_structptr; |
|---|
| 55 | unsigned long sf_xargs[6]; |
|---|
| 56 | unsigned long sf_xxargs[1]; |
|---|
| 57 | }; |
|---|
| 58 | #define SF_REGS_SZ sizeof(struct sparc_stackframe_regs) |
|---|
| 59 | |
|---|
| 60 | /* A register window */ |
|---|
| 61 | struct sparc_regwindow_regs |
|---|
| 62 | { |
|---|
| 63 | unsigned long locals[8]; |
|---|
| 64 | unsigned long ins[8]; |
|---|
| 65 | }; |
|---|
| 66 | #define RW_REGS_SZ sizeof(struct sparc_regwindow_regs) |
|---|
| 67 | |
|---|
| 68 | /* A fpu window */ |
|---|
| 69 | struct sparc_fpuwindow_regs |
|---|
| 70 | { |
|---|
| 71 | unsigned long locals[32]; |
|---|
| 72 | unsigned long fsr; |
|---|
| 73 | unsigned long dummy; |
|---|
| 74 | unsigned long irqpsr; |
|---|
| 75 | unsigned long lastctx; |
|---|
| 76 | }; |
|---|
| 77 | #define FW_REGS_SZ sizeof(struct sparc_fpuwindow_regs) |
|---|
| 78 | |
|---|
| 79 | #ifdef __cplusplus |
|---|
| 80 | } |
|---|
| 81 | #endif |
|---|
| 82 | |
|---|
| 83 | #else |
|---|
| 84 | #define PT_REGS_SZ 0x50 /* 20*4 */ |
|---|
| 85 | #define SF_REGS_SZ 0x60 /* 24*4 */ |
|---|
| 86 | #define RW_REGS_SZ 0x20 /* 16*4 */ |
|---|
| 87 | #define FW_REGS_SZ 0x90 /* 36*4 */ |
|---|
| 88 | #endif /* !ASM */ |
|---|
| 89 | |
|---|
| 90 | /* These are for pt_regs. */ |
|---|
| 91 | #define PT_PSR 0x0 |
|---|
| 92 | #define PT_PC 0x4 |
|---|
| 93 | #define PT_NPC 0x8 |
|---|
| 94 | #define PT_Y 0xc |
|---|
| 95 | #define PT_G0 0x10 |
|---|
| 96 | #define PT_WIM PT_G0 |
|---|
| 97 | #define PT_G1 0x14 |
|---|
| 98 | #define PT_G2 0x18 |
|---|
| 99 | #define PT_G3 0x1c |
|---|
| 100 | #define PT_G4 0x20 |
|---|
| 101 | #define PT_G5 0x24 |
|---|
| 102 | #define PT_G6 0x28 |
|---|
| 103 | #define PT_G7 0x2c |
|---|
| 104 | #define PT_I0 0x30 |
|---|
| 105 | #define PT_I1 0x34 |
|---|
| 106 | #define PT_I2 0x38 |
|---|
| 107 | #define PT_I3 0x3c |
|---|
| 108 | #define PT_I4 0x40 |
|---|
| 109 | #define PT_I5 0x44 |
|---|
| 110 | #define PT_I6 0x48 |
|---|
| 111 | #define PT_FP PT_I6 |
|---|
| 112 | #define PT_I7 0x4c |
|---|
| 113 | |
|---|
| 114 | /* Stack_frame offsets */ |
|---|
| 115 | #define SF_L0 0x00 |
|---|
| 116 | #define SF_L1 0x04 |
|---|
| 117 | #define SF_L2 0x08 |
|---|
| 118 | #define SF_L3 0x0c |
|---|
| 119 | #define SF_L4 0x10 |
|---|
| 120 | #define SF_L5 0x14 |
|---|
| 121 | #define SF_L6 0x18 |
|---|
| 122 | #define SF_L7 0x1c |
|---|
| 123 | #define SF_I0 0x20 |
|---|
| 124 | #define SF_I1 0x24 |
|---|
| 125 | #define SF_I2 0x28 |
|---|
| 126 | #define SF_I3 0x2c |
|---|
| 127 | #define SF_I4 0x30 |
|---|
| 128 | #define SF_I5 0x34 |
|---|
| 129 | #define SF_FP 0x38 |
|---|
| 130 | #define SF_PC 0x3c |
|---|
| 131 | #define SF_RETP 0x40 |
|---|
| 132 | #define SF_XARG0 0x44 |
|---|
| 133 | #define SF_XARG1 0x48 |
|---|
| 134 | #define SF_XARG2 0x4c |
|---|
| 135 | #define SF_XARG3 0x50 |
|---|
| 136 | #define SF_XARG4 0x54 |
|---|
| 137 | #define SF_XARG5 0x58 |
|---|
| 138 | #define SF_XXARG 0x5c |
|---|
| 139 | |
|---|
| 140 | /* Reg_window offsets */ |
|---|
| 141 | #define RW_L0 0x00 |
|---|
| 142 | #define RW_L1 0x04 |
|---|
| 143 | #define RW_L2 0x08 |
|---|
| 144 | #define RW_L3 0x0c |
|---|
| 145 | #define RW_L4 0x10 |
|---|
| 146 | #define RW_L5 0x14 |
|---|
| 147 | #define RW_L6 0x18 |
|---|
| 148 | #define RW_L7 0x1c |
|---|
| 149 | #define RW_I0 0x20 |
|---|
| 150 | #define RW_I1 0x24 |
|---|
| 151 | #define RW_I2 0x28 |
|---|
| 152 | #define RW_I3 0x2c |
|---|
| 153 | #define RW_I4 0x30 |
|---|
| 154 | #define RW_I5 0x34 |
|---|
| 155 | #define RW_I6 0x38 |
|---|
| 156 | #define RW_I7 0x3c |
|---|
| 157 | |
|---|
| 158 | /* Fpu_window offsets */ |
|---|
| 159 | #define FW_F0 0x00 |
|---|
| 160 | #define FW_F2 0x08 |
|---|
| 161 | #define FW_F4 0x10 |
|---|
| 162 | #define FW_F6 0x18 |
|---|
| 163 | #define FW_F8 0x20 |
|---|
| 164 | #define FW_F10 0x28 |
|---|
| 165 | #define FW_F12 0x30 |
|---|
| 166 | #define FW_F14 0x38 |
|---|
| 167 | #define FW_F16 0x40 |
|---|
| 168 | #define FW_F18 0x48 |
|---|
| 169 | #define FW_F20 0x50 |
|---|
| 170 | #define FW_F22 0x58 |
|---|
| 171 | #define FW_F24 0x60 |
|---|
| 172 | #define FW_F26 0x68 |
|---|
| 173 | #define FW_F28 0x70 |
|---|
| 174 | #define FW_F30 0x78 |
|---|
| 175 | #define FW_FSR 0x80 |
|---|
| 176 | |
|---|
| 177 | #endif /* !_INCLUDE_LEON_STACK_h */ |
|---|