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