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