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