]>
Commit | Line | Data |
---|---|---|
c906108c SS |
1 | /* Macro definitions for i386, Unix System V. |
2 | Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc. | |
3 | ||
c5aa993b | 4 | This file is part of GDB. |
c906108c | 5 | |
c5aa993b JM |
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. | |
c906108c | 10 | |
c5aa993b JM |
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. | |
c906108c | 15 | |
c5aa993b JM |
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. */ | |
c906108c SS |
20 | |
21 | #ifndef TM_I386V_H | |
22 | #define TM_I386V_H 1 | |
23 | ||
24 | /* First pick up the generic *86 target file. */ | |
25 | ||
26 | #include "i386/tm-i386.h" | |
27 | ||
28 | /* Number of traps that happen between exec'ing the shell to run an | |
29 | inferior, and when we finally get to the inferior code. This is | |
30 | 2 on most implementations. Override here to 4. */ | |
31 | ||
32 | #undef START_INFERIOR_TRAPS_EXPECTED | |
33 | #define START_INFERIOR_TRAPS_EXPECTED 4 | |
34 | ||
35 | /* Number of machine registers */ | |
36 | ||
37 | #undef NUM_REGS | |
38 | #define NUM_REGS 16 | |
39 | ||
40 | /* Initializer for an array of names of registers. | |
41 | There should be NUM_REGS strings in this initializer. */ | |
42 | ||
43 | /* the order of the first 8 registers must match the compiler's | |
44 | * numbering scheme (which is the same as the 386 scheme) | |
45 | * also, this table must match regmap in i386-pinsn.c. | |
46 | */ | |
47 | ||
48 | #undef REGISTER_NAMES | |
49 | #define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \ | |
50 | "esp", "ebp", "esi", "edi", \ | |
51 | "eip", "ps", "cs", "ss", \ | |
52 | "ds", "es", "fs", "gs", \ | |
53 | } | |
54 | ||
55 | /* Total amount of space needed to store our copies of the machine's | |
56 | register state, the array `registers'. */ | |
57 | ||
58 | #undef REGISTER_BYTES | |
59 | #define REGISTER_BYTES (NUM_REGS * 4) | |
60 | ||
61 | /* Index within `registers' of the first byte of the space for | |
62 | register N. */ | |
63 | ||
64 | #undef REGISTER_BYTE | |
65 | #define REGISTER_BYTE(N) ((N)*4) | |
66 | ||
67 | /* Number of bytes of storage in the actual machine representation | |
68 | for register N. */ | |
69 | ||
70 | #undef REGISTER_RAW_SIZE | |
71 | #define REGISTER_RAW_SIZE(N) (4) | |
72 | ||
73 | /* Number of bytes of storage in the program's representation | |
74 | for register N. */ | |
75 | ||
76 | #undef REGISTER_VIRTUAL_SIZE | |
77 | #define REGISTER_VIRTUAL_SIZE(N) (4) | |
78 | ||
79 | /* Largest value REGISTER_RAW_SIZE can have. */ | |
80 | ||
81 | #undef MAX_REGISTER_RAW_SIZE | |
82 | #define MAX_REGISTER_RAW_SIZE 4 | |
83 | ||
84 | /* Largest value REGISTER_VIRTUAL_SIZE can have. */ | |
85 | ||
86 | #undef MAX_REGISTER_VIRTUAL_SIZE | |
87 | #define MAX_REGISTER_VIRTUAL_SIZE 4 | |
88 | ||
89 | /* Return the GDB type object for the "standard" data type | |
90 | of data in register N. */ | |
91 | /* Perhaps si and di should go here, but potentially they could be | |
92 | used for things other than address. */ | |
93 | ||
94 | #undef REGISTER_VIRTUAL_TYPE | |
95 | #define REGISTER_VIRTUAL_TYPE(N) \ | |
96 | ((N) == PC_REGNUM || (N) == FP_REGNUM || (N) == SP_REGNUM ? \ | |
97 | lookup_pointer_type (builtin_type_void) : builtin_type_int) | |
98 | ||
99 | /* Store the address of the place in which to copy the structure the | |
100 | subroutine will return. This is called from call_function. */ | |
101 | ||
102 | #undef STORE_STRUCT_RETURN | |
103 | #define STORE_STRUCT_RETURN(ADDR, SP) \ | |
104 | { char buf[REGISTER_SIZE]; \ | |
105 | (SP) -= sizeof (ADDR); \ | |
106 | store_address (buf, sizeof (ADDR), ADDR); \ | |
107 | write_memory ((SP), buf, sizeof (ADDR)); } | |
108 | ||
109 | /* Extract from an array REGBUF containing the (raw) register state | |
110 | a function return value of type TYPE, and copy that, in virtual format, | |
111 | into VALBUF. */ | |
112 | ||
113 | #undef EXTRACT_RETURN_VALUE | |
114 | #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ | |
115 | memcpy ((VALBUF), (REGBUF), TYPE_LENGTH (TYPE)) | |
116 | ||
117 | /* Write into appropriate registers a function return value | |
118 | of type TYPE, given in virtual format. */ | |
119 | ||
120 | #undef STORE_RETURN_VALUE | |
121 | #define STORE_RETURN_VALUE(TYPE,VALBUF) \ | |
122 | write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)) | |
c906108c | 123 | \f |
c5aa993b | 124 | |
c906108c SS |
125 | /* Describe the pointer in each stack frame to the previous stack frame |
126 | (its caller). */ | |
127 | ||
128 | /* FRAME_CHAIN takes a frame's nominal address | |
129 | and produces the frame's chain-pointer. */ | |
130 | ||
131 | #undef FRAME_CHAIN | |
132 | #define FRAME_CHAIN(thisframe) \ | |
133 | (!inside_entry_file ((thisframe)->pc) ? \ | |
134 | read_memory_integer ((thisframe)->frame, 4) :\ | |
135 | 0) | |
136 | ||
137 | /* Define other aspects of the stack frame. */ | |
138 | ||
139 | /* A macro that tells us whether the function invocation represented | |
140 | by FI does not have a frame on the stack associated with it. If it | |
141 | does not, FRAMELESS is set to 1, else 0. */ | |
142 | ||
143 | #undef FRAMELESS_FUNCTION_INVOCATION | |
392a587b JM |
144 | #define FRAMELESS_FUNCTION_INVOCATION(FI) \ |
145 | (frameless_look_for_prologue (FI)) | |
c906108c SS |
146 | |
147 | #undef FRAME_SAVED_PC | |
148 | #define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4)) | |
149 | ||
150 | /* Return number of args passed to a frame. | |
151 | Can return -1, meaning no way to tell. */ | |
152 | ||
153 | #undef FRAME_NUM_ARGS | |
392a587b | 154 | #define FRAME_NUM_ARGS(fi) (-1) |
c906108c | 155 | |
c5aa993b | 156 | #ifdef __STDC__ /* Forward decl's for prototypes */ |
c906108c SS |
157 | struct frame_info; |
158 | struct frame_saved_regs; | |
159 | #endif | |
160 | ||
161 | extern int | |
162 | i386_frame_num_args PARAMS ((struct frame_info *)); | |
163 | ||
c5aa993b | 164 | #endif /* ifndef TM_I386V_H */ |