]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/config/m68k/tm-isi.h
import gdb-1999-07-07 post reformat
[thirdparty/binutils-gdb.git] / gdb / config / m68k / tm-isi.h
1 /* Definitions to target GDB on an ISI Optimum V (3.05) under 4.3bsd.
2 Copyright (C) 1987, 1989, 1991, 1993 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., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 /* This has not been tested on ISI's running BSD 4.2, but it will probably
22 work. */
23
24 /* Data segment starts at etext rounded up to DATAROUND in {N,Z}MAGIC files */
25
26 #define DATAROUND 0x20000
27 #define N_DATADDR(hdr) (hdr.a_magic != OMAGIC ? \
28 (hdr.a_text + DATAROUND) & ~(DATAROUND-1) : hdr.a_text)
29
30 /* Text segment starts at sizeof (struct exec) in {N,Z}MAGIC files */
31
32 #define N_TXTADDR(hdr) (hdr.a_magic != OMAGIC ? sizeof (struct exec) : 0)
33
34 /* Amount PC must be decremented by after a breakpoint.
35 This is often the number of bytes in BREAKPOINT
36 but not always.
37 On the ISI, the kernel resets the pc to the trap instr */
38
39 #define DECR_PC_AFTER_BREAK 0
40 \f
41
42 /* Return number of args passed to a frame.
43 Can return -1, meaning no way to tell. */
44
45 extern int isi_frame_num_args PARAMS ((struct frame_info * fi));
46 #define FRAME_NUM_ARGS(fi) (isi_frame_num_args ((fi)))
47
48 /* Put here the code to store, into a struct frame_saved_regs,
49 the addresses of the saved registers of frame described by FRAME_INFO.
50 This includes special registers such as pc and fp saved in special
51 ways in the stack frame. sp is even more special:
52 the address we return for it IS the sp for the next frame. */
53
54 #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
55 { register int regnum; \
56 register int regmask; \
57 register CORE_ADDR next_addr; \
58 register CORE_ADDR pc; \
59 register int insn; \
60 register int offset; \
61 memset (&frame_saved_regs, '\0', sizeof frame_saved_regs); \
62 if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 8*12 - 4 \
63 && (frame_info)->pc <= (frame_info)->frame) \
64 { next_addr = (frame_info)->frame; \
65 pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 8*12 - 4; }\
66 else \
67 { pc = get_pc_function_start ((frame_info)->pc); \
68 /* Verify we have a link a6 instruction next, \
69 or a branch followed by a link a6 instruction; \
70 if not we lose. If we win, find the address above the saved \
71 regs using the amount of storage from the link instruction. */\
72 retry: \
73 insn = read_memory_integer (pc, 2); \
74 if (insn == 044016) \
75 next_addr = (frame_info)->frame - read_memory_integer (pc += 2, 4), pc+=4; \
76 else if (insn == 047126) \
77 next_addr = (frame_info)->frame - read_memory_integer (pc += 2, 2), pc+=2; \
78 else if ((insn & 0177400) == 060000) /* bra insn */ \
79 { offset = insn & 0377; \
80 pc += 2; /* advance past bra */ \
81 if (offset == 0) /* bra #word */ \
82 offset = read_memory_integer (pc, 2), pc += 2; \
83 else if (offset == 0377) /* bra #long */ \
84 offset = read_memory_integer (pc, 4), pc += 4; \
85 pc += offset; \
86 goto retry; \
87 } else goto lose; \
88 /* If have an addal #-n, sp next, adjust next_addr. */ \
89 if ((0177777 & read_memory_integer (pc, 2)) == 0157774) \
90 next_addr += read_memory_integer (pc += 2, 4), pc += 4; \
91 } \
92 /* next should be a moveml to (sp) or -(sp) or a movl r,-(sp) */ \
93 insn = read_memory_integer (pc, 2), pc += 2; \
94 regmask = read_memory_integer (pc, 2); \
95 if ((insn & 0177760) == 022700) /* movl rn, (sp) */ \
96 (frame_saved_regs).regs[(insn&7) + ((insn&010)?8:0)] = next_addr; \
97 else if ((insn & 0177760) == 024700) /* movl rn, -(sp) */ \
98 (frame_saved_regs).regs[(insn&7) + ((insn&010)?8:0)] = next_addr-=4; \
99 else if (insn == 0044327) /* moveml mask, (sp) */ \
100 { pc += 2; \
101 /* Regmask's low bit is for register 0, the first written */ \
102 next_addr -= 4; \
103 for (regnum = 0; regnum < 16; regnum++, regmask >>= 1) \
104 if (regmask & 1) \
105 (frame_saved_regs).regs[regnum] = (next_addr += 4); \
106 } else if (insn == 0044347) /* moveml mask, -(sp) */ \
107 { pc += 2; \
108 /* Regmask's low bit is for register 15, the first pushed */ \
109 for (regnum = 15; regnum >= 0; regnum--, regmask >>= 1) \
110 if (regmask & 1) \
111 (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \
112 /* clrw -(sp); movw ccr,-(sp) may follow. */ \
113 if (read_memory_integer (pc, 2) == 041147 \
114 && read_memory_integer (pc+2, 2) == 042347) \
115 (frame_saved_regs).regs[PS_REGNUM] = (next_addr -= 4); \
116 lose: ; \
117 (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 8; \
118 (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame; \
119 (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 4; \
120 }
121
122 /* The only reason this is here is the tm-isi.h reference below. It
123 was moved back here from tm-m68k.h. FIXME? */
124
125 extern CORE_ADDR isi_skip_prologue PARAMS ((CORE_ADDR));
126 #define SKIP_PROLOGUE(pc) (isi_skip_prologue (pc))
127
128 #include "m68k/tm-m68k.h"