| 1 | 24 | jeremybenn | /* nto-tdep.h - QNX Neutrino target header.
 | 
      
         | 2 |  |  |  
 | 
      
         | 3 |  |  |    Copyright (C) 2003, 2007, 2008 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 3 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, see <http://www.gnu.org/licenses/>.  */
 | 
      
         | 21 |  |  |  
 | 
      
         | 22 |  |  | #ifndef _NTO_TDEP_H
 | 
      
         | 23 |  |  | #define _NTO_TDEP_H
 | 
      
         | 24 |  |  |  
 | 
      
         | 25 |  |  | #include "solist.h"
 | 
      
         | 26 |  |  | #include "osabi.h"
 | 
      
         | 27 |  |  | #include "regset.h"
 | 
      
         | 28 |  |  |  
 | 
      
         | 29 |  |  | /* Target operations defined for Neutrino targets (<target>-nto-tdep.c).  */
 | 
      
         | 30 |  |  |  
 | 
      
         | 31 |  |  | struct nto_target_ops
 | 
      
         | 32 |  |  | {
 | 
      
         | 33 |  |  | /* For 'maintenance debug nto-debug' command.  */
 | 
      
         | 34 |  |  |   int internal_debugging;
 | 
      
         | 35 |  |  |  
 | 
      
         | 36 |  |  | /* The CPUINFO flags from the remote.  Currently used by
 | 
      
         | 37 |  |  |    i386 for fxsave but future proofing other hosts.
 | 
      
         | 38 |  |  |    This is initialized in procfs_attach or nto_start_remote
 | 
      
         | 39 |  |  |    depending on our host/target.  It would only be invalid
 | 
      
         | 40 |  |  |    if we were talking to an older pdebug which didn't support
 | 
      
         | 41 |  |  |    the cpuinfo message.  */
 | 
      
         | 42 |  |  |   unsigned cpuinfo_flags;
 | 
      
         | 43 |  |  |  
 | 
      
         | 44 |  |  | /* True if successfully retrieved cpuinfo from remote.  */
 | 
      
         | 45 |  |  |   int cpuinfo_valid;
 | 
      
         | 46 |  |  |  
 | 
      
         | 47 |  |  | /* Given a register, return an id that represents the Neutrino
 | 
      
         | 48 |  |  |    regset it came from.  If reg == -1 update all regsets.  */
 | 
      
         | 49 |  |  |   int (*regset_id) (int);
 | 
      
         | 50 |  |  |  
 | 
      
         | 51 |  |  |   void (*supply_gregset) (struct regcache *, char *);
 | 
      
         | 52 |  |  |  
 | 
      
         | 53 |  |  |   void (*supply_fpregset) (struct regcache *, char *);
 | 
      
         | 54 |  |  |  
 | 
      
         | 55 |  |  |   void (*supply_altregset) (struct regcache *, char *);
 | 
      
         | 56 |  |  |  
 | 
      
         | 57 |  |  | /* Given a regset, tell gdb about registers stored in data.  */
 | 
      
         | 58 |  |  |   void (*supply_regset) (struct regcache *, int, char *);
 | 
      
         | 59 |  |  |  
 | 
      
         | 60 |  |  | /* Given a register and regset, calculate the offset into the regset
 | 
      
         | 61 |  |  |    and stuff it into the last argument.  If regno is -1, calculate the
 | 
      
         | 62 |  |  |    size of the entire regset.  Returns length of data, -1 if unknown
 | 
      
         | 63 |  |  |    regset, 0 if unknown register.  */
 | 
      
         | 64 |  |  |   int (*register_area) (int, int, unsigned *);
 | 
      
         | 65 |  |  |  
 | 
      
         | 66 |  |  | /* Build the Neutrino register set info into the data buffer.
 | 
      
         | 67 |  |  |    Return -1 if unknown regset, 0 otherwise.  */
 | 
      
         | 68 |  |  |   int (*regset_fill) (const struct regcache *, int, char *);
 | 
      
         | 69 |  |  |  
 | 
      
         | 70 |  |  | /* Gives the fetch_link_map_offsets function exposure outside of
 | 
      
         | 71 |  |  |    solib-svr4.c so that we can override relocate_section_addresses().  */
 | 
      
         | 72 |  |  |   struct link_map_offsets *(*fetch_link_map_offsets) (void);
 | 
      
         | 73 |  |  |  
 | 
      
         | 74 |  |  | /* Used by nto_elf_osabi_sniffer to determine if we're connected to an
 | 
      
         | 75 |  |  |    Neutrino target.  */
 | 
      
         | 76 |  |  |   enum gdb_osabi (*is_nto_target) (bfd *abfd);
 | 
      
         | 77 |  |  | };
 | 
      
         | 78 |  |  |  
 | 
      
         | 79 |  |  | extern struct nto_target_ops current_nto_target;
 | 
      
         | 80 |  |  |  
 | 
      
         | 81 |  |  | #define nto_internal_debugging (current_nto_target.internal_debugging)
 | 
      
         | 82 |  |  |  
 | 
      
         | 83 |  |  | #define nto_cpuinfo_flags (current_nto_target.cpuinfo_flags)
 | 
      
         | 84 |  |  |  
 | 
      
         | 85 |  |  | #define nto_cpuinfo_valid (current_nto_target.cpuinfo_valid)
 | 
      
         | 86 |  |  |  
 | 
      
         | 87 |  |  | #define nto_regset_id (current_nto_target.regset_id)
 | 
      
         | 88 |  |  |  
 | 
      
         | 89 |  |  | #define nto_supply_gregset (current_nto_target.supply_gregset)
 | 
      
         | 90 |  |  |  
 | 
      
         | 91 |  |  | #define nto_supply_fpregset (current_nto_target.supply_fpregset)
 | 
      
         | 92 |  |  |  
 | 
      
         | 93 |  |  | #define nto_supply_altregset (current_nto_target.supply_altregset)
 | 
      
         | 94 |  |  |  
 | 
      
         | 95 |  |  | #define nto_supply_regset (current_nto_target.supply_regset)
 | 
      
         | 96 |  |  |  
 | 
      
         | 97 |  |  | #define nto_register_area (current_nto_target.register_area)
 | 
      
         | 98 |  |  |  
 | 
      
         | 99 |  |  | #define nto_regset_fill (current_nto_target.regset_fill)
 | 
      
         | 100 |  |  |  
 | 
      
         | 101 |  |  | #define nto_fetch_link_map_offsets \
 | 
      
         | 102 |  |  | (current_nto_target.fetch_link_map_offsets)
 | 
      
         | 103 |  |  |  
 | 
      
         | 104 |  |  | #define nto_is_nto_target (current_nto_target.is_nto_target)
 | 
      
         | 105 |  |  |  
 | 
      
         | 106 |  |  | /* Keep this consistant with neutrino syspage.h.  */
 | 
      
         | 107 |  |  | enum
 | 
      
         | 108 |  |  | {
 | 
      
         | 109 |  |  |   CPUTYPE_X86,
 | 
      
         | 110 |  |  |   CPUTYPE_PPC,
 | 
      
         | 111 |  |  |   CPUTYPE_MIPS,
 | 
      
         | 112 |  |  |   CPUTYPE_SPARE,
 | 
      
         | 113 |  |  |   CPUTYPE_ARM,
 | 
      
         | 114 |  |  |   CPUTYPE_SH,
 | 
      
         | 115 |  |  |   CPUTYPE_UNKNOWN
 | 
      
         | 116 |  |  | };
 | 
      
         | 117 |  |  |  
 | 
      
         | 118 |  |  | enum
 | 
      
         | 119 |  |  | {
 | 
      
         | 120 |  |  |   OSTYPE_QNX4,
 | 
      
         | 121 |  |  |   OSTYPE_NTO
 | 
      
         | 122 |  |  | };
 | 
      
         | 123 |  |  |  
 | 
      
         | 124 |  |  | /* These correspond to the DSMSG_* versions in dsmsgs.h. */
 | 
      
         | 125 |  |  | enum
 | 
      
         | 126 |  |  | {
 | 
      
         | 127 |  |  |   NTO_REG_GENERAL,
 | 
      
         | 128 |  |  |   NTO_REG_FLOAT,
 | 
      
         | 129 |  |  |   NTO_REG_SYSTEM,
 | 
      
         | 130 |  |  |   NTO_REG_ALT,
 | 
      
         | 131 |  |  |   NTO_REG_END
 | 
      
         | 132 |  |  | };
 | 
      
         | 133 |  |  |  
 | 
      
         | 134 |  |  | typedef char qnx_reg64[8];
 | 
      
         | 135 |  |  |  
 | 
      
         | 136 |  |  | typedef struct _debug_regs
 | 
      
         | 137 |  |  | {
 | 
      
         | 138 |  |  |   qnx_reg64 padding[1024];
 | 
      
         | 139 |  |  | } nto_regset_t;
 | 
      
         | 140 |  |  |  
 | 
      
         | 141 |  |  | /* Generic functions in nto-tdep.c.  */
 | 
      
         | 142 |  |  |  
 | 
      
         | 143 |  |  | void nto_init_solib_absolute_prefix (void);
 | 
      
         | 144 |  |  |  
 | 
      
         | 145 |  |  | void nto_set_target(struct nto_target_ops *);
 | 
      
         | 146 |  |  |  
 | 
      
         | 147 |  |  | char **nto_parse_redirection (char *start_argv[], char **in,
 | 
      
         | 148 |  |  |                               char **out, char **err);
 | 
      
         | 149 |  |  |  
 | 
      
         | 150 |  |  | int proc_iterate_over_mappings (int (*func) (int, CORE_ADDR));
 | 
      
         | 151 |  |  |  
 | 
      
         | 152 |  |  | void nto_relocate_section_addresses (struct so_list *,
 | 
      
         | 153 |  |  |                                      struct section_table *);
 | 
      
         | 154 |  |  |  
 | 
      
         | 155 |  |  | int nto_map_arch_to_cputype (const char *);
 | 
      
         | 156 |  |  |  
 | 
      
         | 157 |  |  | int nto_find_and_open_solib (char *, unsigned, char **);
 | 
      
         | 158 |  |  |  
 | 
      
         | 159 |  |  | enum gdb_osabi nto_elf_osabi_sniffer (bfd *abfd);
 | 
      
         | 160 |  |  |  
 | 
      
         | 161 |  |  | void nto_initialize_signals (void);
 | 
      
         | 162 |  |  |  
 | 
      
         | 163 |  |  | void nto_generic_supply_gpregset (const struct regset *, struct regcache *,
 | 
      
         | 164 |  |  |                                   int, const void *, size_t);
 | 
      
         | 165 |  |  |  
 | 
      
         | 166 |  |  | void nto_generic_supply_fpregset (const struct regset *, struct regcache *,
 | 
      
         | 167 |  |  |                                   int, const void *, size_t);
 | 
      
         | 168 |  |  |  
 | 
      
         | 169 |  |  | void nto_generic_supply_altregset (const struct regset *, struct regcache *,
 | 
      
         | 170 |  |  |                                    int, const void *, size_t);
 | 
      
         | 171 |  |  |  
 | 
      
         | 172 |  |  | /* Dummy function for initializing nto_target_ops on targets which do
 | 
      
         | 173 |  |  |    not define a particular regset.  */
 | 
      
         | 174 |  |  | void nto_dummy_supply_regset (struct regcache *regcache, char *regs);
 | 
      
         | 175 |  |  |  
 | 
      
         | 176 |  |  | int nto_in_dynsym_resolve_code (CORE_ADDR pc);
 | 
      
         | 177 |  |  |  
 | 
      
         | 178 |  |  | #endif
 |