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