1 /* Definitions to make GDB run on an Altos 3068 (m68k running SVR2)
2 Copyright (C) 1987,1989 Free Software Foundation, Inc.
4 This file is part of GDB.
6 GDB 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 1, or (at your option)
11 GDB 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 GDB; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20 /* Sequence of bytes for breakpoint instruction. */
22 #define BREAKPOINT {0x4e, 0x4e}
24 /* Define this if the C compiler puts an underscore at the front
25 of external names before giving them to the linker. */
27 #undef NAMES_HAVE_UNDERSCORE
29 /* Exec files and symbol tables are in COFF format */
32 #define COFF_NO_LONG_FILE_NAMES
34 /* Address of end of stack space. */
36 /*#define STACK_END_ADDR (0xffffff)*/
37 #define STACK_END_ADDR (0x1000000)
39 /* Amount PC must be decremented by after a breakpoint.
40 This is often the number of bytes in BREAKPOINT
42 On the Altos, the kernel resets the pc to the trap instr */
44 #define DECR_PC_AFTER_BREAK 0
47 /* Things needed for making the inferior call functions. */
49 /* Push an empty stack frame, to record the current PC, etc. */
51 #define PUSH_DUMMY_FRAME \
52 { register CORE_ADDR sp = read_register (SP_REGNUM); \
53 register int regnum; \
54 char raw_buffer[12]; \
55 sp = push_word (sp, read_register (PC_REGNUM)); \
56 sp = push_word (sp, read_register (FP_REGNUM)); \
57 write_register (FP_REGNUM, sp); \
58 for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--) \
59 { read_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12); \
60 sp = push_bytes (sp, raw_buffer, 12); } \
61 for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) \
62 sp = push_word (sp, read_register (regnum)); \
63 sp = push_word (sp, read_register (PS_REGNUM)); \
64 write_register (SP_REGNUM, sp); }
66 /* Discard from the stack the innermost frame,
67 restoring all saved registers. */
70 { register FRAME frame = get_current_frame (); \
71 register CORE_ADDR fp; \
72 register int regnum; \
73 struct frame_saved_regs fsr; \
74 struct frame_info *fi; \
75 char raw_buffer[12]; \
76 fi = get_frame_info (frame); \
78 get_frame_saved_regs (fi, &fsr); \
79 for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--) \
80 if (fsr.regs[regnum]) \
81 { read_memory (fsr.regs[regnum], raw_buffer, 12); \
82 write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12); }\
83 for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) \
84 if (fsr.regs[regnum]) \
85 write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); \
86 if (fsr.regs[PS_REGNUM]) \
87 write_register (PS_REGNUM, read_memory_integer (fsr.regs[PS_REGNUM], 4)); \
88 write_register (FP_REGNUM, read_memory_integer (fp, 4)); \
89 write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); \
90 write_register (SP_REGNUM, fp + 8); \
91 flush_cached_frames (); \
92 set_current_frame (create_new_frame (read_register (FP_REGNUM), \
95 /* This sequence of words is the instructions
100 /..* The arguments are pushed at this point by GDB;
101 no code is needed in the dummy for this.
102 The CALL_DUMMY_START_OFFSET gives the position of
103 the following jsr instruction. *../
108 Note this is 28 bytes.
109 We actually start executing at the jsr, since the pushing of the
110 registers is done by PUSH_DUMMY_FRAME. If this were real code,
111 the arguments for the function called by the jsr would be pushed
112 between the moveml and the jsr, and we could allow it to execute through.
113 But the arguments have to be pushed by GDB after the PUSH_DUMMY_FRAME is done,
114 and we cannot allow the moveml to push the registers again lest they be
115 taken for the arguments. */
117 #define CALL_DUMMY {0xf227e0ff, 0x48e7fffc, 0x426742e7, 0x4eb93232, 0x3232dffc, 0x69696969, 0x4e4e4e71}
119 #define CALL_DUMMY_LENGTH 28
121 #define CALL_DUMMY_START_OFFSET 12
123 /* Insert the specified number of args and function address
124 into a call sequence of the above form stored at DUMMYNAME. */
126 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
127 { *(int *)((char *) dummyname + 20) = nargs * 4; \
128 *(int *)((char *) dummyname + 14) = fun; }