1 /* Parameters for a Sun 386i target machine, for GDB, the GNU debugger.
2 Copyright 1986, 1987, 1991, 1992, 1993 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., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 #if !defined (TM_SUN386_H)
24 #include "i386/tm-i386.h"
30 #define USE_MACHINE_REG_H
32 /* Perhaps some day this will work even without the following #define */
33 #define COFF_ENCAPSULATE
35 #ifdef COFF_ENCAPSULATE
36 /* Avoid conflicts between our include files and <sys/exec.h>
37 (maybe not needed anymore). */
41 /* sun386 ptrace seems unable to change the frame pointer */
44 /* Address of end of stack space. */
46 #define STACK_END_ADDR 0xfc000000
48 /* Number of machine registers */
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. */
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" \
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. */
78 #define FP_REGNUM 6 /* (ebp) Contains address of executing stack frame */
80 #define SP_REGNUM 18 /* (usp) Contains address of top of stack */
82 #define PS_REGNUM 17 /* (ps) Contains processor status */
84 #define PC_REGNUM 15 /* (eip) Contains program counter */
86 #define FP0_REGNUM 20 /* Floating point register 0 */
88 #define FPC_REGNUM 28 /* 80387 control register */
90 /* Total amount of space needed to store our copies of the machine's
91 register state, the array `registers'. */
94 #define REGISTER_BYTES (20*4+8*10+7*4)
96 /* Index within `registers' of the first byte of the space for
100 #define REGISTER_BYTE(N) \
101 ((N) >= FPC_REGNUM ? (((N) - FPC_REGNUM) * 4) + 160 \
102 : (N) >= FP0_REGNUM ? (((N) - FP0_REGNUM) * 10) + 80 \
105 /* Number of bytes of storage in the actual machine representation
108 #undef REGISTER_RAW_SIZE
109 #define REGISTER_RAW_SIZE(N) (((unsigned)((N) - FP0_REGNUM)) < 8 ? 10 : 4)
111 /* Number of bytes of storage in the program's representation
114 #undef REGISTER_VIRTUAL_SIZE
115 #define REGISTER_VIRTUAL_SIZE(N) (((unsigned)((N) - FP0_REGNUM)) < 8 ? 8 : 4)
117 /* Nonzero if register N requires conversion
118 from raw format to virtual format. */
120 #undef REGISTER_CONVERTIBLE
121 #define REGISTER_CONVERTIBLE(N) (((unsigned)((N) - FP0_REGNUM)) < 8)
123 /* Convert data from raw format for register REGNUM in buffer FROM
124 to virtual format with type TYPE in buffer TO. */
126 #undef REGISTER_CONVERT_TO_VIRTUAL
127 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
130 i387_to_double ((FROM), (char *)&val); \
131 store_floating ((TO), TYPE_LENGTH (TYPE), val); \
134 i387_to_double
PARAMS ((char *, char *));
136 /* Convert data from virtual format with type TYPE in buffer FROM
137 to raw format for register REGNUM in buffer TO. */
139 #undef REGISTER_CONVERT_TO_RAW
140 #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
142 double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
143 double_to_i387((char *)&val, (TO)); \
146 double_to_i387
PARAMS ((char *, char *));
148 /* Return the GDB type object for the "standard" data type
149 of data in register N. */
151 #undef REGISTER_VIRTUAL_TYPE
152 #define REGISTER_VIRTUAL_TYPE(N) \
153 (((unsigned)((N) - FP0_REGNUM)) < 8 ? builtin_type_double : builtin_type_int)
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,
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))
163 /* Write into appropriate registers a function return value
164 of type TYPE, given in virtual format. */
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))
170 /* Describe the pointer in each stack frame to the previous stack frame
173 /* FRAME_CHAIN takes a frame's nominal address
174 and produces the frame's chain-pointer. */
177 #define FRAME_CHAIN(thisframe) \
178 (!inside_entry_file ((thisframe)->pc) ? \
179 read_memory_integer ((thisframe)->frame, 4) :\
182 /* Define other aspects of the stack frame. */
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. */
188 #undef FRAMELESS_FUNCTION_INVOCATION
189 #define FRAMELESS_FUNCTION_INVOCATION(FI) \
190 (frameless_look_for_prologue (FI))
192 #undef FRAME_SAVED_PC
193 #define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4))
195 /* Insert the specified number of args and function address
196 into a call sequence of the above form stored at DUMMYNAME. */
198 #undef FIX_CALL_DUMMY
199 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
201 *(int *)((char *)(dummyname) + 1) = (int)(fun) - (pc) - 5; \
204 #endif /* !defined (TM_SUN386_H) */
This page took 0.032861 seconds and 4 git commands to generate.