Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / gdb / gdb / config / i386 / tm-cygwin.h
1 /* Macro definitions for i386 running under the win32 API Unix.
2    Copyright 1995, 1996 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
19
20
21 #include "i386/tm-i386v.h"
22
23 #undef MAX_REGISTER_RAW_SIZE
24 #undef MAX_REGISTER_VIRTUAL_SIZE
25 #undef NUM_REGS
26 #undef REGISTER_BYTE
27 #undef REGISTER_BYTES
28 #undef REGISTER_CONVERTIBLE
29 #undef REGISTER_CONVERT_TO_RAW
30 #undef REGISTER_CONVERT_TO_VIRTUAL
31 #undef REGISTER_NAMES
32 #undef REGISTER_RAW_SIZE
33 #undef REGISTER_VIRTUAL_SIZE
34 #undef REGISTER_VIRTUAL_TYPE
35
36 /* Number of machine registers */
37
38 #define NUM_REGS 24
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 #define REGISTER_NAMES { "eax",  "ecx",  "edx",  "ebx",  \
49                          "esp",  "ebp",  "esi",  "edi",  \
50                          "eip",  "ps",   "cs",   "ss",   \
51                          "ds",   "es",   "fs",   "gs",   \
52                          "st",   "st(1)","st(2)","st(3)",\
53                          "st(4)","st(5)","st(6)","st(7)",}
54
55 #define FP0_REGNUM 16
56
57 /* Total amount of space needed to store our copies of the machine's
58    register state, the array `registers'.  */
59
60 #define REGISTER_BYTES (16 * 4 + 8 * 10)
61
62 /* Index within `registers' of the first byte of the space for
63    register N.  */
64
65 #define REGISTER_BYTE(N) (((N) < 16) ? (N) * 4 : (((N) - 16) * 10) + (16 * 4))
66
67 /* Number of bytes of storage in the actual machine representation
68    for register N.  */
69
70 #define REGISTER_RAW_SIZE(N) (((N) < 16) ? 4 : 10)
71
72 /* Number of bytes of storage in the program's representation
73    for register N. */
74
75 #define REGISTER_VIRTUAL_SIZE(N) (((N) < 16) ? 4 : 10)
76
77 /* Largest value REGISTER_RAW_SIZE can have.  */
78
79 #define MAX_REGISTER_RAW_SIZE 10
80
81 /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
82
83 #define MAX_REGISTER_VIRTUAL_SIZE 10
84
85 /* Nonzero if register N requires conversion
86    from raw format to virtual format.  */
87
88 #define REGISTER_CONVERTIBLE(N) \
89   ((N < FP0_REGNUM) ? 0 : 1)
90
91 /* Convert data from raw format for register REGNUM in buffer FROM
92    to virtual format with type TYPE in buffer TO.  */
93 extern void
94 i387_to_double PARAMS ((char *, char *));
95
96
97 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
98 { \
99   double val; \
100   i387_to_double ((FROM), (char *)&val); \
101   store_floating ((TO), TYPE_LENGTH (TYPE), val); \
102 }
103
104 extern void
105 double_to_i387 PARAMS ((char *, char *));
106
107 #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
108 { \
109   double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
110   double_to_i387((char *)&val, (TO)); \
111 }
112
113 /* Return the GDB type object for the "standard" data type
114    of data in register N.  */
115
116 #define REGISTER_VIRTUAL_TYPE(N) \
117   ((N < FP0_REGNUM) ? builtin_type_int : \
118    builtin_type_double)
119
120 #define NAMES_HAVE_UNDERSCORE
121
122 #define IN_SOLIB_CALL_TRAMPOLINE(pc, name) skip_trampoline_code (pc, name)
123 #define SKIP_TRAMPOLINE_CODE(pc)           skip_trampoline_code (pc, 0)
124 extern CORE_ADDR skip_trampoline_code PARAMS ((CORE_ADDR pc, char *name));
125
126 extern char *cygwin_pid_to_str PARAMS ((int pid));
127 #define target_pid_to_str(PID) cygwin_pid_to_str (PID)