Added i386 QNX Neutrino support.
[platform/upstream/binutils.git] / gdb / nto-tdep.h
1 /* nto-tdep.h - QNX Neutrino target header.
2
3    Copyright 2003 Free Software Foundation, Inc.
4
5    Contributed by QNX Software Systems Ltd.
6
7    This file is part of GDB.
8
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 59 Temple Place - Suite 330,
22    Boston, MA 02111-1307, USA.  */
23
24 #ifndef _NTO_TDEP_H
25 #define _NTO_TDEP_H
26
27 #include "defs.h"
28 #include "solist.h"
29
30 /* Generic functions in nto-tdep.c.  */
31
32 extern void nto_init_solib_absolute_prefix PARAMS ((void));
33
34 char **nto_parse_redirection
35 PARAMS ((char *start_argv[], char **in, char **out, char **err));
36
37 int proc_iterate_over_mappings PARAMS ((int (*func) (int, CORE_ADDR)));
38
39 void nto_relocate_section_addresses
40 PARAMS ((struct so_list *, struct section_table *));
41
42 int nto_map_arch_to_cputype PARAMS ((const char *));
43
44 int nto_find_and_open_solib PARAMS ((char *, unsigned, char **));
45
46 /* Dummy function for initializing nto_target_ops on targets which do
47    not define a particular regset.  */
48 void nto_dummy_supply_regset PARAMS ((char *regs));
49
50 /* Target operations defined for Neutrino targets (<target>-nto-tdep.c).  */
51
52 struct nto_target_ops
53 {
54   int nto_internal_debugging;
55   unsigned nto_cpuinfo_flags;
56   int nto_cpuinfo_valid;
57
58   int (*nto_regset_id) (int);
59   void (*nto_supply_gregset) (char *);
60   void (*nto_supply_fpregset) (char *);
61   void (*nto_supply_altregset) (char *);
62   void (*nto_supply_regset) (int, char *);
63   int (*nto_register_area) (int, int, unsigned *);
64   int (*nto_regset_fill) (int, char *);
65   struct link_map_offsets *(*nto_fetch_link_map_offsets) (void);
66 };
67
68 extern struct nto_target_ops current_nto_target;
69
70 /* For 'maintenance debug nto-debug' command.  */
71 #define nto_internal_debugging \
72         (current_nto_target.nto_internal_debugging)
73
74 /* The CPUINFO flags from the remote.  Currently used by
75    i386 for fxsave but future proofing other hosts.
76    This is initialized in procfs_attach or nto_start_remote
77    depending on our host/target.  It would only be invalid
78    if we were talking to an older pdebug which didn't support
79    the cpuinfo message.  */
80 #define nto_cpuinfo_flags \
81         (current_nto_target.nto_cpuinfo_flags)
82
83 /* True if successfully retrieved cpuinfo from remote.  */
84 #define nto_cpuinfo_valid \
85         (current_nto_target.nto_cpuinfo_valid)
86
87 /* Given a register, return an id that represents the Neutrino
88    regset it came from.  If reg == -1 update all regsets.  */
89 #define nto_regset_id(reg) \
90         (*current_nto_target.nto_regset_id) (reg)
91
92 #define nto_supply_gregset(regs) \
93         (*current_nto_target.nto_supply_gregset) (regs)
94
95 #define nto_supply_fpregset(regs) \
96         (*current_nto_target.nto_supply_fpregset) (regs)
97
98 #define nto_supply_altregset(regs) \
99         (*current_nto_target.nto_supply_altregset) (regs)
100
101 /* Given a regset, tell gdb about registers stored in data.  */
102 #define nto_supply_regset(regset, data) \
103         (*current_nto_target.nto_supply_regset) (regset, data)
104
105 /* Given a register and regset, calculate the offset into the regset
106    and stuff it into the last argument.  If regno is -1, calculate the
107    size of the entire regset.  Returns length of data, -1 if unknown
108    regset, 0 if unknown register.  */
109 #define nto_register_area(reg, regset, off) \
110         (*current_nto_target.nto_register_area) (reg, regset, off)
111
112 /* Build the Neutrino register set info into the data buffer.  
113    Return -1 if unknown regset, 0 otherwise.  */
114 #define nto_regset_fill(regset, data) \
115         (*current_nto_target.nto_regset_fill) (regset, data)
116
117 /* Gives the fetch_link_map_offsets function exposure outside of
118    solib-svr4.c so that we can override relocate_section_addresses().  */
119 #define nto_fetch_link_map_offsets() \
120         (*current_nto_target.nto_fetch_link_map_offsets) ()
121
122 /* Keep this consistant with neutrino syspage.h.  */
123 enum
124 {
125   CPUTYPE_X86,
126   CPUTYPE_PPC,
127   CPUTYPE_MIPS,
128   CPUTYPE_SPARE,
129   CPUTYPE_ARM,
130   CPUTYPE_SH,
131   CPUTYPE_UNKNOWN
132 };
133
134 enum
135 {
136   OSTYPE_QNX4,
137   OSTYPE_NTO
138 };
139
140 /* These correspond to the DSMSG_* versions in dsmsgs.h. */
141 enum
142 {
143   NTO_REG_GENERAL,
144   NTO_REG_FLOAT,
145   NTO_REG_SYSTEM,
146   NTO_REG_ALT,
147   NTO_REG_END
148 };
149
150 typedef char qnx_reg64[8];
151
152 typedef struct _debug_regs
153 {
154   qnx_reg64 padding[1024];
155 } nto_regset_t;
156
157 #endif