1130803Smarcel/* nto-tdep.h - QNX Neutrino target header. 2130803Smarcel 3130803Smarcel Copyright 2003 Free Software Foundation, Inc. 4130803Smarcel 5130803Smarcel Contributed by QNX Software Systems Ltd. 6130803Smarcel 7130803Smarcel This file is part of GDB. 8130803Smarcel 9130803Smarcel This program is free software; you can redistribute it and/or modify 10130803Smarcel it under the terms of the GNU General Public License as published by 11130803Smarcel the Free Software Foundation; either version 2 of the License, or 12130803Smarcel (at your option) any later version. 13130803Smarcel 14130803Smarcel This program is distributed in the hope that it will be useful, 15130803Smarcel but WITHOUT ANY WARRANTY; without even the implied warranty of 16130803Smarcel MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17130803Smarcel GNU General Public License for more details. 18130803Smarcel 19130803Smarcel You should have received a copy of the GNU General Public License 20130803Smarcel along with this program; if not, write to the Free Software 21130803Smarcel Foundation, Inc., 59 Temple Place - Suite 330, 22130803Smarcel Boston, MA 02111-1307, USA. */ 23130803Smarcel 24130803Smarcel#ifndef _NTO_TDEP_H 25130803Smarcel#define _NTO_TDEP_H 26130803Smarcel 27130803Smarcel#include "defs.h" 28130803Smarcel#include "solist.h" 29130803Smarcel 30130803Smarcel/* Generic functions in nto-tdep.c. */ 31130803Smarcel 32130803Smarcelextern void nto_init_solib_absolute_prefix (void); 33130803Smarcel 34130803Smarcelchar **nto_parse_redirection (char *start_argv[], char **in, 35130803Smarcel char **out, char **err); 36130803Smarcel 37130803Smarcelint proc_iterate_over_mappings (int (*func) (int, CORE_ADDR)); 38130803Smarcel 39130803Smarcelvoid nto_relocate_section_addresses (struct so_list *, struct section_table *); 40130803Smarcel 41130803Smarcelint nto_map_arch_to_cputype (const char *); 42130803Smarcel 43130803Smarcelint nto_find_and_open_solib (char *, unsigned, char **); 44130803Smarcel 45130803Smarcel/* Dummy function for initializing nto_target_ops on targets which do 46130803Smarcel not define a particular regset. */ 47130803Smarcelvoid nto_dummy_supply_regset (char *regs); 48130803Smarcel 49130803Smarcel/* Target operations defined for Neutrino targets (<target>-nto-tdep.c). */ 50130803Smarcel 51130803Smarcelstruct nto_target_ops 52130803Smarcel{ 53130803Smarcel int nto_internal_debugging; 54130803Smarcel unsigned nto_cpuinfo_flags; 55130803Smarcel int nto_cpuinfo_valid; 56130803Smarcel 57130803Smarcel int (*nto_regset_id) (int); 58130803Smarcel void (*nto_supply_gregset) (char *); 59130803Smarcel void (*nto_supply_fpregset) (char *); 60130803Smarcel void (*nto_supply_altregset) (char *); 61130803Smarcel void (*nto_supply_regset) (int, char *); 62130803Smarcel int (*nto_register_area) (int, int, unsigned *); 63130803Smarcel int (*nto_regset_fill) (int, char *); 64130803Smarcel struct link_map_offsets *(*nto_fetch_link_map_offsets) (void); 65130803Smarcel}; 66130803Smarcel 67130803Smarcelextern struct nto_target_ops current_nto_target; 68130803Smarcel 69130803Smarcel/* For 'maintenance debug nto-debug' command. */ 70130803Smarcel#define nto_internal_debugging \ 71130803Smarcel (current_nto_target.nto_internal_debugging) 72130803Smarcel 73130803Smarcel/* The CPUINFO flags from the remote. Currently used by 74130803Smarcel i386 for fxsave but future proofing other hosts. 75130803Smarcel This is initialized in procfs_attach or nto_start_remote 76130803Smarcel depending on our host/target. It would only be invalid 77130803Smarcel if we were talking to an older pdebug which didn't support 78130803Smarcel the cpuinfo message. */ 79130803Smarcel#define nto_cpuinfo_flags \ 80130803Smarcel (current_nto_target.nto_cpuinfo_flags) 81130803Smarcel 82130803Smarcel/* True if successfully retrieved cpuinfo from remote. */ 83130803Smarcel#define nto_cpuinfo_valid \ 84130803Smarcel (current_nto_target.nto_cpuinfo_valid) 85130803Smarcel 86130803Smarcel/* Given a register, return an id that represents the Neutrino 87130803Smarcel regset it came from. If reg == -1 update all regsets. */ 88130803Smarcel#define nto_regset_id(reg) \ 89130803Smarcel (*current_nto_target.nto_regset_id) (reg) 90130803Smarcel 91130803Smarcel#define nto_supply_gregset(regs) \ 92130803Smarcel (*current_nto_target.nto_supply_gregset) (regs) 93130803Smarcel 94130803Smarcel#define nto_supply_fpregset(regs) \ 95130803Smarcel (*current_nto_target.nto_supply_fpregset) (regs) 96130803Smarcel 97130803Smarcel#define nto_supply_altregset(regs) \ 98130803Smarcel (*current_nto_target.nto_supply_altregset) (regs) 99130803Smarcel 100130803Smarcel/* Given a regset, tell gdb about registers stored in data. */ 101130803Smarcel#define nto_supply_regset(regset, data) \ 102130803Smarcel (*current_nto_target.nto_supply_regset) (regset, data) 103130803Smarcel 104130803Smarcel/* Given a register and regset, calculate the offset into the regset 105130803Smarcel and stuff it into the last argument. If regno is -1, calculate the 106130803Smarcel size of the entire regset. Returns length of data, -1 if unknown 107130803Smarcel regset, 0 if unknown register. */ 108130803Smarcel#define nto_register_area(reg, regset, off) \ 109130803Smarcel (*current_nto_target.nto_register_area) (reg, regset, off) 110130803Smarcel 111130803Smarcel/* Build the Neutrino register set info into the data buffer. 112130803Smarcel Return -1 if unknown regset, 0 otherwise. */ 113130803Smarcel#define nto_regset_fill(regset, data) \ 114130803Smarcel (*current_nto_target.nto_regset_fill) (regset, data) 115130803Smarcel 116130803Smarcel/* Gives the fetch_link_map_offsets function exposure outside of 117130803Smarcel solib-svr4.c so that we can override relocate_section_addresses(). */ 118130803Smarcel#define nto_fetch_link_map_offsets() \ 119130803Smarcel (*current_nto_target.nto_fetch_link_map_offsets) () 120130803Smarcel 121130803Smarcel/* Keep this consistant with neutrino syspage.h. */ 122130803Smarcelenum 123130803Smarcel{ 124130803Smarcel CPUTYPE_X86, 125130803Smarcel CPUTYPE_PPC, 126130803Smarcel CPUTYPE_MIPS, 127130803Smarcel CPUTYPE_SPARE, 128130803Smarcel CPUTYPE_ARM, 129130803Smarcel CPUTYPE_SH, 130130803Smarcel CPUTYPE_UNKNOWN 131130803Smarcel}; 132130803Smarcel 133130803Smarcelenum 134130803Smarcel{ 135130803Smarcel OSTYPE_QNX4, 136130803Smarcel OSTYPE_NTO 137130803Smarcel}; 138130803Smarcel 139130803Smarcel/* These correspond to the DSMSG_* versions in dsmsgs.h. */ 140130803Smarcelenum 141130803Smarcel{ 142130803Smarcel NTO_REG_GENERAL, 143130803Smarcel NTO_REG_FLOAT, 144130803Smarcel NTO_REG_SYSTEM, 145130803Smarcel NTO_REG_ALT, 146130803Smarcel NTO_REG_END 147130803Smarcel}; 148130803Smarcel 149130803Smarceltypedef char qnx_reg64[8]; 150130803Smarcel 151130803Smarceltypedef struct _debug_regs 152130803Smarcel{ 153130803Smarcel qnx_reg64 padding[1024]; 154130803Smarcel} nto_regset_t; 155130803Smarcel 156130803Smarcel#endif 157