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