1 /* Native-dependent code for GNU/Linux UltraSPARC. 2 3 Copyright (C) 2003, 2007, 2008, 2009, 2010, 2011 4 Free Software Foundation, Inc. 5 6 This file is part of GDB. 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 3 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 20 21 #include "defs.h" 22 #include "gdbarch.h" 23 24 #include "sparc64-tdep.h" 25 #include "sparc-nat.h" 26 27 /* Determine whether `gregset_t' contains register REGNUM. */ 28 29 static int 30 sparc64_gregset_supplies_p (struct gdbarch *gdbarch, int regnum) 31 { 32 if (gdbarch_ptr_bit (gdbarch) == 32) 33 return sparc32_gregset_supplies_p (gdbarch, regnum); 34 35 /* Integer registers. */ 36 if ((regnum >= SPARC_G1_REGNUM && regnum <= SPARC_G7_REGNUM) 37 || (regnum >= SPARC_O0_REGNUM && regnum <= SPARC_O7_REGNUM) 38 || (regnum >= SPARC_L0_REGNUM && regnum <= SPARC_L7_REGNUM) 39 || (regnum >= SPARC_I0_REGNUM && regnum <= SPARC_I7_REGNUM)) 40 return 1; 41 42 /* Control registers. */ 43 if (regnum == SPARC64_PC_REGNUM 44 || regnum == SPARC64_NPC_REGNUM 45 || regnum == SPARC64_STATE_REGNUM 46 || regnum == SPARC64_Y_REGNUM 47 || regnum == SPARC64_FPRS_REGNUM) 48 return 1; 49 50 return 0; 51 } 52 53 /* Determine whether `fpregset_t' contains register REGNUM. */ 54 55 static int 56 sparc64_fpregset_supplies_p (struct gdbarch *gdbarch, int regnum) 57 { 58 if (gdbarch_ptr_bit (gdbarch) == 32) 59 return sparc32_fpregset_supplies_p (gdbarch, regnum); 60 61 /* Floating-point registers. */ 62 if ((regnum >= SPARC_F0_REGNUM && regnum <= SPARC_F31_REGNUM) 63 || (regnum >= SPARC64_F32_REGNUM && regnum <= SPARC64_F62_REGNUM)) 64 return 1; 65 66 /* Control registers. */ 67 if (regnum == SPARC64_FSR_REGNUM) 68 return 1; 69 70 return 0; 71 } 72 73 74 /* Provide a prototype to silence -Wmissing-prototypes. */ 75 void _initialize_sparc64_nat (void); 76 77 void 78 _initialize_sparc64_nat (void) 79 { 80 sparc_supply_gregset = sparc64_supply_gregset; 81 sparc_collect_gregset = sparc64_collect_gregset; 82 sparc_supply_fpregset = sparc64_supply_fpregset; 83 sparc_collect_fpregset = sparc64_collect_fpregset; 84 sparc_gregset_supplies_p = sparc64_gregset_supplies_p; 85 sparc_fpregset_supplies_p = sparc64_fpregset_supplies_p; 86 } 87