| 1 | /* Native-dependent code for GNU/Linux UltraSPARC. |
| 2 | |
| 3 | Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010 |
| 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 "regcache.h" |
| 23 | |
| 24 | #include <sys/procfs.h> |
| 25 | #include "gregset.h" |
| 26 | |
| 27 | #include "sparc64-tdep.h" |
| 28 | #include "sparc-tdep.h" |
| 29 | #include "sparc-nat.h" |
| 30 | #include "inferior.h" |
| 31 | #include "target.h" |
| 32 | #include "linux-nat.h" |
| 33 | |
| 34 | static const struct sparc_gregset sparc64_linux_ptrace_gregset = |
| 35 | { |
| 36 | 16 * 8, /* "tstate" */ |
| 37 | 17 * 8, /* %pc */ |
| 38 | 18 * 8, /* %npc */ |
| 39 | 19 * 8, /* %y */ |
| 40 | -1, /* %wim */ |
| 41 | -1, /* %tbr */ |
| 42 | 0 * 8, /* %g1 */ |
| 43 | -1, /* %l0 */ |
| 44 | 4 /* sizeof (%y) */ |
| 45 | }; |
| 46 | \f |
| 47 | |
| 48 | void |
| 49 | supply_gregset (struct regcache *regcache, const prgregset_t *gregs) |
| 50 | { |
| 51 | sparc64_supply_gregset (sparc_gregset, regcache, -1, gregs); |
| 52 | } |
| 53 | |
| 54 | void |
| 55 | supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs) |
| 56 | { |
| 57 | sparc64_supply_fpregset (regcache, -1, fpregs); |
| 58 | } |
| 59 | |
| 60 | void |
| 61 | fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum) |
| 62 | { |
| 63 | sparc64_collect_gregset (sparc_gregset, regcache, regnum, gregs); |
| 64 | } |
| 65 | |
| 66 | void |
| 67 | fill_fpregset (const struct regcache *regcache, |
| 68 | prfpregset_t *fpregs, int regnum) |
| 69 | { |
| 70 | sparc64_collect_fpregset (regcache, regnum, fpregs); |
| 71 | } |
| 72 | |
| 73 | /* Provide a prototype to silence -Wmissing-prototypes. */ |
| 74 | void _initialize_sparc64_linux_nat (void); |
| 75 | |
| 76 | void |
| 77 | _initialize_sparc64_linux_nat (void) |
| 78 | { |
| 79 | struct target_ops *t; |
| 80 | |
| 81 | /* Fill in the generic GNU/Linux methods. */ |
| 82 | t = linux_target (); |
| 83 | |
| 84 | /* Add our register access methods. */ |
| 85 | t->to_fetch_registers = sparc_fetch_inferior_registers; |
| 86 | t->to_store_registers = sparc_store_inferior_registers; |
| 87 | |
| 88 | /* Register the target. */ |
| 89 | linux_nat_add_target (t); |
| 90 | |
| 91 | sparc_gregset = &sparc64_linux_ptrace_gregset; |
| 92 | } |