]> Git Repo - binutils.git/blob - gdb/tm-isi.h
Add reminders for next release.
[binutils.git] / gdb / tm-isi.h
1 /* Definitions to target GDB on an ISI Optimum V (3.05) under 4.3bsd.
2    Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
19
20 /* This has not been tested on ISI's running BSD 4.2, but it will probably
21    work.  */
22
23 #define HAVE_68881
24
25 /* Define this if the C compiler puts an underscore at the front
26    of external names before giving them to the linker.  */
27
28 #define NAMES_HAVE_UNDERSCORE
29
30 /* Address of end of stack space.  */
31
32 #define STACK_END_ADDR 0xfffe000
33
34 /* Data segment starts at etext rounded up to DATAROUND in {N,Z}MAGIC files */
35
36 #define DATAROUND       0x20000
37 #define N_DATADDR(hdr)  (hdr.a_magic != OMAGIC ? \
38         (hdr.a_text + DATAROUND) & ~(DATAROUND-1) : hdr.a_text)
39
40 /* Text segment starts at sizeof (struct exec) in {N,Z}MAGIC files */
41
42 #define N_TXTADDR(hdr)  (hdr.a_magic != OMAGIC ? sizeof (struct exec) : 0)
43
44 /* Amount PC must be decremented by after a breakpoint.
45    This is often the number of bytes in BREAKPOINT
46    but not always.
47    On the ISI, the kernel resets the pc to the trap instr */
48
49 #define DECR_PC_AFTER_BREAK 0
50
51 \f
52 /* Return number of args passed to a frame.
53    Can return -1, meaning no way to tell.  */
54
55 #define FRAME_NUM_ARGS(val, fi)  \
56 { register CORE_ADDR pc = FRAME_SAVED_PC (fi);                  \
57   register int insn = 0177777 & read_memory_integer (pc, 2);    \
58   val = 0;                                                      \
59   if (insn == 0047757 || insn == 0157374)  /* lea W(sp),sp or addaw #W,sp */ \
60     val = read_memory_integer (pc + 2, 2);                      \
61   else if ((insn & 0170777) == 0050217 /* addql #N, sp */       \
62            || (insn & 0170777) == 0050117)  /* addqw */         \
63     { val = (insn >> 9) & 7; if (val == 0) val = 8; }           \
64   else if (insn == 0157774) /* addal #WW, sp */                 \
65     val = read_memory_integer (pc + 2, 4);                      \
66   val >>= 2; }
67
68 /* Put here the code to store, into a struct frame_saved_regs,
69    the addresses of the saved registers of frame described by FRAME_INFO.
70    This includes special registers such as pc and fp saved in special
71    ways in the stack frame.  sp is even more special:
72    the address we return for it IS the sp for the next frame.  */
73
74 #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs)             \
75 { register int regnum;                                                  \
76   register int regmask;                                                 \
77   register CORE_ADDR next_addr;                                         \
78   register CORE_ADDR pc;                                                \
79   register int insn;                                                    \
80   register int offset;                                                  \
81   bzero (&frame_saved_regs, sizeof frame_saved_regs);                   \
82   if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 8*12 - 4 \
83       && (frame_info)->pc <= (frame_info)->frame)                               \
84     { next_addr = (frame_info)->frame;                                  \
85       pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 8*12 - 4; }\
86   else                                                                  \
87     { pc = get_pc_function_start ((frame_info)->pc);                    \
88       /* Verify we have a link a6 instruction next,                     \
89          or a branch followed by a link a6 instruction;                 \
90          if not we lose.  If we win, find the address above the saved   \
91          regs using the amount of storage from the link instruction.  */\
92 retry:                                                                  \
93       insn = read_memory_integer (pc, 2);                               \
94       if (insn == 044016)                                               \
95         next_addr = (frame_info)->frame - read_memory_integer (pc += 2, 4), pc+=4; \
96       else if (insn == 047126)                                          \
97         next_addr = (frame_info)->frame - read_memory_integer (pc += 2, 2), pc+=2; \
98       else if ((insn & 0177400) == 060000)      /* bra insn */          \
99         { offset = insn & 0377;                                         \
100           pc += 2;                              /* advance past bra */  \
101           if (offset == 0)                      /* bra #word */         \
102             offset = read_memory_integer (pc, 2), pc += 2;              \
103           else if (offset == 0377)              /* bra #long */         \
104             offset = read_memory_integer (pc, 4), pc += 4;              \
105           pc += offset;                                                 \
106           goto retry;                                                   \
107       } else goto lose;                                                 \
108       /* If have an addal #-n, sp next, adjust next_addr.  */           \
109       if ((0177777 & read_memory_integer (pc, 2)) == 0157774)           \
110         next_addr += read_memory_integer (pc += 2, 4), pc += 4;         \
111     }                                                                   \
112   /* next should be a moveml to (sp) or -(sp) or a movl r,-(sp) */      \
113   insn = read_memory_integer (pc, 2), pc += 2;                          \
114   regmask = read_memory_integer (pc, 2);                                \
115   if ((insn & 0177760) == 022700)       /* movl rn, (sp) */             \
116     (frame_saved_regs).regs[(insn&7) + ((insn&010)?8:0)] = next_addr;   \
117   else if ((insn & 0177760) == 024700)  /* movl rn, -(sp) */            \
118     (frame_saved_regs).regs[(insn&7) + ((insn&010)?8:0)] = next_addr-=4; \
119   else if (insn == 0044327)             /* moveml mask, (sp) */         \
120     { pc += 2;                                                          \
121       /* Regmask's low bit is for register 0, the first written */      \
122       next_addr -= 4;                                                   \
123       for (regnum = 0; regnum < 16; regnum++, regmask >>= 1)            \
124         if (regmask & 1)                                                \
125           (frame_saved_regs).regs[regnum] = (next_addr += 4);           \
126   } else if (insn == 0044347)           /* moveml mask, -(sp) */        \
127     { pc += 2;                                                          \
128       /* Regmask's low bit is for register 15, the first pushed */      \
129       for (regnum = 15; regnum >= 0; regnum--, regmask >>= 1)           \
130         if (regmask & 1)                                                \
131           (frame_saved_regs).regs[regnum] = (next_addr -= 4); }         \
132   /* clrw -(sp); movw ccr,-(sp) may follow.  */                         \
133   if (read_memory_integer (pc, 2) == 041147                             \
134       && read_memory_integer (pc+2, 2) == 042347)                       \
135     (frame_saved_regs).regs[PS_REGNUM] = (next_addr -= 4);              \
136   lose: ;                                                               \
137   (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 8;         \
138   (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame;             \
139   (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 4;         \
140 }
141
142 /* The only reason this is here is the tm-isi.h reference below.  It
143    was moved back here from tm-68k.h.  FIXME? */
144
145 #define SKIP_PROLOGUE(pc)   \
146 { register int op = read_memory_integer (pc, 2);        \
147   if (op == 0047126)                                    \
148     pc += 4;   /* Skip link #word */                    \
149   else if (op == 0044016)                               \
150     pc += 6;   /* Skip link #long */                    \
151   /* Not sure why branches are here.  */                \
152   /* From tm-isi.h, tm-altos.h */                       \
153   else if (op == 0060000)                               \
154     pc += 4;   /* Skip bra #word */                     \
155   else if (op == 00600377)                              \
156     pc += 6;   /* skip bra #long */                     \
157   else if ((op & 0177400) == 0060000)                   \
158     pc += 2;   /* skip bra #char */                     \
159 }
160
161 #include "tm-68k.h"
This page took 0.0341 seconds and 4 git commands to generate.