Fix PR gdb/778
[deliverable/binutils-gdb.git] / gdb / i960-tdep.c
CommitLineData
4d210288
AC
1// OBSOLETE /* Target-machine dependent code for the Intel 960
2// OBSOLETE
3// OBSOLETE Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
4// OBSOLETE 2001, 2002 Free Software Foundation, Inc.
5// OBSOLETE
6// OBSOLETE Contributed by Intel Corporation.
7// OBSOLETE examine_prologue and other parts contributed by Wind River Systems.
8// OBSOLETE
9// OBSOLETE This file is part of GDB.
10// OBSOLETE
11// OBSOLETE This program is free software; you can redistribute it and/or modify
12// OBSOLETE it under the terms of the GNU General Public License as published by
13// OBSOLETE the Free Software Foundation; either version 2 of the License, or
14// OBSOLETE (at your option) any later version.
15// OBSOLETE
16// OBSOLETE This program is distributed in the hope that it will be useful,
17// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
18// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// OBSOLETE GNU General Public License for more details.
20// OBSOLETE
21// OBSOLETE You should have received a copy of the GNU General Public License
22// OBSOLETE along with this program; if not, write to the Free Software
23// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
24// OBSOLETE Boston, MA 02111-1307, USA. */
25// OBSOLETE
26// OBSOLETE #include "defs.h"
27// OBSOLETE #include "symtab.h"
28// OBSOLETE #include "value.h"
29// OBSOLETE #include "frame.h"
30// OBSOLETE #include "floatformat.h"
31// OBSOLETE #include "target.h"
32// OBSOLETE #include "gdbcore.h"
33// OBSOLETE #include "inferior.h"
34// OBSOLETE #include "regcache.h"
35// OBSOLETE #include "gdb_string.h"
36// OBSOLETE
37// OBSOLETE static CORE_ADDR next_insn (CORE_ADDR memaddr,
38// OBSOLETE unsigned int *pword1, unsigned int *pword2);
39// OBSOLETE
40// OBSOLETE struct type *
41// OBSOLETE i960_register_type (int regnum)
42// OBSOLETE {
43// OBSOLETE if (regnum < FP0_REGNUM)
44// OBSOLETE return builtin_type_int32;
45// OBSOLETE else
46// OBSOLETE return builtin_type_i960_ext;
47// OBSOLETE }
48// OBSOLETE
49// OBSOLETE
50// OBSOLETE /* Does the specified function use the "struct returning" convention
51// OBSOLETE or the "value returning" convention? The "value returning" convention
52// OBSOLETE almost invariably returns the entire value in registers. The
53// OBSOLETE "struct returning" convention often returns the entire value in
54// OBSOLETE memory, and passes a pointer (out of or into the function) saying
55// OBSOLETE where the value (is or should go).
56// OBSOLETE
57// OBSOLETE Since this sometimes depends on whether it was compiled with GCC,
58// OBSOLETE this is also an argument. This is used in call_function to build a
59// OBSOLETE stack, and in value_being_returned to print return values.
60// OBSOLETE
61// OBSOLETE On i960, a structure is returned in registers g0-g3, if it will fit.
62// OBSOLETE If it's more than 16 bytes long, g13 pointed to it on entry. */
63// OBSOLETE
64// OBSOLETE int
65// OBSOLETE i960_use_struct_convention (int gcc_p, struct type *type)
66// OBSOLETE {
67// OBSOLETE return (TYPE_LENGTH (type) > 16);
68// OBSOLETE }
69// OBSOLETE
70// OBSOLETE /* gdb960 is always running on a non-960 host. Check its characteristics.
71// OBSOLETE This routine must be called as part of gdb initialization. */
72// OBSOLETE
73// OBSOLETE static void
74// OBSOLETE check_host (void)
75// OBSOLETE {
76// OBSOLETE int i;
77// OBSOLETE
78// OBSOLETE static struct typestruct
79// OBSOLETE {
80// OBSOLETE int hostsize; /* Size of type on host */
81// OBSOLETE int i960size; /* Size of type on i960 */
82// OBSOLETE char *typename; /* Name of type, for error msg */
83// OBSOLETE }
84// OBSOLETE types[] =
85// OBSOLETE {
86// OBSOLETE {
87// OBSOLETE sizeof (short), 2, "short"
88// OBSOLETE }
89// OBSOLETE ,
90// OBSOLETE {
91// OBSOLETE sizeof (int), 4, "int"
92// OBSOLETE }
93// OBSOLETE ,
94// OBSOLETE {
95// OBSOLETE sizeof (long), 4, "long"
96// OBSOLETE }
97// OBSOLETE ,
98// OBSOLETE {
99// OBSOLETE sizeof (float), 4, "float"
100// OBSOLETE }
101// OBSOLETE ,
102// OBSOLETE {
103// OBSOLETE sizeof (double), 8, "double"
104// OBSOLETE }
105// OBSOLETE ,
106// OBSOLETE {
107// OBSOLETE sizeof (char *), 4, "pointer"
108// OBSOLETE }
109// OBSOLETE ,
110// OBSOLETE };
111// OBSOLETE #define TYPELEN (sizeof(types) / sizeof(struct typestruct))
112// OBSOLETE
113// OBSOLETE /* Make sure that host type sizes are same as i960
114// OBSOLETE */
115// OBSOLETE for (i = 0; i < TYPELEN; i++)
116// OBSOLETE {
117// OBSOLETE if (types[i].hostsize != types[i].i960size)
118// OBSOLETE {
119// OBSOLETE printf_unfiltered ("sizeof(%s) != %d: PROCEED AT YOUR OWN RISK!\n",
120// OBSOLETE types[i].typename, types[i].i960size);
121// OBSOLETE }
122// OBSOLETE
123// OBSOLETE }
124// OBSOLETE }
125// OBSOLETE \f
126// OBSOLETE /* Is this register part of the register window system? A yes answer
127// OBSOLETE implies that 1) The name of this register will not be the same in
128// OBSOLETE other frames, and 2) This register is automatically "saved" upon
129// OBSOLETE subroutine calls and thus there is no need to search more than one
130// OBSOLETE stack frame for it.
131// OBSOLETE
132// OBSOLETE On the i960, in fact, the name of this register in another frame is
133// OBSOLETE "mud" -- there is no overlap between the windows. Each window is
134// OBSOLETE simply saved into the stack (true for our purposes, after having been
135// OBSOLETE flushed; normally they reside on-chip and are restored from on-chip
136// OBSOLETE without ever going to memory). */
137// OBSOLETE
138// OBSOLETE static int
139// OBSOLETE register_in_window_p (int regnum)
140// OBSOLETE {
141// OBSOLETE return regnum <= R15_REGNUM;
142// OBSOLETE }
143// OBSOLETE
144// OBSOLETE /* i960_find_saved_register ()
145// OBSOLETE
146// OBSOLETE Return the address in which frame FRAME's value of register REGNUM
147// OBSOLETE has been saved in memory. Or return zero if it has not been saved.
148// OBSOLETE If REGNUM specifies the SP, the value we return is actually the SP
149// OBSOLETE value, not an address where it was saved. */
150// OBSOLETE
151// OBSOLETE static CORE_ADDR
152// OBSOLETE i960_find_saved_register (struct frame_info *frame, int regnum)
153// OBSOLETE {
154// OBSOLETE register struct frame_info *frame1 = NULL;
155// OBSOLETE register CORE_ADDR addr = 0;
156// OBSOLETE
157// OBSOLETE if (frame == NULL) /* No regs saved if want current frame */
158// OBSOLETE return 0;
159// OBSOLETE
160// OBSOLETE /* We assume that a register in a register window will only be saved
161// OBSOLETE in one place (since the name changes and/or disappears as you go
162// OBSOLETE towards inner frames), so we only call get_frame_saved_regs on
163// OBSOLETE the current frame. This is directly in contradiction to the
164// OBSOLETE usage below, which assumes that registers used in a frame must be
165// OBSOLETE saved in a lower (more interior) frame. This change is a result
166// OBSOLETE of working on a register window machine; get_frame_saved_regs
167// OBSOLETE always returns the registers saved within a frame, within the
168// OBSOLETE context (register namespace) of that frame. */
169// OBSOLETE
170// OBSOLETE /* However, note that we don't want this to return anything if
171// OBSOLETE nothing is saved (if there's a frame inside of this one). Also,
172// OBSOLETE callers to this routine asking for the stack pointer want the
173// OBSOLETE stack pointer saved for *this* frame; this is returned from the
174// OBSOLETE next frame. */
175// OBSOLETE
176// OBSOLETE if (register_in_window_p (regnum))
177// OBSOLETE {
178// OBSOLETE frame1 = get_next_frame (frame);
179// OBSOLETE if (!frame1)
180// OBSOLETE return 0; /* Registers of this frame are active. */
181// OBSOLETE
182// OBSOLETE /* Get the SP from the next frame in; it will be this
183// OBSOLETE current frame. */
184// OBSOLETE if (regnum != SP_REGNUM)
185// OBSOLETE frame1 = frame;
186// OBSOLETE
187// OBSOLETE FRAME_INIT_SAVED_REGS (frame1);
188// OBSOLETE return frame1->saved_regs[regnum]; /* ... which might be zero */
189// OBSOLETE }
190// OBSOLETE
191// OBSOLETE /* Note that this next routine assumes that registers used in
192// OBSOLETE frame x will be saved only in the frame that x calls and
193// OBSOLETE frames interior to it. This is not true on the sparc, but the
194// OBSOLETE above macro takes care of it, so we should be all right. */
195// OBSOLETE while (1)
196// OBSOLETE {
197// OBSOLETE QUIT;
198// OBSOLETE frame1 = get_next_frame (frame);
199// OBSOLETE if (frame1 == 0)
200// OBSOLETE break;
201// OBSOLETE frame = frame1;
202// OBSOLETE FRAME_INIT_SAVED_REGS (frame1);
203// OBSOLETE if (frame1->saved_regs[regnum])
204// OBSOLETE addr = frame1->saved_regs[regnum];
205// OBSOLETE }
206// OBSOLETE
207// OBSOLETE return addr;
208// OBSOLETE }
209// OBSOLETE
210// OBSOLETE /* i960_get_saved_register ()
211// OBSOLETE
212// OBSOLETE Find register number REGNUM relative to FRAME and put its (raw,
213// OBSOLETE target format) contents in *RAW_BUFFER. Set *OPTIMIZED if the
214// OBSOLETE variable was optimized out (and thus can't be fetched). Set *LVAL
215// OBSOLETE to lval_memory, lval_register, or not_lval, depending on whether
216// OBSOLETE the value was fetched from memory, from a register, or in a strange
217// OBSOLETE and non-modifiable way (e.g. a frame pointer which was calculated
218// OBSOLETE rather than fetched). Set *ADDRP to the address, either in memory
219// OBSOLETE on as a REGISTER_BYTE offset into the registers array.
220// OBSOLETE
221// OBSOLETE Note that this implementation never sets *LVAL to not_lval. But it
222// OBSOLETE can be replaced by defining GET_SAVED_REGISTER and supplying your
223// OBSOLETE own.
224// OBSOLETE
225// OBSOLETE The argument RAW_BUFFER must point to aligned memory. */
226// OBSOLETE
227// OBSOLETE void
228// OBSOLETE i960_get_saved_register (char *raw_buffer,
229// OBSOLETE int *optimized,
230// OBSOLETE CORE_ADDR *addrp,
231// OBSOLETE struct frame_info *frame,
232// OBSOLETE int regnum,
233// OBSOLETE enum lval_type *lval)
234// OBSOLETE {
235// OBSOLETE CORE_ADDR addr;
236// OBSOLETE
237// OBSOLETE if (!target_has_registers)
238// OBSOLETE error ("No registers.");
239// OBSOLETE
240// OBSOLETE /* Normal systems don't optimize out things with register numbers. */
241// OBSOLETE if (optimized != NULL)
242// OBSOLETE *optimized = 0;
243// OBSOLETE addr = i960_find_saved_register (frame, regnum);
244// OBSOLETE if (addr != 0)
245// OBSOLETE {
246// OBSOLETE if (lval != NULL)
247// OBSOLETE *lval = lval_memory;
248// OBSOLETE if (regnum == SP_REGNUM)
249// OBSOLETE {
250// OBSOLETE if (raw_buffer != NULL)
251// OBSOLETE {
252// OBSOLETE /* Put it back in target format. */
253// OBSOLETE store_address (raw_buffer, REGISTER_RAW_SIZE (regnum),
254// OBSOLETE (LONGEST) addr);
255// OBSOLETE }
256// OBSOLETE if (addrp != NULL)
257// OBSOLETE *addrp = 0;
258// OBSOLETE return;
259// OBSOLETE }
260// OBSOLETE if (raw_buffer != NULL)
261// OBSOLETE target_read_memory (addr, raw_buffer, REGISTER_RAW_SIZE (regnum));
262// OBSOLETE }
263// OBSOLETE else
264// OBSOLETE {
265// OBSOLETE if (lval != NULL)
266// OBSOLETE *lval = lval_register;
267// OBSOLETE addr = REGISTER_BYTE (regnum);
268// OBSOLETE if (raw_buffer != NULL)
269// OBSOLETE read_register_gen (regnum, raw_buffer);
270// OBSOLETE }
271// OBSOLETE if (addrp != NULL)
272// OBSOLETE *addrp = addr;
273// OBSOLETE }
274// OBSOLETE \f
275// OBSOLETE /* Examine an i960 function prologue, recording the addresses at which
276// OBSOLETE registers are saved explicitly by the prologue code, and returning
277// OBSOLETE the address of the first instruction after the prologue (but not
278// OBSOLETE after the instruction at address LIMIT, as explained below).
279// OBSOLETE
280// OBSOLETE LIMIT places an upper bound on addresses of the instructions to be
281// OBSOLETE examined. If the prologue code scan reaches LIMIT, the scan is
282// OBSOLETE aborted and LIMIT is returned. This is used, when examining the
283// OBSOLETE prologue for the current frame, to keep examine_prologue () from
284// OBSOLETE claiming that a given register has been saved when in fact the
285// OBSOLETE instruction that saves it has not yet been executed. LIMIT is used
286// OBSOLETE at other times to stop the scan when we hit code after the true
287// OBSOLETE function prologue (e.g. for the first source line) which might
288// OBSOLETE otherwise be mistaken for function prologue.
289// OBSOLETE
290// OBSOLETE The format of the function prologue matched by this routine is
291// OBSOLETE derived from examination of the source to gcc960 1.21, particularly
292// OBSOLETE the routine i960_function_prologue (). A "regular expression" for
293// OBSOLETE the function prologue is given below:
294// OBSOLETE
295// OBSOLETE (lda LRn, g14
296// OBSOLETE mov g14, g[0-7]
297// OBSOLETE (mov 0, g14) | (lda 0, g14))?
298// OBSOLETE
299// OBSOLETE (mov[qtl]? g[0-15], r[4-15])*
300// OBSOLETE ((addo [1-31], sp, sp) | (lda n(sp), sp))?
301// OBSOLETE (st[qtl]? g[0-15], n(fp))*
302// OBSOLETE
303// OBSOLETE (cmpobne 0, g14, LFn
304// OBSOLETE mov sp, g14
305// OBSOLETE lda 0x30(sp), sp
306// OBSOLETE LFn: stq g0, (g14)
307// OBSOLETE stq g4, 0x10(g14)
308// OBSOLETE stq g8, 0x20(g14))?
309// OBSOLETE
310// OBSOLETE (st g14, n(fp))?
311// OBSOLETE (mov g13,r[4-15])?
312// OBSOLETE */
313// OBSOLETE
314// OBSOLETE /* Macros for extracting fields from i960 instructions. */
315// OBSOLETE
316// OBSOLETE #define BITMASK(pos, width) (((0x1 << (width)) - 1) << (pos))
317// OBSOLETE #define EXTRACT_FIELD(val, pos, width) ((val) >> (pos) & BITMASK (0, width))
318// OBSOLETE
319// OBSOLETE #define REG_SRC1(insn) EXTRACT_FIELD (insn, 0, 5)
320// OBSOLETE #define REG_SRC2(insn) EXTRACT_FIELD (insn, 14, 5)
321// OBSOLETE #define REG_SRCDST(insn) EXTRACT_FIELD (insn, 19, 5)
322// OBSOLETE #define MEM_SRCDST(insn) EXTRACT_FIELD (insn, 19, 5)
323// OBSOLETE #define MEMA_OFFSET(insn) EXTRACT_FIELD (insn, 0, 12)
324// OBSOLETE
325// OBSOLETE /* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or
326// OBSOLETE is not the address of a valid instruction, the address of the next
327// OBSOLETE instruction beyond ADDR otherwise. *PWORD1 receives the first word
328// OBSOLETE of the instruction, and (for two-word instructions), *PWORD2 receives
329// OBSOLETE the second. */
330// OBSOLETE
331// OBSOLETE #define NEXT_PROLOGUE_INSN(addr, lim, pword1, pword2) \
332// OBSOLETE (((addr) < (lim)) ? next_insn (addr, pword1, pword2) : 0)
333// OBSOLETE
334// OBSOLETE static CORE_ADDR
335// OBSOLETE examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit,
336// OBSOLETE CORE_ADDR frame_addr, struct frame_saved_regs *fsr)
337// OBSOLETE {
338// OBSOLETE register CORE_ADDR next_ip;
339// OBSOLETE register int src, dst;
340// OBSOLETE register unsigned int *pcode;
341// OBSOLETE unsigned int insn1, insn2;
342// OBSOLETE int size;
343// OBSOLETE int within_leaf_prologue;
344// OBSOLETE CORE_ADDR save_addr;
345// OBSOLETE static unsigned int varargs_prologue_code[] =
346// OBSOLETE {
347// OBSOLETE 0x3507a00c, /* cmpobne 0x0, g14, LFn */
348// OBSOLETE 0x5cf01601, /* mov sp, g14 */
349// OBSOLETE 0x8c086030, /* lda 0x30(sp), sp */
350// OBSOLETE 0xb2879000, /* LFn: stq g0, (g14) */
351// OBSOLETE 0xb2a7a010, /* stq g4, 0x10(g14) */
352// OBSOLETE 0xb2c7a020 /* stq g8, 0x20(g14) */
353// OBSOLETE };
354// OBSOLETE
355// OBSOLETE /* Accept a leaf procedure prologue code fragment if present.
356// OBSOLETE Note that ip might point to either the leaf or non-leaf
357// OBSOLETE entry point; we look for the non-leaf entry point first: */
358// OBSOLETE
359// OBSOLETE within_leaf_prologue = 0;
360// OBSOLETE if ((next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn1, &insn2))
361// OBSOLETE && ((insn1 & 0xfffff000) == 0x8cf00000 /* lda LRx, g14 (MEMA) */
362// OBSOLETE || (insn1 & 0xfffffc60) == 0x8cf03000)) /* lda LRx, g14 (MEMB) */
363// OBSOLETE {
364// OBSOLETE within_leaf_prologue = 1;
365// OBSOLETE next_ip = NEXT_PROLOGUE_INSN (next_ip, limit, &insn1, &insn2);
366// OBSOLETE }
367// OBSOLETE
368// OBSOLETE /* Now look for the prologue code at a leaf entry point: */
369// OBSOLETE
370// OBSOLETE if (next_ip
371// OBSOLETE && (insn1 & 0xff87ffff) == 0x5c80161e /* mov g14, gx */
372// OBSOLETE && REG_SRCDST (insn1) <= G0_REGNUM + 7)
373// OBSOLETE {
374// OBSOLETE within_leaf_prologue = 1;
375// OBSOLETE if ((next_ip = NEXT_PROLOGUE_INSN (next_ip, limit, &insn1, &insn2))
376// OBSOLETE && (insn1 == 0x8cf00000 /* lda 0, g14 */
377// OBSOLETE || insn1 == 0x5cf01e00)) /* mov 0, g14 */
378// OBSOLETE {
379// OBSOLETE ip = next_ip;
380// OBSOLETE next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn1, &insn2);
381// OBSOLETE within_leaf_prologue = 0;
382// OBSOLETE }
383// OBSOLETE }
384// OBSOLETE
385// OBSOLETE /* If something that looks like the beginning of a leaf prologue
386// OBSOLETE has been seen, but the remainder of the prologue is missing, bail.
387// OBSOLETE We don't know what we've got. */
388// OBSOLETE
389// OBSOLETE if (within_leaf_prologue)
390// OBSOLETE return (ip);
391// OBSOLETE
392// OBSOLETE /* Accept zero or more instances of "mov[qtl]? gx, ry", where y >= 4.
393// OBSOLETE This may cause us to mistake the moving of a register
394// OBSOLETE parameter to a local register for the saving of a callee-saved
395// OBSOLETE register, but that can't be helped, since with the
396// OBSOLETE "-fcall-saved" flag, any register can be made callee-saved. */
397// OBSOLETE
398// OBSOLETE while (next_ip
399// OBSOLETE && (insn1 & 0xfc802fb0) == 0x5c000610
400// OBSOLETE && (dst = REG_SRCDST (insn1)) >= (R0_REGNUM + 4))
401// OBSOLETE {
402// OBSOLETE src = REG_SRC1 (insn1);
403// OBSOLETE size = EXTRACT_FIELD (insn1, 24, 2) + 1;
404// OBSOLETE save_addr = frame_addr + ((dst - R0_REGNUM) * 4);
405// OBSOLETE while (size--)
406// OBSOLETE {
407// OBSOLETE fsr->regs[src++] = save_addr;
408// OBSOLETE save_addr += 4;
409// OBSOLETE }
410// OBSOLETE ip = next_ip;
411// OBSOLETE next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn1, &insn2);
412// OBSOLETE }
413// OBSOLETE
414// OBSOLETE /* Accept an optional "addo n, sp, sp" or "lda n(sp), sp". */
415// OBSOLETE
416// OBSOLETE if (next_ip &&
417// OBSOLETE ((insn1 & 0xffffffe0) == 0x59084800 /* addo n, sp, sp */
418// OBSOLETE || (insn1 & 0xfffff000) == 0x8c086000 /* lda n(sp), sp (MEMA) */
419// OBSOLETE || (insn1 & 0xfffffc60) == 0x8c087400)) /* lda n(sp), sp (MEMB) */
420// OBSOLETE {
421// OBSOLETE ip = next_ip;
422// OBSOLETE next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn1, &insn2);
423// OBSOLETE }
424// OBSOLETE
425// OBSOLETE /* Accept zero or more instances of "st[qtl]? gx, n(fp)".
426// OBSOLETE This may cause us to mistake the copying of a register
427// OBSOLETE parameter to the frame for the saving of a callee-saved
428// OBSOLETE register, but that can't be helped, since with the
429// OBSOLETE "-fcall-saved" flag, any register can be made callee-saved.
430// OBSOLETE We can, however, refuse to accept a save of register g14,
431// OBSOLETE since that is matched explicitly below. */
432// OBSOLETE
433// OBSOLETE while (next_ip &&
434// OBSOLETE ((insn1 & 0xf787f000) == 0x9287e000 /* stl? gx, n(fp) (MEMA) */
435// OBSOLETE || (insn1 & 0xf787fc60) == 0x9287f400 /* stl? gx, n(fp) (MEMB) */
436// OBSOLETE || (insn1 & 0xef87f000) == 0xa287e000 /* st[tq] gx, n(fp) (MEMA) */
437// OBSOLETE || (insn1 & 0xef87fc60) == 0xa287f400) /* st[tq] gx, n(fp) (MEMB) */
438// OBSOLETE && ((src = MEM_SRCDST (insn1)) != G14_REGNUM))
439// OBSOLETE {
440// OBSOLETE save_addr = frame_addr + ((insn1 & BITMASK (12, 1))
441// OBSOLETE ? insn2 : MEMA_OFFSET (insn1));
442// OBSOLETE size = (insn1 & BITMASK (29, 1)) ? ((insn1 & BITMASK (28, 1)) ? 4 : 3)
443// OBSOLETE : ((insn1 & BITMASK (27, 1)) ? 2 : 1);
444// OBSOLETE while (size--)
445// OBSOLETE {
446// OBSOLETE fsr->regs[src++] = save_addr;
447// OBSOLETE save_addr += 4;
448// OBSOLETE }
449// OBSOLETE ip = next_ip;
450// OBSOLETE next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn1, &insn2);
451// OBSOLETE }
452// OBSOLETE
453// OBSOLETE /* Accept the varargs prologue code if present. */
454// OBSOLETE
455// OBSOLETE size = sizeof (varargs_prologue_code) / sizeof (int);
456// OBSOLETE pcode = varargs_prologue_code;
457// OBSOLETE while (size-- && next_ip && *pcode++ == insn1)
458// OBSOLETE {
459// OBSOLETE ip = next_ip;
460// OBSOLETE next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn1, &insn2);
461// OBSOLETE }
462// OBSOLETE
463// OBSOLETE /* Accept an optional "st g14, n(fp)". */
464// OBSOLETE
465// OBSOLETE if (next_ip &&
466// OBSOLETE ((insn1 & 0xfffff000) == 0x92f7e000 /* st g14, n(fp) (MEMA) */
467// OBSOLETE || (insn1 & 0xfffffc60) == 0x92f7f400)) /* st g14, n(fp) (MEMB) */
468// OBSOLETE {
469// OBSOLETE fsr->regs[G14_REGNUM] = frame_addr + ((insn1 & BITMASK (12, 1))
470// OBSOLETE ? insn2 : MEMA_OFFSET (insn1));
471// OBSOLETE ip = next_ip;
472// OBSOLETE next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn1, &insn2);
473// OBSOLETE }
474// OBSOLETE
475// OBSOLETE /* Accept zero or one instance of "mov g13, ry", where y >= 4.
476// OBSOLETE This is saving the address where a struct should be returned. */
477// OBSOLETE
478// OBSOLETE if (next_ip
479// OBSOLETE && (insn1 & 0xff802fbf) == 0x5c00061d
480// OBSOLETE && (dst = REG_SRCDST (insn1)) >= (R0_REGNUM + 4))
481// OBSOLETE {
482// OBSOLETE save_addr = frame_addr + ((dst - R0_REGNUM) * 4);
483// OBSOLETE fsr->regs[G0_REGNUM + 13] = save_addr;
484// OBSOLETE ip = next_ip;
485// OBSOLETE #if 0 /* We'll need this once there is a subsequent instruction examined. */
486// OBSOLETE next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn1, &insn2);
487// OBSOLETE #endif
488// OBSOLETE }
489// OBSOLETE
490// OBSOLETE return (ip);
491// OBSOLETE }
492// OBSOLETE
493// OBSOLETE /* Given an ip value corresponding to the start of a function,
494// OBSOLETE return the ip of the first instruction after the function
495// OBSOLETE prologue. */
496// OBSOLETE
497// OBSOLETE CORE_ADDR
498// OBSOLETE i960_skip_prologue (CORE_ADDR ip)
499// OBSOLETE {
500// OBSOLETE struct frame_saved_regs saved_regs_dummy;
501// OBSOLETE struct symtab_and_line sal;
502// OBSOLETE CORE_ADDR limit;
503// OBSOLETE
504// OBSOLETE sal = find_pc_line (ip, 0);
505// OBSOLETE limit = (sal.end) ? sal.end : 0xffffffff;
506// OBSOLETE
507// OBSOLETE return (examine_prologue (ip, limit, (CORE_ADDR) 0, &saved_regs_dummy));
508// OBSOLETE }
509// OBSOLETE
510// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs,
511// OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO.
512// OBSOLETE This includes special registers such as pc and fp saved in special
513// OBSOLETE ways in the stack frame. sp is even more special:
514// OBSOLETE the address we return for it IS the sp for the next frame.
515// OBSOLETE
516// OBSOLETE We cache the result of doing this in the frame_obstack, since it is
517// OBSOLETE fairly expensive. */
518// OBSOLETE
519// OBSOLETE void
520// OBSOLETE frame_find_saved_regs (struct frame_info *fi, struct frame_saved_regs *fsr)
521// OBSOLETE {
522// OBSOLETE register CORE_ADDR next_addr;
523// OBSOLETE register CORE_ADDR *saved_regs;
524// OBSOLETE register int regnum;
525// OBSOLETE register struct frame_saved_regs *cache_fsr;
526// OBSOLETE CORE_ADDR ip;
527// OBSOLETE struct symtab_and_line sal;
528// OBSOLETE CORE_ADDR limit;
529// OBSOLETE
530// OBSOLETE if (!fi->fsr)
531// OBSOLETE {
532// OBSOLETE cache_fsr = (struct frame_saved_regs *)
533// OBSOLETE frame_obstack_alloc (sizeof (struct frame_saved_regs));
534// OBSOLETE memset (cache_fsr, '\0', sizeof (struct frame_saved_regs));
535// OBSOLETE fi->fsr = cache_fsr;
536// OBSOLETE
537// OBSOLETE /* Find the start and end of the function prologue. If the PC
538// OBSOLETE is in the function prologue, we only consider the part that
539// OBSOLETE has executed already. */
540// OBSOLETE
541// OBSOLETE ip = get_pc_function_start (fi->pc);
542// OBSOLETE sal = find_pc_line (ip, 0);
543// OBSOLETE limit = (sal.end && sal.end < fi->pc) ? sal.end : fi->pc;
544// OBSOLETE
545// OBSOLETE examine_prologue (ip, limit, fi->frame, cache_fsr);
546// OBSOLETE
547// OBSOLETE /* Record the addresses at which the local registers are saved.
548// OBSOLETE Strictly speaking, we should only do this for non-leaf procedures,
549// OBSOLETE but no one will ever look at these values if it is a leaf procedure,
550// OBSOLETE since local registers are always caller-saved. */
551// OBSOLETE
552// OBSOLETE next_addr = (CORE_ADDR) fi->frame;
553// OBSOLETE saved_regs = cache_fsr->regs;
554// OBSOLETE for (regnum = R0_REGNUM; regnum <= R15_REGNUM; regnum++)
555// OBSOLETE {
556// OBSOLETE *saved_regs++ = next_addr;
557// OBSOLETE next_addr += 4;
558// OBSOLETE }
559// OBSOLETE
560// OBSOLETE cache_fsr->regs[FP_REGNUM] = cache_fsr->regs[PFP_REGNUM];
561// OBSOLETE }
562// OBSOLETE
563// OBSOLETE *fsr = *fi->fsr;
564// OBSOLETE
565// OBSOLETE /* Fetch the value of the sp from memory every time, since it
566// OBSOLETE is conceivable that it has changed since the cache was flushed.
567// OBSOLETE This unfortunately undoes much of the savings from caching the
568// OBSOLETE saved register values. I suggest adding an argument to
569// OBSOLETE get_frame_saved_regs () specifying the register number we're
570// OBSOLETE interested in (or -1 for all registers). This would be passed
571// OBSOLETE through to FRAME_FIND_SAVED_REGS (), permitting more efficient
572// OBSOLETE computation of saved register addresses (e.g., on the i960,
573// OBSOLETE we don't have to examine the prologue to find local registers).
574// OBSOLETE -- markf@wrs.com
575// OBSOLETE FIXME, we don't need to refetch this, since the cache is cleared
576// OBSOLETE every time the child process is restarted. If GDB itself
577// OBSOLETE modifies SP, it has to clear the cache by hand (does it?). -gnu */
578// OBSOLETE
579// OBSOLETE fsr->regs[SP_REGNUM] = read_memory_integer (fsr->regs[SP_REGNUM], 4);
580// OBSOLETE }
581// OBSOLETE
582// OBSOLETE /* Return the address of the argument block for the frame
583// OBSOLETE described by FI. Returns 0 if the address is unknown. */
584// OBSOLETE
585// OBSOLETE CORE_ADDR
586// OBSOLETE frame_args_address (struct frame_info *fi, int must_be_correct)
587// OBSOLETE {
588// OBSOLETE struct frame_saved_regs fsr;
589// OBSOLETE CORE_ADDR ap;
590// OBSOLETE
591// OBSOLETE /* If g14 was saved in the frame by the function prologue code, return
592// OBSOLETE the saved value. If the frame is current and we are being sloppy,
593// OBSOLETE return the value of g14. Otherwise, return zero. */
594// OBSOLETE
595// OBSOLETE get_frame_saved_regs (fi, &fsr);
596// OBSOLETE if (fsr.regs[G14_REGNUM])
597// OBSOLETE ap = read_memory_integer (fsr.regs[G14_REGNUM], 4);
598// OBSOLETE else
599// OBSOLETE {
600// OBSOLETE if (must_be_correct)
601// OBSOLETE return 0; /* Don't cache this result */
602// OBSOLETE if (get_next_frame (fi))
603// OBSOLETE ap = 0;
604// OBSOLETE else
605// OBSOLETE ap = read_register (G14_REGNUM);
606// OBSOLETE if (ap == 0)
607// OBSOLETE ap = fi->frame;
608// OBSOLETE }
609// OBSOLETE fi->arg_pointer = ap; /* Cache it for next time */
610// OBSOLETE return ap;
611// OBSOLETE }
612// OBSOLETE
613// OBSOLETE /* Return the address of the return struct for the frame
614// OBSOLETE described by FI. Returns 0 if the address is unknown. */
615// OBSOLETE
616// OBSOLETE CORE_ADDR
617// OBSOLETE frame_struct_result_address (struct frame_info *fi)
618// OBSOLETE {
619// OBSOLETE struct frame_saved_regs fsr;
620// OBSOLETE CORE_ADDR ap;
621// OBSOLETE
622// OBSOLETE /* If the frame is non-current, check to see if g14 was saved in the
623// OBSOLETE frame by the function prologue code; return the saved value if so,
624// OBSOLETE zero otherwise. If the frame is current, return the value of g14.
625// OBSOLETE
626// OBSOLETE FIXME, shouldn't this use the saved value as long as we are past
627// OBSOLETE the function prologue, and only use the current value if we have
628// OBSOLETE no saved value and are at TOS? -- gnu@cygnus.com */
629// OBSOLETE
630// OBSOLETE if (get_next_frame (fi))
631// OBSOLETE {
632// OBSOLETE get_frame_saved_regs (fi, &fsr);
633// OBSOLETE if (fsr.regs[G13_REGNUM])
634// OBSOLETE ap = read_memory_integer (fsr.regs[G13_REGNUM], 4);
635// OBSOLETE else
636// OBSOLETE ap = 0;
637// OBSOLETE }
638// OBSOLETE else
639// OBSOLETE ap = read_register (G13_REGNUM);
640// OBSOLETE
641// OBSOLETE return ap;
642// OBSOLETE }
643// OBSOLETE
644// OBSOLETE /* Return address to which the currently executing leafproc will return,
645// OBSOLETE or 0 if IP, the value of the instruction pointer from the currently
646// OBSOLETE executing function, is not in a leafproc (or if we can't tell if it
647// OBSOLETE is).
648// OBSOLETE
649// OBSOLETE Do this by finding the starting address of the routine in which IP lies.
650// OBSOLETE If the instruction there is "mov g14, gx" (where x is in [0,7]), this
651// OBSOLETE is a leafproc and the return address is in register gx. Well, this is
652// OBSOLETE true unless the return address points at a RET instruction in the current
653// OBSOLETE procedure, which indicates that we have a 'dual entry' routine that
654// OBSOLETE has been entered through the CALL entry point. */
655// OBSOLETE
656// OBSOLETE CORE_ADDR
657// OBSOLETE leafproc_return (CORE_ADDR ip)
658// OBSOLETE {
659// OBSOLETE register struct minimal_symbol *msymbol;
660// OBSOLETE char *p;
661// OBSOLETE int dst;
662// OBSOLETE unsigned int insn1, insn2;
663// OBSOLETE CORE_ADDR return_addr;
664// OBSOLETE
665// OBSOLETE if ((msymbol = lookup_minimal_symbol_by_pc (ip)) != NULL)
666// OBSOLETE {
667// OBSOLETE if ((p = strchr (SYMBOL_NAME (msymbol), '.')) && STREQ (p, ".lf"))
668// OBSOLETE {
669// OBSOLETE if (next_insn (SYMBOL_VALUE_ADDRESS (msymbol), &insn1, &insn2)
670// OBSOLETE && (insn1 & 0xff87ffff) == 0x5c80161e /* mov g14, gx */
671// OBSOLETE && (dst = REG_SRCDST (insn1)) <= G0_REGNUM + 7)
672// OBSOLETE {
673// OBSOLETE /* Get the return address. If the "mov g14, gx"
674// OBSOLETE instruction hasn't been executed yet, read
675// OBSOLETE the return address from g14; otherwise, read it
676// OBSOLETE from the register into which g14 was moved. */
677// OBSOLETE
678// OBSOLETE return_addr =
679// OBSOLETE read_register ((ip == SYMBOL_VALUE_ADDRESS (msymbol))
680// OBSOLETE ? G14_REGNUM : dst);
681// OBSOLETE
682// OBSOLETE /* We know we are in a leaf procedure, but we don't know
683// OBSOLETE whether the caller actually did a "bal" to the ".lf"
684// OBSOLETE entry point, or a normal "call" to the non-leaf entry
685// OBSOLETE point one instruction before. In the latter case, the
686// OBSOLETE return address will be the address of a "ret"
687// OBSOLETE instruction within the procedure itself. We test for
688// OBSOLETE this below. */
689// OBSOLETE
690// OBSOLETE if (!next_insn (return_addr, &insn1, &insn2)
691// OBSOLETE || (insn1 & 0xff000000) != 0xa000000 /* ret */
692// OBSOLETE || lookup_minimal_symbol_by_pc (return_addr) != msymbol)
693// OBSOLETE return (return_addr);
694// OBSOLETE }
695// OBSOLETE }
696// OBSOLETE }
697// OBSOLETE
698// OBSOLETE return (0);
699// OBSOLETE }
700// OBSOLETE
701// OBSOLETE /* Immediately after a function call, return the saved pc.
702// OBSOLETE Can't go through the frames for this because on some machines
703// OBSOLETE the new frame is not set up until the new function executes
704// OBSOLETE some instructions.
705// OBSOLETE On the i960, the frame *is* set up immediately after the call,
706// OBSOLETE unless the function is a leaf procedure. */
707// OBSOLETE
708// OBSOLETE CORE_ADDR
709// OBSOLETE saved_pc_after_call (struct frame_info *frame)
710// OBSOLETE {
711// OBSOLETE CORE_ADDR saved_pc;
712// OBSOLETE
713// OBSOLETE saved_pc = leafproc_return (get_frame_pc (frame));
714// OBSOLETE if (!saved_pc)
715// OBSOLETE saved_pc = FRAME_SAVED_PC (frame);
716// OBSOLETE
717// OBSOLETE return saved_pc;
718// OBSOLETE }
719// OBSOLETE
720// OBSOLETE /* Discard from the stack the innermost frame,
721// OBSOLETE restoring all saved registers. */
722// OBSOLETE
723// OBSOLETE void
724// OBSOLETE i960_pop_frame (void)
725// OBSOLETE {
726// OBSOLETE register struct frame_info *current_fi, *prev_fi;
727// OBSOLETE register int i;
728// OBSOLETE CORE_ADDR save_addr;
729// OBSOLETE CORE_ADDR leaf_return_addr;
730// OBSOLETE struct frame_saved_regs fsr;
731// OBSOLETE char local_regs_buf[16 * 4];
732// OBSOLETE
733// OBSOLETE current_fi = get_current_frame ();
734// OBSOLETE
735// OBSOLETE /* First, undo what the hardware does when we return.
736// OBSOLETE If this is a non-leaf procedure, restore local registers from
737// OBSOLETE the save area in the calling frame. Otherwise, load the return
738// OBSOLETE address obtained from leafproc_return () into the rip. */
739// OBSOLETE
740// OBSOLETE leaf_return_addr = leafproc_return (current_fi->pc);
741// OBSOLETE if (!leaf_return_addr)
742// OBSOLETE {
743// OBSOLETE /* Non-leaf procedure. Restore local registers, incl IP. */
744// OBSOLETE prev_fi = get_prev_frame (current_fi);
745// OBSOLETE read_memory (prev_fi->frame, local_regs_buf, sizeof (local_regs_buf));
746// OBSOLETE write_register_bytes (REGISTER_BYTE (R0_REGNUM), local_regs_buf,
747// OBSOLETE sizeof (local_regs_buf));
748// OBSOLETE
749// OBSOLETE /* Restore frame pointer. */
750// OBSOLETE write_register (FP_REGNUM, prev_fi->frame);
751// OBSOLETE }
752// OBSOLETE else
753// OBSOLETE {
754// OBSOLETE /* Leaf procedure. Just restore the return address into the IP. */
755// OBSOLETE write_register (RIP_REGNUM, leaf_return_addr);
756// OBSOLETE }
757// OBSOLETE
758// OBSOLETE /* Now restore any global regs that the current function had saved. */
759// OBSOLETE get_frame_saved_regs (current_fi, &fsr);
760// OBSOLETE for (i = G0_REGNUM; i < G14_REGNUM; i++)
761// OBSOLETE {
762// OBSOLETE save_addr = fsr.regs[i];
763// OBSOLETE if (save_addr != 0)
764// OBSOLETE write_register (i, read_memory_integer (save_addr, 4));
765// OBSOLETE }
766// OBSOLETE
767// OBSOLETE /* Flush the frame cache, create a frame for the new innermost frame,
768// OBSOLETE and make it the current frame. */
769// OBSOLETE
770// OBSOLETE flush_cached_frames ();
771// OBSOLETE }
772// OBSOLETE
773// OBSOLETE /* Given a 960 stop code (fault or trace), return the signal which
774// OBSOLETE corresponds. */
775// OBSOLETE
776// OBSOLETE enum target_signal
777// OBSOLETE i960_fault_to_signal (int fault)
778// OBSOLETE {
779// OBSOLETE switch (fault)
780// OBSOLETE {
781// OBSOLETE case 0:
782// OBSOLETE return TARGET_SIGNAL_BUS; /* parallel fault */
783// OBSOLETE case 1:
784// OBSOLETE return TARGET_SIGNAL_UNKNOWN;
785// OBSOLETE case 2:
786// OBSOLETE return TARGET_SIGNAL_ILL; /* operation fault */
787// OBSOLETE case 3:
788// OBSOLETE return TARGET_SIGNAL_FPE; /* arithmetic fault */
789// OBSOLETE case 4:
790// OBSOLETE return TARGET_SIGNAL_FPE; /* floating point fault */
791// OBSOLETE
792// OBSOLETE /* constraint fault. This appears not to distinguish between
793// OBSOLETE a range constraint fault (which should be SIGFPE) and a privileged
794// OBSOLETE fault (which should be SIGILL). */
795// OBSOLETE case 5:
796// OBSOLETE return TARGET_SIGNAL_ILL;
797// OBSOLETE
798// OBSOLETE case 6:
799// OBSOLETE return TARGET_SIGNAL_SEGV; /* virtual memory fault */
800// OBSOLETE
801// OBSOLETE /* protection fault. This is for an out-of-range argument to
802// OBSOLETE "calls". I guess it also could be SIGILL. */
803// OBSOLETE case 7:
804// OBSOLETE return TARGET_SIGNAL_SEGV;
805// OBSOLETE
806// OBSOLETE case 8:
807// OBSOLETE return TARGET_SIGNAL_BUS; /* machine fault */
808// OBSOLETE case 9:
809// OBSOLETE return TARGET_SIGNAL_BUS; /* structural fault */
810// OBSOLETE case 0xa:
811// OBSOLETE return TARGET_SIGNAL_ILL; /* type fault */
812// OBSOLETE case 0xb:
813// OBSOLETE return TARGET_SIGNAL_UNKNOWN; /* reserved fault */
814// OBSOLETE case 0xc:
815// OBSOLETE return TARGET_SIGNAL_BUS; /* process fault */
816// OBSOLETE case 0xd:
817// OBSOLETE return TARGET_SIGNAL_SEGV; /* descriptor fault */
818// OBSOLETE case 0xe:
819// OBSOLETE return TARGET_SIGNAL_BUS; /* event fault */
820// OBSOLETE case 0xf:
821// OBSOLETE return TARGET_SIGNAL_UNKNOWN; /* reserved fault */
822// OBSOLETE case 0x10:
823// OBSOLETE return TARGET_SIGNAL_TRAP; /* single-step trace */
824// OBSOLETE case 0x11:
825// OBSOLETE return TARGET_SIGNAL_TRAP; /* branch trace */
826// OBSOLETE case 0x12:
827// OBSOLETE return TARGET_SIGNAL_TRAP; /* call trace */
828// OBSOLETE case 0x13:
829// OBSOLETE return TARGET_SIGNAL_TRAP; /* return trace */
830// OBSOLETE case 0x14:
831// OBSOLETE return TARGET_SIGNAL_TRAP; /* pre-return trace */
832// OBSOLETE case 0x15:
833// OBSOLETE return TARGET_SIGNAL_TRAP; /* supervisor call trace */
834// OBSOLETE case 0x16:
835// OBSOLETE return TARGET_SIGNAL_TRAP; /* breakpoint trace */
836// OBSOLETE default:
837// OBSOLETE return TARGET_SIGNAL_UNKNOWN;
838// OBSOLETE }
839// OBSOLETE }
840// OBSOLETE
841// OBSOLETE /****************************************/
842// OBSOLETE /* MEM format */
843// OBSOLETE /****************************************/
844// OBSOLETE
845// OBSOLETE struct tabent
846// OBSOLETE {
847// OBSOLETE char *name;
848// OBSOLETE char numops;
849// OBSOLETE };
850// OBSOLETE
851// OBSOLETE /* Return instruction length, either 4 or 8. When NOPRINT is non-zero
852// OBSOLETE (TRUE), don't output any text. (Actually, as implemented, if NOPRINT
853// OBSOLETE is 0, abort() is called.) */
854// OBSOLETE
855// OBSOLETE static int
856// OBSOLETE mem (unsigned long memaddr, unsigned long word1, unsigned long word2,
857// OBSOLETE int noprint)
858// OBSOLETE {
859// OBSOLETE int i, j;
860// OBSOLETE int len;
861// OBSOLETE int mode;
862// OBSOLETE int offset;
863// OBSOLETE const char *reg1, *reg2, *reg3;
864// OBSOLETE
865// OBSOLETE /* This lookup table is too sparse to make it worth typing in, but not
866// OBSOLETE * so large as to make a sparse array necessary. We allocate the
867// OBSOLETE * table at runtime, initialize all entries to empty, and copy the
868// OBSOLETE * real ones in from an initialization table.
869// OBSOLETE *
870// OBSOLETE * NOTE: In this table, the meaning of 'numops' is:
871// OBSOLETE * 1: single operand
872// OBSOLETE * 2: 2 operands, load instruction
873// OBSOLETE * -2: 2 operands, store instruction
874// OBSOLETE */
875// OBSOLETE static struct tabent *mem_tab = NULL;
876// OBSOLETE /* Opcodes of 0x8X, 9X, aX, bX, and cX must be in the table. */
877// OBSOLETE #define MEM_MIN 0x80
878// OBSOLETE #define MEM_MAX 0xcf
879// OBSOLETE #define MEM_SIZ ((MEM_MAX-MEM_MIN+1) * sizeof(struct tabent))
880// OBSOLETE
881// OBSOLETE static struct
882// OBSOLETE {
883// OBSOLETE int opcode;
884// OBSOLETE char *name;
885// OBSOLETE char numops;
886// OBSOLETE }
887// OBSOLETE mem_init[] =
888// OBSOLETE {
889// OBSOLETE 0x80, "ldob", 2,
890// OBSOLETE 0x82, "stob", -2,
891// OBSOLETE 0x84, "bx", 1,
892// OBSOLETE 0x85, "balx", 2,
893// OBSOLETE 0x86, "callx", 1,
894// OBSOLETE 0x88, "ldos", 2,
895// OBSOLETE 0x8a, "stos", -2,
896// OBSOLETE 0x8c, "lda", 2,
897// OBSOLETE 0x90, "ld", 2,
898// OBSOLETE 0x92, "st", -2,
899// OBSOLETE 0x98, "ldl", 2,
900// OBSOLETE 0x9a, "stl", -2,
901// OBSOLETE 0xa0, "ldt", 2,
902// OBSOLETE 0xa2, "stt", -2,
903// OBSOLETE 0xb0, "ldq", 2,
904// OBSOLETE 0xb2, "stq", -2,
905// OBSOLETE 0xc0, "ldib", 2,
906// OBSOLETE 0xc2, "stib", -2,
907// OBSOLETE 0xc8, "ldis", 2,
908// OBSOLETE 0xca, "stis", -2,
909// OBSOLETE 0, NULL, 0
910// OBSOLETE };
911// OBSOLETE
912// OBSOLETE if (mem_tab == NULL)
913// OBSOLETE {
914// OBSOLETE mem_tab = (struct tabent *) xmalloc (MEM_SIZ);
915// OBSOLETE memset (mem_tab, '\0', MEM_SIZ);
916// OBSOLETE for (i = 0; mem_init[i].opcode != 0; i++)
917// OBSOLETE {
918// OBSOLETE j = mem_init[i].opcode - MEM_MIN;
919// OBSOLETE mem_tab[j].name = mem_init[i].name;
920// OBSOLETE mem_tab[j].numops = mem_init[i].numops;
921// OBSOLETE }
922// OBSOLETE }
923// OBSOLETE
924// OBSOLETE i = ((word1 >> 24) & 0xff) - MEM_MIN;
925// OBSOLETE mode = (word1 >> 10) & 0xf;
926// OBSOLETE
927// OBSOLETE if ((mem_tab[i].name != NULL) /* Valid instruction */
928// OBSOLETE && ((mode == 5) || (mode >= 12)))
929// OBSOLETE { /* With 32-bit displacement */
930// OBSOLETE len = 8;
931// OBSOLETE }
932// OBSOLETE else
933// OBSOLETE {
934// OBSOLETE len = 4;
935// OBSOLETE }
936// OBSOLETE
937// OBSOLETE if (noprint)
938// OBSOLETE {
939// OBSOLETE return len;
940// OBSOLETE }
941// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check");
942// OBSOLETE }
943// OBSOLETE
944// OBSOLETE /* Read the i960 instruction at 'memaddr' and return the address of
945// OBSOLETE the next instruction after that, or 0 if 'memaddr' is not the
946// OBSOLETE address of a valid instruction. The first word of the instruction
947// OBSOLETE is stored at 'pword1', and the second word, if any, is stored at
948// OBSOLETE 'pword2'. */
949// OBSOLETE
950// OBSOLETE static CORE_ADDR
951// OBSOLETE next_insn (CORE_ADDR memaddr, unsigned int *pword1, unsigned int *pword2)
952// OBSOLETE {
953// OBSOLETE int len;
954// OBSOLETE char buf[8];
955// OBSOLETE
956// OBSOLETE /* Read the two (potential) words of the instruction at once,
957// OBSOLETE to eliminate the overhead of two calls to read_memory ().
958// OBSOLETE FIXME: Loses if the first one is readable but the second is not
959// OBSOLETE (e.g. last word of the segment). */
960// OBSOLETE
961// OBSOLETE read_memory (memaddr, buf, 8);
962// OBSOLETE *pword1 = extract_unsigned_integer (buf, 4);
963// OBSOLETE *pword2 = extract_unsigned_integer (buf + 4, 4);
964// OBSOLETE
965// OBSOLETE /* Divide instruction set into classes based on high 4 bits of opcode */
966// OBSOLETE
967// OBSOLETE switch ((*pword1 >> 28) & 0xf)
968// OBSOLETE {
969// OBSOLETE case 0x0:
970// OBSOLETE case 0x1: /* ctrl */
971// OBSOLETE
972// OBSOLETE case 0x2:
973// OBSOLETE case 0x3: /* cobr */
974// OBSOLETE
975// OBSOLETE case 0x5:
976// OBSOLETE case 0x6:
977// OBSOLETE case 0x7: /* reg */
978// OBSOLETE len = 4;
979// OBSOLETE break;
980// OBSOLETE
981// OBSOLETE case 0x8:
982// OBSOLETE case 0x9:
983// OBSOLETE case 0xa:
984// OBSOLETE case 0xb:
985// OBSOLETE case 0xc:
986// OBSOLETE len = mem (memaddr, *pword1, *pword2, 1);
987// OBSOLETE break;
988// OBSOLETE
989// OBSOLETE default: /* invalid instruction */
990// OBSOLETE len = 0;
991// OBSOLETE break;
992// OBSOLETE }
993// OBSOLETE
994// OBSOLETE if (len)
995// OBSOLETE return memaddr + len;
996// OBSOLETE else
997// OBSOLETE return 0;
998// OBSOLETE }
999// OBSOLETE
1000// OBSOLETE /* 'start_frame' is a variable in the MON960 runtime startup routine
1001// OBSOLETE that contains the frame pointer of the 'start' routine (the routine
1002// OBSOLETE that calls 'main'). By reading its contents out of remote memory,
1003// OBSOLETE we can tell where the frame chain ends: backtraces should halt before
1004// OBSOLETE they display this frame. */
1005// OBSOLETE
1006// OBSOLETE int
1007// OBSOLETE mon960_frame_chain_valid (CORE_ADDR chain, struct frame_info *curframe)
1008// OBSOLETE {
1009// OBSOLETE struct symbol *sym;
1010// OBSOLETE struct minimal_symbol *msymbol;
1011// OBSOLETE
1012// OBSOLETE /* crtmon960.o is an assembler module that is assumed to be linked
1013// OBSOLETE * first in an i80960 executable. It contains the true entry point;
1014// OBSOLETE * it performs startup up initialization and then calls 'main'.
1015// OBSOLETE *
1016// OBSOLETE * 'sf' is the name of a variable in crtmon960.o that is set
1017// OBSOLETE * during startup to the address of the first frame.
1018// OBSOLETE *
1019// OBSOLETE * 'a' is the address of that variable in 80960 memory.
1020// OBSOLETE */
1021// OBSOLETE static char sf[] = "start_frame";
1022// OBSOLETE CORE_ADDR a;
1023// OBSOLETE
1024// OBSOLETE
1025// OBSOLETE chain &= ~0x3f; /* Zero low 6 bits because previous frame pointers
1026// OBSOLETE contain return status info in them. */
1027// OBSOLETE if (chain == 0)
1028// OBSOLETE {
1029// OBSOLETE return 0;
1030// OBSOLETE }
1031// OBSOLETE
1032// OBSOLETE sym = lookup_symbol (sf, 0, VAR_NAMESPACE, (int *) NULL,
1033// OBSOLETE (struct symtab **) NULL);
1034// OBSOLETE if (sym != 0)
1035// OBSOLETE {
1036// OBSOLETE a = SYMBOL_VALUE (sym);
1037// OBSOLETE }
1038// OBSOLETE else
1039// OBSOLETE {
1040// OBSOLETE msymbol = lookup_minimal_symbol (sf, NULL, NULL);
1041// OBSOLETE if (msymbol == NULL)
1042// OBSOLETE return 0;
1043// OBSOLETE a = SYMBOL_VALUE_ADDRESS (msymbol);
1044// OBSOLETE }
1045// OBSOLETE
1046// OBSOLETE return (chain != read_memory_integer (a, 4));
1047// OBSOLETE }
1048// OBSOLETE
1049// OBSOLETE
1050// OBSOLETE void
1051// OBSOLETE _initialize_i960_tdep (void)
1052// OBSOLETE {
1053// OBSOLETE check_host ();
1054// OBSOLETE
1055// OBSOLETE tm_print_insn = print_insn_i960;
1056// OBSOLETE }
This page took 0.072624 seconds and 4 git commands to generate.