1 |
106 |
markom |
/* Parameters for a Sun 386i target machine, for GDB, the GNU debugger.
|
2 |
|
|
Copyright 1986, 1987, 1991, 1992, 1993 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., 59 Temple Place - Suite 330,
|
19 |
|
|
Boston, MA 02111-1307, USA. */
|
20 |
|
|
|
21 |
|
|
#if !defined (TM_SUN386_H)
|
22 |
|
|
#define TM_SUN386_H 1
|
23 |
|
|
|
24 |
|
|
#include "i386/tm-i386.h"
|
25 |
|
|
|
26 |
|
|
#ifndef sun386
|
27 |
|
|
#define sun386
|
28 |
|
|
#endif
|
29 |
|
|
#define SUNOS4
|
30 |
|
|
#define USE_MACHINE_REG_H
|
31 |
|
|
|
32 |
|
|
/* Perhaps some day this will work even without the following #define */
|
33 |
|
|
#define COFF_ENCAPSULATE
|
34 |
|
|
|
35 |
|
|
#ifdef COFF_ENCAPSULATE
|
36 |
|
|
/* Avoid conflicts between our include files and <sys/exec.h>
|
37 |
|
|
(maybe not needed anymore). */
|
38 |
|
|
#define _EXEC_
|
39 |
|
|
#endif
|
40 |
|
|
|
41 |
|
|
/* sun386 ptrace seems unable to change the frame pointer */
|
42 |
|
|
#define PTRACE_FP_BUG
|
43 |
|
|
|
44 |
|
|
/* Address of end of stack space. */
|
45 |
|
|
|
46 |
|
|
#define STACK_END_ADDR 0xfc000000
|
47 |
|
|
|
48 |
|
|
/* Number of machine registers */
|
49 |
|
|
|
50 |
|
|
#undef NUM_REGS
|
51 |
|
|
#define NUM_REGS 35
|
52 |
|
|
|
53 |
|
|
/* Initializer for an array of names of registers. There should be NUM_REGS
|
54 |
|
|
strings in this initializer. The order of the first 8 registers must match
|
55 |
|
|
the compiler's numbering scheme (which is the same as the 386 scheme) also,
|
56 |
|
|
this table must match regmap in i386-pinsn.c. */
|
57 |
|
|
|
58 |
|
|
#undef REGISTER_NAMES
|
59 |
|
|
#define REGISTER_NAMES { "gs", "fs", "es", "ds", \
|
60 |
|
|
"edi", "esi", "ebp", "esp", \
|
61 |
|
|
"ebx", "edx", "ecx", "eax", \
|
62 |
|
|
"retaddr", "trapnum", "errcode", "ip", \
|
63 |
|
|
"cs", "ps", "sp", "ss", \
|
64 |
|
|
"fst0", "fst1", "fst2", "fst3", \
|
65 |
|
|
"fst4", "fst5", "fst6", "fst7", \
|
66 |
|
|
"fctrl", "fstat", "ftag", "fip", \
|
67 |
|
|
"fcs", "fopoff", "fopsel" \
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
/* Register numbers of various important registers.
|
71 |
|
|
Note that some of these values are "real" register numbers,
|
72 |
|
|
and correspond to the general registers of the machine,
|
73 |
|
|
and some are "phony" register numbers which are too large
|
74 |
|
|
to be actual register numbers as far as the user is concerned
|
75 |
|
|
but do serve to get the desired values when passed to read_register. */
|
76 |
|
|
|
77 |
|
|
#undef FP_REGNUM
|
78 |
|
|
#define FP_REGNUM 6 /* (ebp) Contains address of executing stack frame */
|
79 |
|
|
#undef SP_REGNUM
|
80 |
|
|
#define SP_REGNUM 18 /* (usp) Contains address of top of stack */
|
81 |
|
|
#undef PS_REGNUM
|
82 |
|
|
#define PS_REGNUM 17 /* (ps) Contains processor status */
|
83 |
|
|
#undef PC_REGNUM
|
84 |
|
|
#define PC_REGNUM 15 /* (eip) Contains program counter */
|
85 |
|
|
#undef FP0_REGNUM
|
86 |
|
|
#define FP0_REGNUM 20 /* Floating point register 0 */
|
87 |
|
|
#undef FPC_REGNUM
|
88 |
|
|
#define FPC_REGNUM 28 /* 80387 control register */
|
89 |
|
|
|
90 |
|
|
/* Total amount of space needed to store our copies of the machine's
|
91 |
|
|
register state, the array `registers'. */
|
92 |
|
|
|
93 |
|
|
#undef REGISTER_BYTES
|
94 |
|
|
#define REGISTER_BYTES (20*4+8*10+7*4)
|
95 |
|
|
|
96 |
|
|
/* Index within `registers' of the first byte of the space for
|
97 |
|
|
register N. */
|
98 |
|
|
|
99 |
|
|
#undef REGISTER_BYTE
|
100 |
|
|
#define REGISTER_BYTE(N) \
|
101 |
|
|
((N) >= FPC_REGNUM ? (((N) - FPC_REGNUM) * 4) + 160 \
|
102 |
|
|
: (N) >= FP0_REGNUM ? (((N) - FP0_REGNUM) * 10) + 80 \
|
103 |
|
|
: (N) * 4)
|
104 |
|
|
|
105 |
|
|
/* Number of bytes of storage in the actual machine representation
|
106 |
|
|
for register N. */
|
107 |
|
|
|
108 |
|
|
#undef REGISTER_RAW_SIZE
|
109 |
|
|
#define REGISTER_RAW_SIZE(N) (((unsigned)((N) - FP0_REGNUM)) < 8 ? 10 : 4)
|
110 |
|
|
|
111 |
|
|
/* Number of bytes of storage in the program's representation
|
112 |
|
|
for register N. */
|
113 |
|
|
|
114 |
|
|
#undef REGISTER_VIRTUAL_SIZE
|
115 |
|
|
#define REGISTER_VIRTUAL_SIZE(N) (((unsigned)((N) - FP0_REGNUM)) < 8 ? 8 : 4)
|
116 |
|
|
|
117 |
|
|
/* Nonzero if register N requires conversion
|
118 |
|
|
from raw format to virtual format. */
|
119 |
|
|
|
120 |
|
|
#undef REGISTER_CONVERTIBLE
|
121 |
|
|
#define REGISTER_CONVERTIBLE(N) (((unsigned)((N) - FP0_REGNUM)) < 8)
|
122 |
|
|
|
123 |
|
|
/* Convert data from raw format for register REGNUM in buffer FROM
|
124 |
|
|
to virtual format with type TYPE in buffer TO. */
|
125 |
|
|
|
126 |
|
|
#undef REGISTER_CONVERT_TO_VIRTUAL
|
127 |
|
|
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
|
128 |
|
|
{ \
|
129 |
|
|
double val; \
|
130 |
|
|
i387_to_double ((FROM), (char *)&val); \
|
131 |
|
|
store_floating ((TO), TYPE_LENGTH (TYPE), val); \
|
132 |
|
|
}
|
133 |
|
|
extern void
|
134 |
|
|
i387_to_double PARAMS ((char *, char *));
|
135 |
|
|
|
136 |
|
|
/* Convert data from virtual format with type TYPE in buffer FROM
|
137 |
|
|
to raw format for register REGNUM in buffer TO. */
|
138 |
|
|
|
139 |
|
|
#undef REGISTER_CONVERT_TO_RAW
|
140 |
|
|
#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
|
141 |
|
|
{ \
|
142 |
|
|
double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
|
143 |
|
|
double_to_i387((char *)&val, (TO)); \
|
144 |
|
|
}
|
145 |
|
|
extern void
|
146 |
|
|
double_to_i387 PARAMS ((char *, char *));
|
147 |
|
|
|
148 |
|
|
/* Return the GDB type object for the "standard" data type
|
149 |
|
|
of data in register N. */
|
150 |
|
|
|
151 |
|
|
#undef REGISTER_VIRTUAL_TYPE
|
152 |
|
|
#define REGISTER_VIRTUAL_TYPE(N) \
|
153 |
|
|
(((unsigned)((N) - FP0_REGNUM)) < 8 ? builtin_type_double : builtin_type_int)
|
154 |
|
|
|
155 |
|
|
/* Extract from an array REGBUF containing the (raw) register state
|
156 |
|
|
a function return value of type TYPE, and copy that, in virtual format,
|
157 |
|
|
into VALBUF. */
|
158 |
|
|
|
159 |
|
|
#undef EXTRACT_RETURN_VALUE
|
160 |
|
|
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
|
161 |
|
|
memcpy (VALBUF, REGBUF + REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 11), TYPE_LENGTH (TYPE))
|
162 |
|
|
|
163 |
|
|
/* Write into appropriate registers a function return value
|
164 |
|
|
of type TYPE, given in virtual format. */
|
165 |
|
|
|
166 |
|
|
#undef STORE_RETURN_VALUE
|
167 |
|
|
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
|
168 |
|
|
write_register_bytes (REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 11), VALBUF, TYPE_LENGTH (TYPE))
|
169 |
|
|
|
170 |
|
|
/* Describe the pointer in each stack frame to the previous stack frame
|
171 |
|
|
(its caller). */
|
172 |
|
|
|
173 |
|
|
/* FRAME_CHAIN takes a frame's nominal address
|
174 |
|
|
and produces the frame's chain-pointer. */
|
175 |
|
|
|
176 |
|
|
#undef FRAME_CHAIN
|
177 |
|
|
#define FRAME_CHAIN(thisframe) \
|
178 |
|
|
(!inside_entry_file ((thisframe)->pc) ? \
|
179 |
|
|
read_memory_integer ((thisframe)->frame, 4) :\
|
180 |
|
|
0)
|
181 |
|
|
|
182 |
|
|
/* Define other aspects of the stack frame. */
|
183 |
|
|
|
184 |
|
|
/* A macro that tells us whether the function invocation represented
|
185 |
|
|
by FI does not have a frame on the stack associated with it. If it
|
186 |
|
|
does not, FRAMELESS is set to 1, else 0. */
|
187 |
|
|
|
188 |
|
|
#undef FRAMELESS_FUNCTION_INVOCATION
|
189 |
|
|
#define FRAMELESS_FUNCTION_INVOCATION(FI) \
|
190 |
|
|
(frameless_look_for_prologue (FI))
|
191 |
|
|
|
192 |
|
|
#undef FRAME_SAVED_PC
|
193 |
|
|
#define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4))
|
194 |
|
|
|
195 |
|
|
/* Insert the specified number of args and function address
|
196 |
|
|
into a call sequence of the above form stored at DUMMYNAME. */
|
197 |
|
|
|
198 |
|
|
#undef FIX_CALL_DUMMY
|
199 |
|
|
#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
|
200 |
|
|
{ \
|
201 |
|
|
*(int *)((char *)(dummyname) + 1) = (int)(fun) - (pc) - 5; \
|
202 |
|
|
}
|
203 |
|
|
|
204 |
|
|
#endif /* !defined (TM_SUN386_H) */
|