4e6b2df48fb98018f8ed2fb2da9992ac7fda0005
[deliverable/binutils-gdb.git] / gdb / config / i386 / tm-i386aix.h
1 /* Macro defintions for IBM AIX PS/2 (i386).
2 Copyright 1986, 1987, 1989, 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 /*
21 * Changes for IBM AIX PS/2 by Minh Tran-Le (tranle@intellicorp.com)
22 * Revision: 5-May-93 00:11:35
23 */
24
25 #ifndef TM_I386AIX_H
26 #define TM_I386AIX_H 1
27
28 #include "i386/tm-i386v.h"
29 #include <sys/reg.h>
30
31 #ifndef I386
32 # define I386 1
33 #endif
34 #ifndef I386_AIX_TARGET
35 # define I386_AIX_TARGET 1
36 #endif
37
38 /* number of traps that happen between exec'ing the shell
39 * to run an inferior, and when we finally get to
40 * the inferior code. This is 2 on most implementations.
41 */
42 #undef START_INFERIOR_TRAPS_EXPECTED
43 #define START_INFERIOR_TRAPS_EXPECTED 2
44
45 /* Number of machine registers */
46 #undef NUM_REGS
47 #define NUM_REGS 24 /* 16+8 */
48
49 /* Initializer for an array of names of registers.
50 There should be NUM_REGS strings in this initializer. */
51
52 /* the order of the first 8 registers must match the compiler's
53 * numbering scheme (which is the same as the 386 scheme)
54 * also, this table must match regmap in i386-pinsn.c.
55 */
56 #undef REGISTER_NAMES
57 #define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \
58 "esp", "ebp", "esi", "edi", \
59 "eip", "eflags", "cs", "ss", \
60 "ds", "es", "fs", "gs", \
61 "st0", "st1", "st2", "st3", \
62 "st4", "st5", "st6", "st7", \
63 }
64
65 /* Register numbers of various important registers.
66 Note that some of these values are "real" register numbers,
67 and correspond to the general registers of the machine,
68 and some are "phony" register numbers which are too large
69 to be actual register numbers as far as the user is concerned
70 but do serve to get the desired values when passed to read_register. */
71
72 #undef FP_REGNUM
73 #define FP_REGNUM 5 /* (ebp) Contains address of executing stack frame */
74 #undef SP_REGNUM
75 #define SP_REGNUM 4 /* (usp) Contains address of top of stack */
76
77 #undef PC_REGNUM
78 #define PC_REGNUM 8 /* (eip) Contains program counter */
79 #undef PS_REGNUM
80 #define PS_REGNUM 9 /* (eflags) Contains processor status */
81
82 #define FP0_REGNUM 16 /* (st0) 387 register */
83
84 /* Total amount of space needed to store our copies of the machine's
85 register state, the array `registers'. */
86 /* 16 i386 registers and 8 i387 registers */
87 #undef REGISTER_BYTES
88 #define REGISTER_BYTES (16*4 + 8*10)
89
90 /* Index within `registers' of the first byte of the space for
91 register N. */
92 #undef REGISTER_BYTE
93 #define REGISTER_BYTE(N) \
94 ((N < FP0_REGNUM) ? (N * 4) : \
95 (((N - FP0_REGNUM) * 10) + 64))
96
97 /* Number of bytes of storage in the actual machine representation
98 * for register N. All registers are 4 bytes, except 387 st(0) - st(7),
99 * which are 80 bits each.
100 */
101 #undef REGISTER_RAW_SIZE
102 #define REGISTER_RAW_SIZE(N) \
103 ((N < FP0_REGNUM) ? 4 : 10)
104
105 /* Largest value REGISTER_RAW_SIZE can have. */
106 #undef MAX_REGISTER_RAW_SIZE
107 #define MAX_REGISTER_RAW_SIZE 10
108
109 /* Nonzero if register N requires conversion
110 from raw format to virtual format. */
111 #undef REGISTER_CONVERTIBLE
112 #define REGISTER_CONVERTIBLE(N) \
113 ((N < FP0_REGNUM) ? 0 : 1)
114
115 /* Convert data from raw format for register REGNUM in buffer FROM
116 to virtual format with type TYPE in buffer TO. */
117
118 #undef REGISTER_CONVERT_TO_VIRTUAL
119 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
120 { \
121 double val; \
122 i387_to_double ((FROM), (char *)&val); \
123 store_floating ((TO), TYPE_LENGTH (TYPE), val); \
124 }
125 extern void
126 i387_to_double PARAMS ((char *, char *));
127
128 /* Convert data from virtual format with type TYPE in buffer FROM
129 to raw format for register REGNUM in buffer TO. */
130
131 #undef REGISTER_CONVERT_TO_RAW
132 #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
133 { \
134 double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
135 double_to_i387((char *)&val, (TO)))
136 }
137 extern void
138 double_to_i387 PARAMS ((char *, char *));
139
140 /* Return the GDB type object for the "standard" data type
141 of data in register N. */
142 #undef REGISTER_VIRTUAL_TYPE
143 #define REGISTER_VIRTUAL_TYPE(N) \
144 ((N < FP0_REGNUM) ? builtin_type_int : \
145 builtin_type_double)
146
147 /* Extract from an array REGBUF containing the (raw) register state
148 a function return value of type TYPE, and copy that, in virtual format,
149 into VALBUF. */
150 #undef EXTRACT_RETURN_VALUE
151 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
152 i386_extract_return_value (TYPE,REGBUF,VALBUF)
153
154 /* Write into appropriate registers a function return value
155 of type TYPE, given in virtual format. */
156 #undef STORE_RETURN_VALUE
157 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
158 { \
159 if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \
160 write_register_bytes (REGISTER_BYTE (FP0_REGNUM), (VALBUF), \
161 TYPE_LENGTH (TYPE)); \
162 else \
163 write_register_bytes (0, (VALBUF), TYPE_LENGTH (TYPE)); \
164 }
165
166 #endif /* TM_I386AIX_H */
This page took 0.031771 seconds and 3 git commands to generate.