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