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"
29 #define GDB_TARGET_IS_SUN386 1
31 #define USE_MACHINE_REG_H
33 /* Perhaps some day this will work even without the following #define */
34 #define COFF_ENCAPSULATE
36 #ifdef COFF_ENCAPSULATE
37 /* Avoid conflicts between our include files and <sys/exec.h>
38 (maybe not needed anymore). */
42 /* sun386 ptrace seems unable to change the frame pointer */
45 /* Address of end of stack space. */
47 #define STACK_END_ADDR 0xfc000000
49 /* Number of machine registers */
54 /* Initializer for an array of names of registers. There should be NUM_REGS
55 strings in this initializer. The order of the first 8 registers must match
56 the compiler's numbering scheme (which is the same as the 386 scheme) also,
57 this table must match regmap in i386-pinsn.c. */
60 #define REGISTER_NAMES { "gs", "fs", "es", "ds", \
61 "edi", "esi", "ebp", "esp", \
62 "ebx", "edx", "ecx", "eax", \
63 "retaddr", "trapnum", "errcode", "ip", \
64 "cs", "ps", "sp", "ss", \
65 "fst0", "fst1", "fst2", "fst3", \
66 "fst4", "fst5", "fst6", "fst7", \
67 "fctrl", "fstat", "ftag", "fip", \
68 "fcs", "fopoff", "fopsel" \
71 /* Register numbers of various important registers.
72 Note that some of these values are "real" register numbers,
73 and correspond to the general registers of the machine,
74 and some are "phony" register numbers which are too large
75 to be actual register numbers as far as the user is concerned
76 but do serve to get the desired values when passed to read_register. */
79 #define FP_REGNUM 6 /* (ebp) Contains address of executing stack frame */
81 #define SP_REGNUM 18 /* (usp) Contains address of top of stack */
83 #define PS_REGNUM 17 /* (ps) Contains processor status */
85 #define PC_REGNUM 15 /* (eip) Contains program counter */
87 #define FP0_REGNUM 20 /* Floating point register 0 */
89 #define FPC_REGNUM 28 /* 80387 control register */
91 /* Total amount of space needed to store our copies of the machine's
92 register state, the array `registers'. */
95 #define REGISTER_BYTES (20*4+8*10+7*4)
97 /* Index within `registers' of the first byte of the space for
101 #define REGISTER_BYTE(N) \
102 ((N) >= FPC_REGNUM ? (((N) - FPC_REGNUM) * 4) + 160 \
103 : (N) >= FP0_REGNUM ? (((N) - FP0_REGNUM) * 10) + 80 \
106 /* Number of bytes of storage in the actual machine representation
109 #undef REGISTER_RAW_SIZE
110 #define REGISTER_RAW_SIZE(N) (((unsigned)((N) - FP0_REGNUM)) < 8 ? 10 : 4)
112 /* Number of bytes of storage in the program's representation
115 #undef REGISTER_VIRTUAL_SIZE
116 #define REGISTER_VIRTUAL_SIZE(N) (((unsigned)((N) - FP0_REGNUM)) < 8 ? 8 : 4)
118 /* Nonzero if register N requires conversion
119 from raw format to virtual format. */
121 #undef REGISTER_CONVERTIBLE
122 #define REGISTER_CONVERTIBLE(N) (((unsigned)((N) - FP0_REGNUM)) < 8)
124 /* Convert data from raw format for register REGNUM in buffer FROM
125 to virtual format with type TYPE in buffer TO. */
127 #undef REGISTER_CONVERT_TO_VIRTUAL
128 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
131 i387_to_double ((FROM), (char *)&val); \
132 store_floating ((TO), TYPE_LENGTH (TYPE), val); \
135 i387_to_double
PARAMS ((char *, char *));
137 /* Convert data from virtual format with type TYPE in buffer FROM
138 to raw format for register REGNUM in buffer TO. */
140 #undef REGISTER_CONVERT_TO_RAW
141 #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
143 double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
144 double_to_i387((char *)&val, (TO)); \
147 double_to_i387
PARAMS ((char *, char *));
149 /* Return the GDB type object for the "standard" data type
150 of data in register N. */
152 #undef REGISTER_VIRTUAL_TYPE
153 #define REGISTER_VIRTUAL_TYPE(N) \
154 (((unsigned)((N) - FP0_REGNUM)) < 8 ? builtin_type_double : builtin_type_int)
156 /* Extract from an array REGBUF containing the (raw) register state
157 a function return value of type TYPE, and copy that, in virtual format,
160 #undef EXTRACT_RETURN_VALUE
161 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
162 memcpy (VALBUF, REGBUF + REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 11), TYPE_LENGTH (TYPE))
164 /* Write into appropriate registers a function return value
165 of type TYPE, given in virtual format. */
167 #undef STORE_RETURN_VALUE
168 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
169 write_register_bytes (REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 11), VALBUF, TYPE_LENGTH (TYPE))
171 /* Describe the pointer in each stack frame to the previous stack frame
174 /* FRAME_CHAIN takes a frame's nominal address
175 and produces the frame's chain-pointer. */
178 #define FRAME_CHAIN(thisframe) \
179 (!inside_entry_file ((thisframe)->pc) ? \
180 read_memory_integer ((thisframe)->frame, 4) :\
183 /* Define other aspects of the stack frame. */
185 /* A macro that tells us whether the function invocation represented
186 by FI does not have a frame on the stack associated with it. If it
187 does not, FRAMELESS is set to 1, else 0. */
189 #undef FRAMELESS_FUNCTION_INVOCATION
190 #define FRAMELESS_FUNCTION_INVOCATION(FI) \
191 (frameless_look_for_prologue (FI))
193 #undef FRAME_SAVED_PC
194 #define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4))
196 /* Insert the specified number of args and function address
197 into a call sequence of the above form stored at DUMMYNAME. */
199 #undef FIX_CALL_DUMMY
200 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
202 *(int *)((char *)(dummyname) + 1) = (int)(fun) - (pc) - 5; \
205 #endif /* !defined (TM_SUN386_H) */
This page took 0.035438 seconds and 5 git commands to generate.