Initial revision
[deliverable/binutils-gdb.git] / gdb / tm-altos.h
1 /* Definitions to make GDB run on an Altos 3068 (m68k running SVR2)
2 Copyright (C) 1987,1989 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
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.
10
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.
15
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. */
19
20 /* Sequence of bytes for breakpoint instruction. */
21
22 #define BREAKPOINT {0x4e, 0x4e}
23
24 /* Define this if the C compiler puts an underscore at the front
25 of external names before giving them to the linker. */
26
27 #undef NAMES_HAVE_UNDERSCORE
28
29 /* Exec files and symbol tables are in COFF format */
30
31 #define COFF_FORMAT
32 #define COFF_NO_LONG_FILE_NAMES
33
34 /* Address of end of stack space. */
35
36 /*#define STACK_END_ADDR (0xffffff)*/
37 #define STACK_END_ADDR (0x1000000)
38
39 /* Amount PC must be decremented by after a breakpoint.
40 This is often the number of bytes in BREAKPOINT
41 but not always.
42 On the Altos, the kernel resets the pc to the trap instr */
43
44 #define DECR_PC_AFTER_BREAK 0
45
46 \f
47 /* Things needed for making the inferior call functions. */
48
49 /* Push an empty stack frame, to record the current PC, etc. */
50
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); }
65
66 /* Discard from the stack the innermost frame,
67 restoring all saved registers. */
68
69 #define POP_FRAME \
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); \
77 fp = fi->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), \
93 read_pc ())); }
94
95 /* This sequence of words is the instructions
96 fmovem 0xff,-(sp)
97 moveml 0xfffc,-(sp)
98 clrw -(sp)
99 movew ccr,-(sp)
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. *../
104 jsr @#32323232
105 addl #69696969,sp
106 bpt
107 nop
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. */
116
117 #define CALL_DUMMY {0xf227e0ff, 0x48e7fffc, 0x426742e7, 0x4eb93232, 0x3232dffc, 0x69696969, 0x4e4e4e71}
118
119 #define CALL_DUMMY_LENGTH 28
120
121 #define CALL_DUMMY_START_OFFSET 12
122
123 /* Insert the specified number of args and function address
124 into a call sequence of the above form stored at DUMMYNAME. */
125
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; }
129 \f
130 #include "tm-68k.h"
This page took 0.031719 seconds and 4 git commands to generate.