gdb/sparc64-linux-nat.c - gdb

Global variables defined

Functions defined

Source code

  1. /* Native-dependent code for GNU/Linux UltraSPARC.

  2.    Copyright (C) 2003-2015 Free Software Foundation, Inc.

  3.    This file is part of GDB.

  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 3 of the License, or
  7.    (at your option) any later version.

  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.

  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  14. #include "defs.h"
  15. #include "regcache.h"

  16. #include <sys/procfs.h>
  17. #include "gregset.h"

  18. #include "sparc64-tdep.h"
  19. #include "sparc-tdep.h"
  20. #include "sparc-nat.h"
  21. #include "inferior.h"
  22. #include "target.h"
  23. #include "linux-nat.h"

  24. static const struct sparc_gregmap sparc64_linux_ptrace_gregmap =
  25. {
  26.   16 * 8,                        /* "tstate" */
  27.   17 * 8,                        /* %pc */
  28.   18 * 8,                        /* %npc */
  29.   19 * 8,                        /* %y */
  30.   -1,                                /* %wim */
  31.   -1,                                /* %tbr */
  32.   0 * 8,                        /* %g1 */
  33.   -1,                                /* %l0 */
  34.   4                                /* sizeof (%y) */
  35. };


  36. void
  37. supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
  38. {
  39.   sparc64_supply_gregset (sparc_gregmap, regcache, -1, gregs);
  40. }

  41. void
  42. supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
  43. {
  44.   sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, -1, fpregs);
  45. }

  46. void
  47. fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
  48. {
  49.   sparc64_collect_gregset (sparc_gregmap, regcache, regnum, gregs);
  50. }

  51. void
  52. fill_fpregset (const struct regcache *regcache,
  53.                prfpregset_t *fpregs, int regnum)
  54. {
  55.   sparc64_collect_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
  56. }

  57. /* Provide a prototype to silence -Wmissing-prototypes.  */
  58. void _initialize_sparc64_linux_nat (void);

  59. void
  60. _initialize_sparc64_linux_nat (void)
  61. {
  62.   struct target_ops *t;

  63.   /* Fill in the generic GNU/Linux methods.  */
  64.   t = linux_target ();

  65.   sparc_fpregmap = &sparc64_bsd_fpregmap;

  66.   /* Add our register access methods.  */
  67.   t->to_fetch_registers = sparc_fetch_inferior_registers;
  68.   t->to_store_registers = sparc_store_inferior_registers;

  69.   /* Register the target.  */
  70.   linux_nat_add_target (t);

  71.   sparc_gregmap = &sparc64_linux_ptrace_gregmap;
  72. }