| 1 | /* Parameters for NYU Ultracomputer 29000 target, for GDB, the GNU debugger. |
| 2 | Copyright 1990, 1991 Free Software Foundation, Inc. |
| 3 | Contributed by David Wood @ New York University (wood@nyu.edu). |
| 4 | |
| 5 | This file is part of GDB. |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 2 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program; if not, write to the Free Software |
| 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 20 | |
| 21 | /* This file includes tm-29k.h, but predefines REGISTER_NAMES and |
| 22 | related macros. The file supports a 29k running our flavor of |
| 23 | Unix on our Ultra3 PE Boards. */ |
| 24 | |
| 25 | /* Byte order is configurable, but this machine runs big-endian. */ |
| 26 | #define TARGET_BYTE_ORDER BIG_ENDIAN |
| 27 | |
| 28 | /* Initializer for an array of names of registers. |
| 29 | There should be NUM_REGS strings in this initializer. |
| 30 | */ |
| 31 | #define NUM_REGS (EXO_REGNUM + 1) |
| 32 | |
| 33 | #define REGISTER_NAMES { \ |
| 34 | "gr1", \ |
| 35 | "gr64", "gr65", "gr66", "gr67", "gr68", "gr69", "gr70", "gr71", "gr72", \ |
| 36 | "gr73", "gr74", "gr75", "gr76", "gr77", "gr78", "gr79", "gr80", "gr81", \ |
| 37 | "gr82", "gr83", "gr84", "gr85", "gr86", "gr87", "gr88", "gr89", "gr90", \ |
| 38 | "gr91", "gr92", "gr93", "gr94", "gr95", \ |
| 39 | "gr96", "gr97", "gr98", "gr99", "gr100", "gr101", "gr102", "gr103", "gr104", \ |
| 40 | "gr105", "gr106", "gr107", "gr108", "gr109", "gr110", "gr111", "gr112", \ |
| 41 | "gr113", "gr114", "gr115", "gr116", "gr117", "gr118", "gr119", "gr120", \ |
| 42 | "gr121", "gr122", "gr123", "gr124", "gr125", "gr126", "gr127", \ |
| 43 | "lr0", "lr1", "lr2", "lr3", "lr4", "lr5", "lr6", "lr7", "lr8", "lr9", \ |
| 44 | "lr10", "lr11", "lr12", "lr13", "lr14", "lr15", "lr16", "lr17", "lr18", \ |
| 45 | "lr19", "lr20", "lr21", "lr22", "lr23", "lr24", "lr25", "lr26", "lr27", \ |
| 46 | "lr28", "lr29", "lr30", "lr31", "lr32", "lr33", "lr34", "lr35", "lr36", \ |
| 47 | "lr37", "lr38", "lr39", "lr40", "lr41", "lr42", "lr43", "lr44", "lr45", \ |
| 48 | "lr46", "lr47", "lr48", "lr49", "lr50", "lr51", "lr52", "lr53", "lr54", \ |
| 49 | "lr55", "lr56", "lr57", "lr58", "lr59", "lr60", "lr61", "lr62", "lr63", \ |
| 50 | "lr64", "lr65", "lr66", "lr67", "lr68", "lr69", "lr70", "lr71", "lr72", \ |
| 51 | "lr73", "lr74", "lr75", "lr76", "lr77", "lr78", "lr79", "lr80", "lr81", \ |
| 52 | "lr82", "lr83", "lr84", "lr85", "lr86", "lr87", "lr88", "lr89", "lr90", \ |
| 53 | "lr91", "lr92", "lr93", "lr94", "lr95", "lr96", "lr97", "lr98", "lr99", \ |
| 54 | "lr100", "lr101", "lr102", "lr103", "lr104", "lr105", "lr106", "lr107", \ |
| 55 | "lr108", "lr109", "lr110", "lr111", "lr112", "lr113", "lr114", "lr115", \ |
| 56 | "lr116", "lr117", "lr118", "lr119", "lr120", "lr121", "lr122", "lr123", \ |
| 57 | "lr124", "lr125", "lr126", "lr127", \ |
| 58 | "vab", "ops", "cps", "cfg", "cha", "chd", "chc", "rbp", "tmc", "tmr", \ |
| 59 | "pc0", "pc1", "pc2", "mmu", "lru", \ |
| 60 | "ipc", "ipa", "ipb", "q", "alu", "bp", "fc", "cr", \ |
| 61 | "fpe", "int", "fps", "exo" } |
| 62 | |
| 63 | |
| 64 | #ifdef KERNEL_DEBUGGING |
| 65 | # define PADDR_U_REGNUM 22 /* gr86 */ |
| 66 | # define RETURN_REGNUM GR64_REGNUM |
| 67 | #else |
| 68 | # define RETURN_REGNUM GR96_REGNUM |
| 69 | #endif /* KERNEL_DEBUGGING */ |
| 70 | |
| 71 | |
| 72 | /* Should rename all GR96_REGNUM to RETURN_REGNUM */ |
| 73 | #define GR1_REGNUM (0) |
| 74 | #define GR64_REGNUM 1 |
| 75 | #define GR96_REGNUM (GR64_REGNUM + 32) |
| 76 | /* This needs to be the memory stack pointer, not the register stack pointer, |
| 77 | to make call_function work right. */ |
| 78 | #define SP_REGNUM MSP_REGNUM |
| 79 | |
| 80 | #define FP_REGNUM (LR0_REGNUM + 1) /* lr1 */ |
| 81 | /* Large Return Pointer */ |
| 82 | #define LRP_REGNUM (123 - 96 + RETURN_REGNUM) |
| 83 | /* Static link pointer */ |
| 84 | #define SLP_REGNUM (124 - 96 + RETURN_REGNUM) |
| 85 | /* Memory Stack Pointer. */ |
| 86 | #define MSP_REGNUM (125 - 96 + RETURN_REGNUM) |
| 87 | /* Register allocate bound. */ |
| 88 | #define RAB_REGNUM (126 - 96 + RETURN_REGNUM) |
| 89 | /* Register Free Bound. */ |
| 90 | #define RFB_REGNUM (127 - 96 + RETURN_REGNUM) |
| 91 | /* Register Stack Pointer. */ |
| 92 | #define RSP_REGNUM GR1_REGNUM |
| 93 | #define LR0_REGNUM ( 32 + GR96_REGNUM) |
| 94 | |
| 95 | /* Protected Special registers */ |
| 96 | #define VAB_REGNUM (LR0_REGNUM + 128) |
| 97 | #define OPS_REGNUM (VAB_REGNUM + 1) |
| 98 | #define CPS_REGNUM (VAB_REGNUM + 2) |
| 99 | #define CFG_REGNUM (VAB_REGNUM + 3) |
| 100 | #define CHA_REGNUM (VAB_REGNUM + 4) |
| 101 | #define CHD_REGNUM (VAB_REGNUM + 5) |
| 102 | #define CHC_REGNUM (VAB_REGNUM + 6) |
| 103 | #define RBP_REGNUM (VAB_REGNUM + 7) |
| 104 | #define TMC_REGNUM (VAB_REGNUM + 8) |
| 105 | #define TMR_REGNUM (VAB_REGNUM + 9) |
| 106 | #define NPC_REGNUM (VAB_REGNUM + 10) /* pc0 */ |
| 107 | #define PC_REGNUM (VAB_REGNUM + 11) /* pc1 */ |
| 108 | #define PC2_REGNUM (VAB_REGNUM + 12) /* pc2 */ |
| 109 | #define MMU_REGNUM (VAB_REGNUM + 13) |
| 110 | #define LRU_REGNUM (VAB_REGNUM + 14) |
| 111 | /* Register sequence gap */ |
| 112 | /* Unprotected Special registers */ |
| 113 | #define IPC_REGNUM (LRU_REGNUM + 1) |
| 114 | #define IPA_REGNUM (IPC_REGNUM + 1) |
| 115 | #define IPB_REGNUM (IPC_REGNUM + 2) |
| 116 | #define Q_REGNUM (IPC_REGNUM + 3) |
| 117 | #define ALU_REGNUM (IPC_REGNUM + 4) |
| 118 | #define PS_REGNUM ALU_REGNUM |
| 119 | #define BP_REGNUM (IPC_REGNUM + 5) |
| 120 | #define FC_REGNUM (IPC_REGNUM + 6) |
| 121 | #define CR_REGNUM (IPC_REGNUM + 7) |
| 122 | /* Register sequence gap */ |
| 123 | #define FPE_REGNUM (CR_REGNUM + 1) |
| 124 | #define INT_REGNUM (FPE_REGNUM + 1) |
| 125 | #define FPS_REGNUM (FPE_REGNUM + 2) |
| 126 | /* Register sequence gap */ |
| 127 | #define EXO_REGNUM (FPS_REGNUM + 1) |
| 128 | |
| 129 | /* Special register #x. */ |
| 130 | #define SR_REGNUM(x) \ |
| 131 | ((x) < 15 ? VAB_REGNUM + (x) \ |
| 132 | : (x) >= 128 && (x) < 136 ? IPC_REGNUM + (x-128) \ |
| 133 | : (x) >= 160 && (x) < 163 ? FPE_REGNUM + (x-160) \ |
| 134 | : (x) == 164 ? EXO_REGNUM \ |
| 135 | : (error ("Internal error in SR_REGNUM"), 0)) |
| 136 | |
| 137 | #ifndef KERNEL_DEBUGGING |
| 138 | /* |
| 139 | * This macro defines the register numbers (from REGISTER_NAMES) that |
| 140 | * are effectively unavailable to the user through ptrace(). It allows |
| 141 | * us to include the whole register set in REGISTER_NAMES (inorder to |
| 142 | * better support remote debugging). If it is used in |
| 143 | * fetch/store_inferior_registers() gdb will not complain about I/O errors |
| 144 | * on fetching these registers. If all registers in REGISTER_NAMES |
| 145 | * are available, then return false (0). |
| 146 | */ |
| 147 | #define CANNOT_STORE_REGISTER(regno) \ |
| 148 | (((regno)>=GR64_REGNUM && (regno)<GR64_REGNUM+32) || \ |
| 149 | ((regno)==VAB_REGNUM) || \ |
| 150 | ((regno)==OPS_REGNUM) || \ |
| 151 | ((regno)>=CFG_REGNUM && (regno)<=TMR_REGNUM) || \ |
| 152 | ((regno)==MMU_REGNUM) || \ |
| 153 | ((regno)==LRU_REGNUM) || \ |
| 154 | ((regno)>=ALU_REGNUM) || \ |
| 155 | ((regno)==CR_REGNUM) || \ |
| 156 | ((regno)==EXO_REGNUM)) |
| 157 | #define CANNOT_FETCH_REGISTER(regno) CANNOT_STORE_REGISTER(regno) |
| 158 | #endif /* KERNEL_DEBUGGING */ |
| 159 | |
| 160 | /* |
| 161 | * Converts an sdb register number to an internal gdb register number. |
| 162 | * Currently under gcc, gr96->0...gr128->31...lr0->32...lr127->159, or... |
| 163 | * gr64->0...gr95->31, lr0->32...lr127->159. |
| 164 | */ |
| 165 | #define SDB_REG_TO_REGNUM(value) (((value)<32) ? ((value)+RETURN_REGNUM) : \ |
| 166 | ((value)-32+LR0_REGNUM)) |
| 167 | |
| 168 | #ifdef KERNEL_DEBUGGING |
| 169 | /* ublock virtual address as defined in our sys/param.h */ |
| 170 | /* FIXME: Should get this from sys/param.h */ |
| 171 | # define UVADDR ((32*0x100000)-8192) |
| 172 | #endif |
| 173 | |
| 174 | /* |
| 175 | * Are we in sigtramp(), needed in infrun.c. Specific to ultra3, because |
| 176 | * we take off the leading '_'. |
| 177 | */ |
| 178 | #if !defined(KERNEL_DEBUGGING) |
| 179 | #ifdef SYM1 |
| 180 | # define IN_SIGTRAMP(pc, name) (name && !strcmp ("sigtramp", name)) |
| 181 | #else |
| 182 | Need to define IN_SIGTRAMP() for sym2. |
| 183 | #endif |
| 184 | #endif /* !KERNEL_DEBUGGING */ |
| 185 | |
| 186 | #include "tm-29k.h" |
| 187 | |
| 188 | /**** The following are definitions that override those in tm-29k.h ****/ |
| 189 | |
| 190 | /* This sequence of words is the instructions |
| 191 | mtsrim cr, 15 |
| 192 | loadm 0, 0, lr2, msp ; load first 16 words of arguments into registers |
| 193 | add msp, msp, 16 * 4 ; point to the remaining arguments |
| 194 | CONST_INSN: |
| 195 | const gr96,inf |
| 196 | consth gr96,inf |
| 197 | calli lr0, gr96 |
| 198 | aseq 0x40,gr1,gr1 ; nop |
| 199 | asneq 0x50,gr1,gr1 ; breakpoint |
| 200 | When KERNEL_DEBUGGIN is defined, msp -> gr93, gr96 -> gr64, |
| 201 | 7d -> 5d, 60 -> 40 |
| 202 | */ |
| 203 | |
| 204 | /* Position of the "const" instruction within CALL_DUMMY in bytes. */ |
| 205 | #undef CALL_DUMMY |
| 206 | #if TARGET_BYTE_ORDER == HOST_BYTE_ORDER |
| 207 | #ifdef KERNEL_DEBUGGING /* gr96 -> gr64 */ |
| 208 | # define CALL_DUMMY {0x0400870f, 0x3600825d, 0x155d5d40, 0x03ff40ff, \ |
| 209 | 0x02ff40ff, 0xc8008040, 0x70400101, 0x72500101} |
| 210 | #else |
| 211 | # define CALL_DUMMY {0x0400870f, 0x3600827d, 0x157d7d40, 0x03ff60ff, \ |
| 212 | 0x02ff60ff, 0xc8008060, 0x70400101, 0x72500101} |
| 213 | #endif /* KERNEL_DEBUGGING */ |
| 214 | #else /* Byte order differs. */ |
| 215 | you lose |
| 216 | #endif /* Byte order differs. */ |
| 217 | |
| 218 | #if !defined(KERNEL_DEBUGGING) |
| 219 | # ifdef SYM1 |
| 220 | # undef DECR_PC_AFTER_BREAK |
| 221 | # define DECR_PC_AFTER_BREAK 0 /* Sym1 kernel does the decrement */ |
| 222 | # else |
| 223 | ->"ULTRA3 running other than sym1 OS"!; |
| 224 | # endif |
| 225 | #endif /* !KERNEL_DEBUGGING */ |
| 226 | |