]>
git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/config/i386/tm-go32.h
1 /* Target-dependent definitions for Intel x86 running DJGPP.
2 Copyright 1995, 1996, 1997 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 #include "i386/tm-i386v.h"
23 /* Number of machine registers. */
28 #define NUM_REGS (16+NUM_FREGS)
30 /* Initializer for an array of names of registers. There should be
31 NUM_REGS strings in this initializer. */
33 /* The order of the first 8 registers must match the compiler's
34 numbering scheme (which is the same as the 386 scheme). */
37 #define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \
38 "esp", "ebp", "esi", "edi", \
39 "eip", "eflags","cs", "ss", \
40 "ds", "es", "fs", "gs", \
41 "st0", "st1", "st2", "st3", \
42 "st4", "st5", "st6", "st7", \
43 "fctrl","fstat", "ftag", "fcs", \
44 "fopsel","fip", "fopoff" }
47 #define FP_REGNUM 5 /* (ebp) Contains addr of stack frame */
49 #define SP_REGNUM 4 /* (usp) Contains address of top of stack */
51 #define PS_REGNUM 9 /* (ps) Contains processor status */
53 #define PC_REGNUM 8 /* (eip) Contains program counter */
55 #define FP0_REGNUM 16 /* Floating point register 0 */
57 #define FPC_REGNUM 24 /* 80387 control register */
59 #define FPCWD_REGNUM FPC_REGNUM
61 #define FPSWD_REGNUM 25 /* 80387 status register */
63 #define FPTWD_REGNUM 26 /* 80387 tag register */
65 #define FPIPO_REGNUM 29 /* 80387 instruction pointer offset reg */
67 #define FPIPS_REGNUM 27 /* 80387 instruction pointer selector reg */
69 #define FPOOS_REGNUM 30 /* 80387 operand pointer offset reg */
71 #define FPOPS_REGNUM 28 /* 80387 operand pointer selector reg */
73 /* Total amount of space needed to store our copies of the machine's
74 register state, the array `registers'. */
77 #define REGISTER_BYTES (10*4 + 6*2 + 8*10 + 5*2 + 2*4)
79 /* Index within `registers' of the first byte of the space for
84 #define REGBYTE_10 (REGBYTE_0+10*4)
85 #define REGBYTE_16 (REGBYTE_10+6*2)
86 #define REGBYTE_24 (REGBYTE_16+8*10)
87 #define REGBYTE_29 (REGBYTE_24+5*2)
88 #define REGISTER_BYTE(N) (((N) < 10) ? (N) * 4 : \
89 (N) < 16 ? REGBYTE_10 +((N) - 10) * 2 : \
90 (N) < 24 ? REGBYTE_16 +((N) - 16) * 10 : \
91 (N) < 29 ? REGBYTE_24 +((N) - 24) * 2 : \
92 REGBYTE_29 + ((N) - 29) * 4)
94 /* Number of bytes of storage in the actual machine representation
97 #undef REGISTER_RAW_SIZE
98 #define REGISTER_RAW_SIZE(N) ((N) < 10 ? 4 : (N) < 16 ? 2 : (N) < 24 ? 10 : \
101 /* Number of bytes of storage in the program's representation
104 #undef REGISTER_VIRTUAL_SIZE
105 #define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N)
107 /* Largest value REGISTER_RAW_SIZE can have. */
109 #undef MAX_REGISTER_RAW_SIZE
110 #define MAX_REGISTER_RAW_SIZE 10
112 /* Largest value REGISTER_VIRTUAL_SIZE can have. */
114 #undef MAX_REGISTER_VIRTUAL_SIZE
115 #define MAX_REGISTER_VIRTUAL_SIZE 10
117 /* Nonzero if register N requires conversion
118 from raw format to virtual format. */
120 #undef REGISTER_CONVERTIBLE
121 #define REGISTER_CONVERTIBLE(N) ((N) < FP0_REGNUM ? 0 :\
122 (N) < FPC_REGNUM ? 1 : 0)
124 /* The host and target are i386 machines and the compiler supports
125 long doubles. Long doubles on the host therefore have the same
126 layout as a 387 FPU stack register. */
128 #if defined(HAVE_LONG_DOUBLE) && defined(HOST_I386)
133 /* Allow floating point numbers to be specified by a raw long double
134 10 hex bytes number, e.g. 1.0 can be input as
135 0x3fff8000000000000000 */
138 #define HEX_LONG_DOUBLE_INPUT(base,p,len,target) \
139 ((base) == 16 && (len) == 20 \
140 && i387_hex_long_double_input ((p), (target)))
143 extern int i387_hex_long_double_input (char *p
, long double *putithere
);
145 #undef REGISTER_CONVERT_TO_VIRTUAL
147 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
149 if (TYPE == REGISTER_VIRTUAL_TYPE (REGNUM)) \
151 memcpy (TO, FROM, TYPE_LENGTH (TYPE)); \
155 long double val = *((long double *)FROM); \
156 store_floating ((TO), TYPE_LENGTH (TYPE), val); \
160 /* Convert data from raw format for register REGNUM in buffer FROM to
161 virtual format with type TYPE in buffer TO. */
162 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
165 i387_to_double ((FROM), (char *)&val); \
166 store_floating ((TO), TYPE_LENGTH (TYPE), val); \
170 extern void i387_to_double
PARAMS ((char *, char *));
172 #undef REGISTER_CONVERT_TO_RAW
174 #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
176 if (TYPE == REGISTER_VIRTUAL_TYPE (REGNUM)) \
178 memcpy (TO, FROM, TYPE_LENGTH (TYPE)); \
182 long double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
183 *((long double *)TO) = val; \
187 #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
189 double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
190 double_to_i387((char *)&val, (TO)); \
194 extern void double_to_i387
PARAMS ((char *, char *));
196 /* Return the GDB type object for the "standard" data type of data in
199 #undef REGISTER_VIRTUAL_TYPE
201 #define REGISTER_VIRTUAL_TYPE(N) \
202 ((N < FP0_REGNUM) ? builtin_type_int : \
203 (N < FPC_REGNUM) ? builtin_type_long_double : builtin_type_int)
205 #define REGISTER_VIRTUAL_TYPE(N) \
206 ((N < FP0_REGNUM) ? builtin_type_int : \
207 (N < FPC_REGNUM) ? builtin_type_double : builtin_type_int)
210 #undef TARGET_LONG_DOUBLE_BIT
211 #define TARGET_LONG_DOUBLE_BIT 96