1 /* Parameters for targeting to a 3b1.
2 Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
20 #define BREAKPOINT { 0x4e, 0x41 }
21 /* Define this if the C compiler puts an underscore at the front
22 of external names before giving them to the linker. */
24 #define NAMES_HAVE_UNDERSCORE
26 /* Debugger information will be in COFF format. */
29 #define COFF_NO_LONG_FILE_NAMES
31 /* Address of end of stack space. */
33 #define STACK_END_ADDR 0x300000
36 /* Things needed for making the inferior call functions. */
38 /* Push an empty stack frame, to record the current PC, etc. */
40 #define PUSH_DUMMY_FRAME \
41 { register CORE_ADDR sp = read_register (SP_REGNUM);\
42 register int regnum; \
43 sp = push_word (sp, read_register (PC_REGNUM)); \
44 sp = push_word (sp, read_register (FP_REGNUM)); \
45 write_register (FP_REGNUM, sp); \
46 for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) \
47 sp = push_word (sp, read_register (regnum)); \
48 sp = push_word (sp, read_register (PS_REGNUM)); \
49 write_register (SP_REGNUM, sp); }
51 /* Discard from the stack the innermost frame, restoring all registers. */
54 { register FRAME frame = get_current_frame (); \
55 register CORE_ADDR fp; \
56 register int regnum; \
57 struct frame_saved_regs fsr; \
58 struct frame_info *fi; \
59 fi = get_frame_info (frame); \
61 get_frame_saved_regs (fi, &fsr); \
62 for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) \
63 if (fsr.regs[regnum]) \
64 write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); \
65 if (fsr.regs[PS_REGNUM]) \
66 write_register (PS_REGNUM, read_memory_integer (fsr.regs[PS_REGNUM], 4)); \
67 write_register (FP_REGNUM, read_memory_integer (fp, 4)); \
68 write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); \
69 write_register (SP_REGNUM, fp + 8); \
70 flush_cached_frames (); \
71 set_current_frame ( create_new_frame (read_register (FP_REGNUM),\
74 /* This sequence of words is the instructions
78 /..* The arguments are pushed at this point by GDB;
79 no code is needed in the dummy for this.
80 The CALL_DUMMY_START_OFFSET gives the position of
81 the following jsr instruction. *../
86 Note this is 24 bytes.
87 We actually start executing at the jsr, since the pushing of the
88 registers is done by PUSH_DUMMY_FRAME. If this were real code,
89 the arguments for the function called by the jsr would be pushed
90 between the moveml and the jsr, and we could allow it to execute through.
91 But the arguments have to be pushed by GDB after the PUSH_DUMMY_FRAME is done,
92 and we cannot allow the moveml to push the registers again lest they be
93 taken for the arguments. */
95 #define CALL_DUMMY {0x48e7fffc, 0x426742e7, 0x4eb93232, 0x3232dffc, 0x69696969, 0x4e4f4e71}
97 #define CALL_DUMMY_LENGTH 24
99 #define CALL_DUMMY_START_OFFSET 8
101 /* Insert the specified number of args and function address
102 into a call sequence of the above form stored at DUMMYNAME. */
104 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, type) \
105 { *(int *)((char *) dummyname + 16) = nargs * 4; \
106 *(int *)((char *) dummyname + 10) = fun; }